I wrote a simple program in C that displays the string. I compiled it for the ARM architect and sent it via FTP to my rooted Leagoo M5.
I mounted the memory as RW and moved the program to /data/local.
I used 'chmod + x armexe' to add execute attributes. Despite this, after executing './armexe' the message './sh: ./data/local/armexe: No drunk file or directory' pops up.
This section from the terminal probably shows it best:
root#M5:/data/local # ls && ./armexe
armexe
tmp
sush: ./armexe: No such file or directory
This error seems strange to me, and somehow I could not find the answer to other forums.
Sorry for my English. I hope you understood me :)
Related
I'm trying to run valgrind on an android OS but it couldn't start and it shows this errors that i couldn't find how to solve:
valgrind: Startup or configuration error:
Can't create client cmdline file in /tmp/valgrind_proc_87_cmdline_876a7612
valgrind: Unable to start up properly. Giving up.
Thanks in advance !
I tried to change the default path that valgrind use and which is shown on the error log but i couldn't make it
The problem is happening in the code where the Valgrind host is creating a fake /proc/<pid>/cmdline.
This file should be created in the location given by the first valid item in the following list:
The TMPDIR environment variable
The constant VG_TMPDIR that gets baked into the binary via a configure time option. This defaults to /tmp but can be overriden using configure --with-tmpdir=/your/tmp/dir. That would require that you get the Valgrind source and configure and build it. It is possible that you are using a package that was built using this option and is not compatible with your system.
Last resort, "/tmp"
All of the above checks just test that the string is non-null and not empty. They do not test for the existance and accessibility of the directory. That gets determined by the Valgrind version of mkstemp and the error message comes from 'valgrind_main'.
Valgrind needs to create a file TMPDIR/valgrind_proc_PID_cmdline_RAND where TMPDIR is described above, PID is the pid of the Valgrind process and RAND is a random number.
There is at least one other similar files that get created, for auxv.
There are no Valgrind command line options to turn off the creation of these files.
I want to build an ocr app in android.For that i am using tessaract library.I am following this turorial ocr tutoial it says follow below steps
Download the NDK & extract to C:\ drive-Done
Set NDK Path & Android SDK path to PATH variable in Enviorment Variable.-Done
Download tessaract library and extract it to C:-Done
open command line & go inside tessract folder ibn downloaded library.-
Write ndk-build-Not Done
When i write ndk-build it says the system can't find the specified path.
Please tell me how to resolve this issue.I have already spent lot of hard time on this.
Thanks in advance.
If you re-read the link you posted, you may notice this line from the author:
Attention: if you fail at any of the above steps, you are not ready for this shit yet. Better grab an introduction to android development course, read a book, then come back to this tutorial. You’ll just waste time and nerves and you’ll bitch about it in the comments that this crash, this doesn’t work. (PS. no, I will not send you the source code on your email, stop spamming k thx.)
You should seriously consider his advice - working with the Android NDK only gets more difficult from here.
You're probably getting that error message because cmd couldn't find the ndk-build program, which is located inside the root of android-ndk-r10e. Possible causes:
You made an error when editing your PATH variable - make sure each file path is separated by a semicolon and that you provided the full path to your NDK install.
Your PATH is too long - the max length is 260 characters. See this page for more info. tl;dr: prefix \?\ to your PATH to get around this length limit.
You had cmd open when you set the variables - try restarting the cmd
program or even restarting your machine.
I am using gdb for dumping core file for an android process. I am running gdbserver on the device on tcp port and gdb client on the desktop. When i do gcore on client i get the below error.
Does any one know why i'm getting this error , any help much appreciated.
(gdb) gcore
Command not implemented for this target.
The reason i'm doing this to dump process memory and extract Classes.dex file from the memory using core file. I've tried doing this using /proc/pid/mem and proc/pid/maps and dump memory but that has too many mapped regions , i couldn't find the area where the Classes.dex file is. Any other alternate approach is also welcome. Thanks for your help.
First of all, you can only dump odex from memory (because dex compiled to odex for execute). But its not a big deal to convert odex to dex using baksmali-smali.
To find odex in memory you can use gdb for checking magic number for every begin-address of mapped memory(proc/pid/maps - first column):
gdb --batch --pid "pid_task" -ex x/s "mem_start"
So, when returned value equal to "dey\n036", you can dump this memory region via gdb.
Try to begin checking memory addresses from the end of file "proc/pid/maps", it will be much faster.
PS Sorry for my english, but hope it will help.
#Chris Stratton, the memory mapped classes.dex file will be different from the dex file inside apk on disk, for example in cases of packed dex files, some part of dex will be deobfuscated, question is to dump the memory mapped classes.dex file by getting the process memory.
You can use GameGuardian for this. Need root.
Memory editor tab - menu - memory dump - input 0-0 as range and folder - press ok - wait for toast Dump end.
Go to selected folder - open maps file - search needed odex in regions - remember start address of region - open GameGuardian - menu - memory dump - input remembered address in both field as range - press ok - wait for toast Dump end.
Now you have in your folder .bin file with dumped odex file.
Also you can find address in drop down list in GameGuardian UI. Press drop down icon on right with dump range field.
Here some video examples how to do this:
How to dump odex file from memory on Android -
GameGuardian
This seems to be a question asked many times. I'm using Eclipse to write an Android app, in OS X. So far, no problem, except the app crashes sometimes, and I want to see whats going on so I can fix the problem. (Its probably related to bitmaps or variables not recycling correctly. But I don't know where else to start to look into it.)
I used the DDMS tool (in eclipse) to create a dump file. Then I downloaded the MemoryAnalyzer application to open it. Here is where I have been stuck for an hour: I have to convert the file first because Eclipse writes the hprof file in a different format. How do I convert it?
The answers to this question, error openning HPROF file, directly address my question. The top answer is the same as the reference for the hprof-conv tool.
The hprof file you get from Android has android specific format. You should convert hprof >file take from Android OS into standard hprof format. For this you can use hprof-conv tool >that is located at AndrodiSDK/tools/hprof-conv.
For example:
hprof-conv android.hprof mat.hprof
And then open mat.hprof in Memory Analyzer.
I have a couple problems with this.
when I open the hprof-conv tool, it shows a handful of lines about it then says "[Process completed]". And there is no place to enter any text. The only relevant info on the screen is this:
Usage: hprof-conf infile outfile
I'm in Terminal, so I open "new command..." or tried using the shell thats also open. Then when I run "hprof-conv dump1.hprof dump1a.hprof" I get the error "command not found". So I think I'm off track. I also tried "hprof-conf", instead of "hprof-conv", the way it suggests in point 1. Same error. Also tried various paths to the file, no change.
if I was on the right track, how do I correctly point this command to the file location? I have it on my desktop, and its named dump1.hprof. I'm not very experienced with Terminal.
Thanks in advance for an answer, or perhaps another suggestion on how to hunt down a memory leak.
If you are on mac add a ./ before the command :
./hprof-conv infile.hprof outfile.hprof
Hello and sorry for a late response. I just went through exactly this problem and wrote some instructions here: http://spragucm.wordpress.com/2013/11/21/debugging-android-project-ddms-heap-dump-in-eclipse/
Method 1: Use the Standalone MAT
go into c:...\sdk-tools\tools and copy hprof-conv.exe
go to whatever folder you saved your dump1.hprof file and paste the .exe file
open a terminal and change directory to the folder with your dump and .exe file (e.g. if folder is c:\Users\YourName\DumpFolder then type cd c:\Users\YourName\DumpFolder)
When you're in the folder type the following in the command prompt and hit enter: hprof-conf infile.hprof outfile.hprof
NOTE: If you get an error about directory not found, you're not in the correct directory in the command prompt
The outfile.hprof file should be in the same folder as the other files.
Method 2: Using MAT in Eclipse
Install the plug-in for MAT in Eclipse
Select to get heap dump as before
Go to Window->Open Perspective->other->Memory Analysis
Look through your tabs for a window with a blue disk icon in top left and expand the tab (this will have some crazy name on it with a very long string of numbers)
Done...you are looking at the heap dump in Eclipse
I am editing the Android phone file "init.tuna.rc" so that it prints to me some basic debugging checkpoint messages so I can analyze how far the phone gets in the boot process.
Does anyone know if you can simply insert the shell scripting syntax for console printing into a "run command" file (.rc)?
(I need to know this if someone can help me before I rebuild all of my code for the Android tree to test this debugging code, given the process can a while)
Will the following work? I want to insert in the following code snippet into the "init.tuna.rc" file:
# Boot debugging Checkpoint #2
echo "Check #2: Successfully wrote the file system data, including the wifi directories!"
If this does not work, what can I do to get the "rc" file to print messages to the actual terminal as it executes?
Android Boot Language is documented in a readme.txt file in the source tree under <android>/system/core/init.
No echo is mentioned, but you can try. Also remember that you should write to a file because stderr and stdout are redirected to /dev/null.
See https://github.com/aosp-mirror/platform_system_core/blob/master/init/README.md