Generate core dump in android
Asked Answered
J

2

11

I'm developping a android's aplication using some shared libraries written by me and compiled with ndk-r5b. The application works, y and the calls to the libraries works too, but I detected some errors, segmentations faults, and I need to debug it, but, I don't know how debug native code from android and I don't know if I can generate core dumps, as in linux, for debug my libraries.

Any idea?

Joyann answered 31/5, 2011 at 10:43 Comment(0)
P
6

The ndk comes with ndk-gdb, which supposedly allows you to debug native applications. Also, if you download the whole andriod open source project, they also have some version of gdb used for debugging. Look in the docs/ folder of the ndk to learn about using it. This tutorial might also prove helpful: http://vilimpoc.org/blog/2010/09/23/hello-gdbserver-a-debuggable-jni-example-for-android/

However, as shown in a recent question I asked: Running ndk-gdb with package not found error on motorola phone I still can't get it to work.

Edit: You said in the comments you were using a Samsung Device: Samsung decide to wreck havoc on some of the crucial internals required for native debugging, but it's easily fixable if you have root access to the device. If you use the --verbose flag, you'll probably find that the error is different than that, a package unknown error. That's because it's looking in /data/system/packages.list, but samsung renamed that file to /dbdata/system/packages.list. So if you make a symlink to that file in /data/system/packages.list, (requires root access) it should work. Or at least so claims the ndk mailing list: http://osdir.com/ml/android-ndk/2011-03/msg00036.html

Perception answered 31/5, 2011 at 14:47 Comment(5)
Thanks Leif, I know that ndk-gdb exists but I always get the same error... "Could nor setup network redirection to gbdserver? Maybe using --port=<port> to use a different TCP port might help?"... and I can't solve it. I'm debugging on a Samsung tab GT p1000Joyann
Ah, okay. Samsung decide to wreck havoc on some of the crucial internals required for native debugging, but it's easily fixable if you have root access to the device. If you use the --verbose flag, you'll probably find that the error is different than that, a package unknown error. That's because it's looking in /data/system/packages.list, but samsung renamed that file to /dbdata/system/packages.list. So if you make a symlink to that file in /data/system/packages.list, (requires root access) it should work.Perception
Here is where I think I got that answer from: osdir.com/ml/android-ndk/2011-03/msg00036.htmlPerception
I also added that as part of the answer.Perception
To make the symlink is very easy. First, locates your adb.exe into your sdk directory, then in a shell writes "/SDK_DIR/adb.exe shell". With this you are into your device, then writes "su" to enter how super users and finaly "ln -s /dbdata/system/packages.list /data/system/packages.list." Thanks again.Joyann
G
0

twelve years over , I'm try to build and edit aosp , I found build/envsetup.sh file content coredump_* function .

aosp crash will generate core file on /cores (about core file path try check envsetup.sh code)

I'm using aosp_6.0.0_r1

Galactic answered 13/5 at 3:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.