[android-developers] Re: some questions about using gdbserver and JNI libraries

2009-11-05 Thread fadden
On Nov 5, 5:50 am, Michael Ambrus michael.amb...@gmail.com wrote:
 Setting breakpoints and running works, but when gdb starts up it also
 prints out:

 gdb: Unable to get location for thread creation breakpoint: requested
 event is not supported

 Is there a problem with gdb thread support in 1.6?

I don't know.  The debugging process is a dance between gcc, gdb,
gdbserver, libc pthreads, the Linux kernel, etc.  Getting it all right
is something of an art form.

arm-eabi-gdb is version 6.6 which is a bit behind the times.
http://android.git.kernel.org/ just recently got a handful of
toolchain directories added, so it should be easier to track changes
in the AOSP going forward.

-- 
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


[android-developers] Re: some questions about using gdbserver and JNI libraries

2009-11-03 Thread fadden
On Nov 2, 9:10 am, Michael Ambrus michael.amb...@gmail.com wrote:
  gdbclient mediaserver :5039  31

 What I get in the end is:

 gdb: Unable to get location for thread creation breakpoint: requested
 event is not supported
 __dl__start () at bionic/linker/arch/arm/begin.S:35
 35              mov     r0, sp


I get that too, if I supply the same arguments.  The problem is that
the gdbclient shell function isn't doing what you think it's doing.
The third argument isn't a pid, it's a process name, which is fed to
the pid shell function to determine the process ID.

If you instead do:

% gdbclient mediaserver :5039 mediaserver

you'll have much better results.  (It took me a minute to figure that
out -- the big clue for me was that when you disconnect gdb the remote
end is killed, but in this case the mediaserver process wasn't dying.)

-- 
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


[android-developers] Re: some questions about using gdbserver and JNI libraries

2009-11-02 Thread Michael Ambrus
I have similar issues as you do. Especially this part is worrying:

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?)

Fadden, I used the gdbclient to help me set up both host and target
side. I still get the above issue when I'm debugging programs/
processes in the emulator (haven't tried on real device yet).

Some additional questions:
* Would anybody know if the last build settings (to be used by the
gdbclient shell-function i.e.) are somehow remembered? I.e. which
target was built and with which tool-chain e.t.a.. As Michael pointed
out, there's two versions of pre-built tool-chains and one might have
multiple targets.

* Could the configure used by gdbclient shell-function safely be
changed? Say that you have two different targets and you would want to
use the gdblient to debug either one or the other. Could you then run
choosecombo to change the settings *without* rebuilding the complete
source?

* In which out directory are the binaries with symbol information to
be used by the AVD's stored? It would make sense to have an out
directory called ./out/target/product/emulator, but the only thing
that makes sense (to me) is out/target/product/generic. What if you've
built a SDK for another target. Would the binaries still be under out/
target/product/generic ?

In my case when I'm for example trying to debug the mediaserver on the
emulator:

 gdbclient mediaserver :5039  31

What I get in the end is:

gdb: Unable to get location for thread creation breakpoint: requested
event is not supported
__dl__start () at bionic/linker/arch/arm/begin.S:35
35  mov r0, sp
gdb: Unable to get location for thread creation breakpoint: requested
event is not supported
Current language:  auto; currently asm
(gdb)


Shouldn't --attach just stop the running process? Is this output
nonsense or is the process actually restarting?

Regards
Michael







On Oct 15, 9:30 pm, fadden fad...@android.com wrote:
 On Oct 15, 7:08 am, Michael Richardson m...@sandelman.ca wrote:

  (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
 [...]
  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)

 adb forward should work equally well with the emulator and with a
 real device.

 build/envsetup.sh has a gdbclient shell function that automates some
 of this; if you have a full source tree I recommend using it (or at
 least looking at it to see what it does).

 On the device:

 # gdbserver :5039 --attach pid

 On the host, just cd to the top of your source tree and type
 gdbclient.  Magic happens (it assumes port 5039 is forwarded and
 you're debugging app_process).  If magic doesn't happen, try the steps
 individually:

 % cd top-of-tree
 % adb forward tcp:5039 tcp:5039
 % ./prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gdb out/
 target/product/product-name/symbols/system/bin/app_process
 (gdb) set solib-absolute-prefix /absolute-source-path/out/target/
 product/product-name/symbols
 (gdb) set solib-search-path /absolute-source-path/out/target/product/
 product-name/symbols/system/lib
 (gdb) target remote :5039

 Note in particular the use of absolute paths.  Last I checked, gdb
 provided no diagnostics if you got the path wrong.

-- 
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


[android-developers] Re: some questions about using gdbserver and JNI libraries

2009-10-15 Thread fadden

On Oct 15, 7:08 am, Michael Richardson m...@sandelman.ca wrote:
 (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
[...]
 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)

adb forward should work equally well with the emulator and with a
real device.

build/envsetup.sh has a gdbclient shell function that automates some
of this; if you have a full source tree I recommend using it (or at
least looking at it to see what it does).

On the device:

# gdbserver :5039 --attach pid

On the host, just cd to the top of your source tree and type
gdbclient.  Magic happens (it assumes port 5039 is forwarded and
you're debugging app_process).  If magic doesn't happen, try the steps
individually:

% cd top-of-tree
% adb forward tcp:5039 tcp:5039
% ./prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gdb out/
target/product/product-name/symbols/system/bin/app_process
(gdb) set solib-absolute-prefix /absolute-source-path/out/target/
product/product-name/symbols
(gdb) set solib-search-path /absolute-source-path/out/target/product/
product-name/symbols/system/lib
(gdb) target remote :5039

Note in particular the use of absolute paths.  Last I checked, gdb
provided no diagnostics if you got the path wrong.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---