I did the following but I get a connection refused when I try to
attach gdb.
C:\android-sdk-windows\tools>adb shell
# gdbserver :12345 --attach 1478
gdbserver :12345 --attach 1478
Attached; pid = 1478
Listening on port 12345
$ /cygdrive/c/android-sdk-windows/android-ndk-r4/build/prebuilt/
windows/arm-eabi-4.2.1/bin/arm-eabi-gdb.exe
This GDB was configured as "--host=i686-pc-cygwin --target=arm-elf-
linux".
(gdb) target remote localhost:1234
localhost:1234: Connection refused.
What am I doing wrong?
Also, can someone explain the need for port forwarding if both the
debugger and the debuggee are running on the same computer?
Thanks,
Ranjit
You use port 12345 in your gdbserver command and port 1234 in your gdb
target, which is fine but - you also need to use adb to forward the
host port to a port on the emulator (adb forward tcp:1234 tcp:12345 in
your example)
> Also, can someone explain the need for port forwarding if both the
> debugger and the debuggee are running on the same computer?
As far as gdb (and most of your system) is concerned, they are not
running on the same computer - it is almost impossible for a process
on your local machine to directly access a specific process inside the
Android emulator.
The emulator is a virtual machine and "adb" is effectively providing a
network connection between the real machine and the Android "machine".
- Gus
On May 26, 12:01 am, Angus Lees <al...@google.com> wrote: