We have been using gdbserver to debug our JNI code as follows.
We have been less than successful -- breakpoints do not always get
activated, sometimes we get SIGILL, and we seldom ever get a useful
stack when the debugging stops on SIGSEGV, sometimes the program dies
with SIGTRAP!!!

We have occasionally been able to have debug sessions with s/n, but
since pretty much every SEGV has resulted in either a damaged stack,
or
at least, gdbserver can not find the stack, it's a pain.

Is there something we are missing?  Is there some reason to use the
4.2.1 vs 4.3.1 toolchain?  (Why are there two toolchains? I assume
because of bugs in each that are fixed in the other... which bugs?)

We guessed that the "dalvik" process that we wanted to debug was
app_process --- we found this out by looking at /proc/XXX/cmdline on
our
running activity.

This is what we do typically do
     (repo sync directory is in /build/m1 for me)

invoke:
  /build/m1/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
gdb

(some of us use -tui, some of us run it under Xemacs, etc.)

we then do:

Current directory is /build/m1/
GNU gdb 6.6
...
(gdb) cd /build/m1
Working directory /build/m1
 (canonically /build/m2).
(gdb) file out/target/product/generic/symbols/system/bin/app_process
Reading symbols from /build/m2/out/target/product/generic/symbols/
system/bin/app_process...done.
(gdb) set solib-search-path out/target/product/generic/symbols/system/
lib

We then start our activity, adb shell, discover the PID of the
activity,
discover the IP of the phone with "netcfg", and:

app_15   1815  49    107468 15744 ffffffff afe0d4a4 S
org.credil.thomas_watson.videophoneservice

# gdbserver 0.0.0.0:1234 --attach 1815
Attached; pid = 1815
Listening on port 1234
Remote debugging from host 132.213.238.4

(gdb) target remote 132.213.236.179:1234

This is with a physical device.  With an emulator, one has to, of
course, run the adb forward stuff. (Too bad that doesn't work with a
real device too, as then I would not need to run gdb over the
wireless)


Program terminated with signal SIGKILL, Killed.
The program no longer exists.
(gdb) target remote 132.213.236.179:1234
Remote debugging using 132.213.236.179:1234
Error while mapping shared library sections:
/system/bin/linker: No such file or directory.
warning: .dynamic section for "/build/m2/out/target/product/generic/
symbols/system/lib/libc.so" is not at the expected address (wrong
library or version mismatch?)
... many more
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
tkill () at bionic/libc/arch-arm/bionic/tkill.S:52

(gdb) break sendframe
Breakpoint 1 at 0x80401086: file /build/m1/packages/apps/
VideoPhoneService/libvideophoneservice/src/rooster.cpp, line 96.

(gdb) c
Continuing.

Program terminated with signal SIGTRAP, Trace/breakpoint trap.
The program no longer exists.
(gdb)







(btw, an annoyance about googlegroups is that it seems that it looks
at
my SMTP from header, rather than From:... This basically means that I
can not post from gmane.org via NNTP, which is a shame.  Is there a
secret NNTP access on googlegroups.com, I wonder?)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to