Remote 'g' packet reply is too long aarch64 arm64

1.8k views Asked by At

I am trying to setup KGDB to debug our arm64 kernel. My setup is that target is running on kernel 3.14 (with some arm64 kgdb patches back ported), on host I used the linaro toolchain 4.8 aarch64-linux-gnu-gdb, and whenever I issue:

target remote /dev/ttyS0

I got the error message:

Remote 'g' packet reply is too long:

I Googled a lot on the problem, and none of them worked out for me. I think this problem is specific to arm64. Does anyone here by any chance know how to proceed?

2

There are 2 answers

0
afewyz On

Inspired the question here: https://answers.launchpad.net/gcc-arm-embedded/+question/193249

I found the solution. Before issuing

target remote /dev/ttyS0

do the following

set tdesc filename aarch64.xml

I took aarch64.xml from the latest gdb source code: gdb-7.8/gdb/features/aarch64.xml. By doing that, we instruct the GDB client to accept more registers than it initially expects.

The root cause seems that the GDB client is only expecting 31 registers and register SP, PC, CPSR, but kernel gdb stub returns not only those registers but other FPU registers, which cause error message:

Remote 'g' packet reply is too long:
2
Schievel On

Normally gdbserver is sending information of the remote target when gdb (client) connects. Your GDB could not read the xml for some reason. This is either because the target architecture is so obscure, it does not know it or GDB can't read the xml files. The latter is ofter because it was not configured with xml support during compilation.