This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Debug native system-level code (c++) of Android Sources (AOSP) with DS-5

I'm using DS-5 to debug native code of my custom android application and it works well, my question now is about android source code (AOSP) that i have recompiled.

It's possible to debug the system-level C++ code (with DS-5) ? For example debug native code of system_process ?

Thanks in advance,

Best Regards

Parents
  • DS-5 debug connects to an ARM enhanced version of gdb as you already know. You can debug native code in the Android system server (forked by zygote when the system boots up) with DS-5 and debug Java with DDMS. The simplest method to attach the debugger would be to create a new Android project in DS-5 and change the package name to system_process in the AndroidManifest.xml. Then you can go to the DDMS or DS-5 debugger views and attach to any thread you like. You can specify where the Android source is; frameworks/base and libcore contain most of the interesting Android code.

    If you want to catch system_process as it is forked by zygote at boot, you'll have to put system_process in to a loop as it starts, attach GDB and then break out of that loop (e.g. with a variable you edit from within GDB). I know that sounds like a bit of a hack but it is the only way I've able to successfully gotten the gdb server to attach to thread 1 so far. I'll see if I can work up a more elegant solution. Let me know if you have one already.

    Thanks,

    Matt

Reply
  • DS-5 debug connects to an ARM enhanced version of gdb as you already know. You can debug native code in the Android system server (forked by zygote when the system boots up) with DS-5 and debug Java with DDMS. The simplest method to attach the debugger would be to create a new Android project in DS-5 and change the package name to system_process in the AndroidManifest.xml. Then you can go to the DDMS or DS-5 debugger views and attach to any thread you like. You can specify where the Android source is; frameworks/base and libcore contain most of the interesting Android code.

    If you want to catch system_process as it is forked by zygote at boot, you'll have to put system_process in to a loop as it starts, attach GDB and then break out of that loop (e.g. with a variable you edit from within GDB). I know that sounds like a bit of a hack but it is the only way I've able to successfully gotten the gdb server to attach to thread 1 so far. I'll see if I can work up a more elegant solution. Let me know if you have one already.

    Thanks,

    Matt

Children
No data