3

I am trying to get going remote debugging using gdbserver running on a ARM target running Linux kernel version 2.6.38.8.

On this target I run a gdbserver which is a 32-bit ELF file, as below:

./gdbserver --remote-debug --attach 192.xxx.xxx.2:2345 1600

Attached; pid = 1600
Listening on port 2345

The gdb server on starting says:

This gdbserver was configured as "arm-none-linux-gnueabi"

On a Ubuntu (32 bit) machine I run the GDB client which also seems 32 bit(/usr/bin/gdb) as below to connect to the remote GDB server. On the GDB prompt I enter as below:

(gdb) **target remote 192.xxx.xxx.2:2345**

Remote debugging using 192.xxx.xxx.2:2345

**warning: Architecture rejected target-supplied description**

Below are errors I see on the GDB prompt of the client:

Remote 'g' packet reply is too long: fcfdffff901bdbbe84d00e4002000000000000000000000000000100a2000000901bdbbe0000000000a006400000000000000000f819dbbe34bd3a4044bd3a40100000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008c4200b808422200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000
(gdb)

After issuing this command, I see below error on target gdbserver:

Remote debugging from host 192.xxx.xxx.28

**readchar: Got EOF**

Remote side has terminated connection.  GDBserver will reopen the connection.

The client gdb says:

This GDB was configured as "**i686-linux-gnu**".

Note: Also tried running gdbserver on the target with the --target-debug option, but still it did not work, but it spitted more errors on the server upon the client trying to connect. I can put up those errors if it helps.

See the Errors.

What is the error saying?

What is the mismatch between server, client?

How can I resolve this and get it working?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
goldenmean
  • 18,376
  • 54
  • 154
  • 211
  • 1
    I can't test this, but it would probably help to install an ARM-aware gdb on the x86 system. `apt-get install gdb-arm-none-eabi` will install `/usr/bin/arm-none-eabi-gdb`, which on my ubuntu 14.04 64-bit system reports `This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi"`. – Mark Plotnick Oct 21 '14 at 19:42
  • @MarkPlotnick Will check tomorrow and update – goldenmean Oct 21 '14 at 20:37
  • @MarkPlotnick - When i tried to install using apt-get install gdb-arm-none-eabi , got an error saying "Unable to locate package gdb-arm-none-eabi" . What am i missing? How do i install that gdb package? – goldenmean Oct 22 '14 at 09:40
  • @MarkPlotnick - I even tried building gdb 7.3 from src to configure for target=arm and it failed. Would it be possible for you to share that gdb binary for arm target you have please? – goldenmean Oct 22 '14 at 10:47
  • Ubuntu I have is 11.10 (32bit) system – goldenmean Oct 22 '14 at 11:57
  • Oh, 11.10 is very old and may not have that package. The gdb binary I have is for 64-bit systems, so that won't help you. I downloaded the package from http://packages.ubuntu.com/trusty/devel/gdb-arm-none-eabi , so you can try downloading the i386 version there. Note the list of other packages it requires and make sure you have them; look at http://askubuntu.com/questions/91815/how-to-install-software-or-upgrade-from-an-old-unsupported-release for info on getting packages for old Ubuntu releases. – Mark Plotnick Oct 22 '14 at 14:42
  • According to [this question](http://stackoverflow.com/questions/5665800/compiling-gdb-for-remote-debugging), you can use `./configure --target=arm-none-linux-gnueabi ` to compile gdb for an ARM target. – Mark Plotnick Oct 22 '14 at 14:44
  • @MarkPlotnick - Thanks. Yes , its soup of a situation. I tried configuring gdb 7.8 with target=arm-none-linux-gnueabi but the subsequent make fails saying "configure error termcap not found" – goldenmean Oct 22 '14 at 15:56
  • IIRC, you'll need to have libncurses5-dev, libexpat1-dev, and (optionally) python-dev installed to compile gdb. – Mark Plotnick Oct 22 '14 at 16:13
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63506/discussion-between-goldenmean-and-mark-plotnick). – goldenmean Oct 22 '14 at 16:52

1 Answers1

1

I have managed to get a GDB server and GDB client which have worked for my 32-bit Ubuntu (client GDB) and ARM Cortex A8 target (GDB server). I got the pre-built binaries from the Linaro toolchain binaries link.

These worked perfectly!

I also tried a later version of the 4.9 toolchain, and it worked as well.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
goldenmean
  • 18,376
  • 54
  • 154
  • 211