debug android with gdb on remote Linux

1,559 views
Skip to first unread message

Pan

unread,
Sep 6, 2009, 9:51:08 PM9/6/09
to android-ndk
Hi,

I have the emulator running on my windows, and a Linux is used to
build the entire Android platform code. Here is what I tried to debug
the native code with my emulator, please help verify what is wrong

launch the gdbserver on emulator like,

./gdbserver :3050 ./hello

run adb forward tcp:1234 tcp:3050 on windows, then check the forward
result, I can see it is listening on my windows localhost,

TCP 127.0.0.1:1234 0.0.0.0:0 LISTENING

I need to run arm gdb on a remote Linux machine, so a ssh tunnel is
setup between the linux and windows machines. I use putty to do the
port forwarding, the tunnel setting in putty is "R1234
ip.of.linux.machine:1234", I can see it is listening on the linux
localhost like,

tcp 0 0 127.0.0.1:1234 0.0.0.0:* LISTEN

prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gdb out/
target/product/generic/symbols/system/bin/hello
(gdb) target remote :1234
Remote debugging using :1234
putpkt: write failed: Broken pipe.
(gdb)

Any idea what's the wrong in my steps above?

Freepine

unread,
Sep 7, 2009, 9:22:29 AM9/7/09
to andro...@googlegroups.com
Shouldn't the tunnel setting in putty be R1234 -> localhost:1234?
Then the debug session can be established from remote Linux machine:1234 -> Windows host port 1234 ->emulator/device:1234.

Pan

unread,
Sep 8, 2009, 2:16:44 AM9/8/09
to android-ndk
Great, I verified your suggestion works fine

Could anyone tell me what the below warning means?

GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf-
linux"...
(gdb) set solib-search-path out/target/product/generic/symbols/system/
lib
(gdb) set solib-absolute-prefix out/target/product/generic/symbols
(gdb) target remote :1234
Remote debugging using :1234
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.


On Sep 7, 9:22 pm, Freepine <freep...@gmail.com> wrote:
> Shouldn't the tunnel setting in putty be R1234 -> localhost:1234?Then the
> debug session can be established from remote Linux machine:1234 -> Windows
> host port 1234 ->emulator/device:1234.
>

David Turner

unread,
Sep 8, 2009, 9:20:51 AM9/8/09
to andro...@googlegroups.com
It means you won't be able to put breakpoints in the shared library's "initializers" sections,
which currently should only correspond to static C++ constructors.

nick

unread,
Sep 12, 2009, 10:36:22 AM9/12/09
to android-ndk
I meet the same problem.
When remove the putty "R1234 ip.of.linux.machine:1234" setting,
./arm-eabi-gdb
(gdb) target remote remote:1234
remote:1234: Connection refused.
Why about it ?
Thanks!

I have launch the gdbserver on emulator like,
./gdbserver :3050 -attch:995
gdbserver :3050 --attach 995
Attached; pid = 995
Listening on port 3050

and run adb forward tcp:1234 tcp:3050 on windows
netstat -aon
TCP 127.0.0.1:1234 0.0.0.0:0 LISTENING




On Sep 8, 2:16 pm, Pan <pan.gaoy...@gmail.com> wrote:
> Great, I verified your suggestion works fine
>
> Could anyone tell me what the below warning means?
>
> GNUgdb6.6
> Copyright (C) 2006 Free Software Foundation, Inc.GDBis free software, covered by the GNU General Public License, and
> you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty forGDB.  Type "show warranty" for
> details.
> ThisGDBwas configured as "--host=i686-pc-linux-gnu --target=arm-elf-
> linux"...
> (gdb) set solib-search-path out/target/product/generic/symbols/system/
> lib
> (gdb) set solib-absolute-prefix out/target/product/generic/symbols
> (gdb) target remote :1234
> Remote debugging using :1234
> warning: Unable to find dynamic linker breakpoint function.GDBwill be unable to debug shared library initializers
> and track explicitly loaded dynamic code.
>
> On Sep 7, 9:22 pm, Freepine <freep...@gmail.com> wrote:
>
> > Shouldn't the tunnel setting in putty be R1234 -> localhost:1234?Then the
> > debug session can be established from remote Linux machine:1234 -> Windows
> > host port 1234 ->emulator/device:1234.
>
> > On Mon, Sep 7, 2009 at 9:51 AM, Pan <pan.gaoy...@gmail.com> wrote:
>
> > > Hi,
>
> > > I have the emulator running on my windows, and a Linux is used to
> > > build the entireAndroidplatform code. Here is what I tried to debug
> > > the native code with my emulator, please help verify what is wrong
>
> > > launch the gdbserver on emulator like,
>
> > >  ./gdbserver :3050 ./hello
>
> > > run adb forward tcp:1234 tcp:3050 on windows, then check the forward
> > > result, I can see it is listening on my windows localhost,
>
> > >  TCP    127.0.0.1:1234         0.0.0.0:0              LISTENING
>
> > > I need to run armgdbon a remote Linux machine, so a ssh tunnel is
Reply all
Reply to author
Forward
0 new messages