androidjdb

jdb with android apps - unable to open source file


I am hoping to use jdb to debug android apps in the emulator via the ddms go between.

I have successfully set a breakpoint in my class' onCreate and the debugger (jdb) duly breaks. However if I try to "list" the code it says it can not find the source file. I start jdb like this from emacs :-

jdb -sourcepath="~/programming/android/projects/myproj/src/net/richardriley/myproj" -attach localhost:8700

and I know for a fact that myact.java is there in that directory. I am a jdb newbie but isnt sourcepath the way to deal with this? And if not what should I be doing?


Solution

  • I'm a JDB newbie myself and I finally figured out how to solve this problem.

    You need to be in the src folder rather than right in the directory with the source files. That way JDB can follow the package name to find your source files (if I'm not mistaken).

    So if you have a file ~/programming/android/projects/myproj/src/net/richardriley/myproj/SomeClass.java you would refer to it in JDB as net.richardriley.myproj.SomeClass and you would set your sourcepath to ~/programming/android/projects/myproj/src/