Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NDK r11b: the ndk-gdb.py debugger for Mac is not working. #51

Closed
intelzombi opened this issue Mar 28, 2016 · 7 comments
Closed

NDK r11b: the ndk-gdb.py debugger for Mac is not working. #51

intelzombi opened this issue Mar 28, 2016 · 7 comments
Assignees
Milestone

Comments

@intelzombi
Copy link

Details can also be viewed on a Stack Overflow question I posed a week ago. http://stackoverflow.com/questions/36162583/ndk-r11b-help-needed-using-the-ndk-gdb-py-debugger

Platform Information:
Mac OSX Yosemite;
NDK r11b. SDK target 18-21
my application consists of around 8 c/c++ so files. In the past I've used ndk-gdb (sh) script via NDK r10e. the shell script is now deprecated and ndk-gdb.py

I can successfully get the debugger to either launch the app or attach to a running process. I can pause resume the application with the debugger. Setting a break points at known reliable interrupt points has no effect. It doesn't appear from the behavior that it is finding any source or symbol files.

Some command lines I've tried.

ndk-gdb --launch --verbose This launches the application but blocks on Waiting for debugger

ndk-gdb will attach to a running process. ctr-c will pause the execution but a back trace bt lists a corrupt stack.

ndk-gdb --launch -t -v -p $ProjectDir I get a new interface I'm not familiar with and it states [ No Source Available ]

The only feedback thus far is it appears others are having the same issue but it was discovered and stated that the ndk-gdb.py does work for Linux.

Any help or insight would be appreciated

@DanAlbert DanAlbert added this to the r11c milestone Mar 28, 2016
@jmgao
Copy link
Contributor

jmgao commented Mar 29, 2016

This should be fixed for r11c. In the mean time, you can try applying this patch:

diff --git a/ndk-gdb.py b/ndk-gdb.py
index c8cf560..449eede 100755
--- a/ndk-gdb.py
+++ b/ndk-gdb.py
@@ -477,7 +477,8 @@ def pull_binaries(device, out_dir, app_64bit):
             device.pull("/system/bin/app_process", destination)

 def generate_gdb_script(args, sysroot, binary_path, app_64bit, connect_timeout=5):
-    gdb_commands = "file '{}'\n".format(binary_path)
+    gdb_commands = "set osabi GNU/Linux\n"
+    gdb_commands += "file '{}'\n".format(binary_path)

     solib_search_path = [sysroot, "{}/system/bin".format(sysroot)]
     if app_64bit:

@jmgao jmgao closed this as completed Mar 29, 2016
@intelzombi
Copy link
Author

Much appreciated.
Thanks

@intelzombi
Copy link
Author

The fix does work for the most part. I'm still having trouble with the --launch variation. I can only get that to work once out of every 5 or 6 attempts at best. It launches fine however once I've entered a breakpoint and do a continue. I then get the JDB finished unblockng application and the whole thing comes to a stall with the "Waiting for Debugger" dialog on the device just sitting there. Attaching to an already running process doesn't seem to have any issues now so that part is great. Let me know if there is some flag needed that I'm not aware of or if maybe there is still some issues that need to be worked out.

Thanks

@DanAlbert
Copy link
Member

Just to clarify: you've updated to r11c? We shipped this morning. It had a lot of other GDB related fixes as well as the one described in this bug.

@intelzombi
Copy link
Author

Oh heck. No I didn't see the update. I did the diff from the git diff. I'll update and retry. Thank you

@DanAlbert
Copy link
Member

FYI I set up https://groups.google.com/forum/#!forum/android-ndk-announce if you want notifications of new releases.

@intelzombi
Copy link
Author

thanks. I'll subscribe. I downloaded. rebuilt everything with r11c. Everything looks good now. the --launch worked right out of the bag. Good job guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants