Note that there are some explanatory texts on larger screens.

plurals
  1. PODebugging Android NDK native apps
    primarykey
    data
    text
    <p>I'm trying to debug and step through an Android application that segfaults. I've tried <code>ndk-gdb</code>, but with little luck. I've also referred to <a href="https://stackoverflow.com/questions/5575885/android-ndk-debugging">Android NDK Debugging</a> without being able to debug my app.</p> <p>When I try <code>ndk-gdb --start</code>, and I get:</p> <pre><code>$ ndk-gdb --start --verbose Android NDK installation path: /opt/android-ndk-r7 Using default adb command: /opt/android-sdk-linux/platform-tools/adb ADB version found: Android Debug Bridge version 1.0.29 Using final ADB command: '/opt/android-sdk-linux/platform-tools/adb' Using auto-detected project path: . Found package name: com.example.native_plasma ABIs targetted by application: armeabi armeabi-v7a Device API Level: 10 Device CPU ABIs: armeabi-v7a armeabi Compatible device ABI: armeabi-v7a Found debuggable flag: true Found device gdbserver: /data/data/com.example.native_plasma/lib/gdbserver Using gdb setup init: ./libs/armeabi-v7a/gdb.setup Using toolchain prefix: /opt/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- Using app out directory: ./obj/local/armeabi-v7a Found data directory: '/data/data/com.example.native_plasma' Found first launchable activity: android.app.NativeActivity Launching activity: com.example.native_plasma/android.app.NativeActivity ## COMMAND: /opt/android-sdk-linux/platform-tools/adb shell am start -n com.example.native_plasma/android.app.NativeActivity Starting: Intent { cmp=com.example.native_plasma/android.app.NativeActivity } ## COMMAND: /opt/android-sdk-linux/platform-tools/adb shell sleep 2 Found running PID: 0 ERROR: Could not extract PID of application on device/emulator. Weird, this probably means one of these: - The installed package does not match your current manifest. - The application process was terminated. Try using the --verbose option and look at its output for details. </code></pre> <p>This indicates that the application segfaulted more less, but I don't know how to set a breakpoint here since gdb never actually gives a prompt.</p> <p>I also tried this command:</p> <pre><code>$ ../../toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-addr2line -f -e libs/armeabi/libnative-plasma.so bedb2330 ?? ??:0 </code></pre> <p>I have debug symbols I believe.</p> <ul> <li><code>ndk-build -B V=1 APP_OPTIM=debug</code></li> <li><code>Android.mk</code> in <code>jni/</code> has <code>LOCAL_CFLAGS := -g</code></li> <li><code>ant debug</code></li> </ul> <p>I've also <code>ndk-build NDK_DEBUG=1</code> but I still get where it looks like I don't have debug symbols.</p> <p>Here's an image of the stack trace. It doesn't get any more informative:</p> <p><img src="https://i.stack.imgur.com/oN3FS.png" alt="Traceback"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload