internal-error: target_xfer_partial: Assertion `*xfered_len > 0' failed

Wed May 30 20:09:00 GMT 2018

I'm writing a gdbserver that debugs AVR microcontrollers through the debugWIRE protocol. During
debugging sessions avr-gdb sometimes generates an error.  From the info below the error appears
to be an unexpected length for a reply, possibly caused by receiving the start for a new message
before the end of a previous message(?).

I suspect that it may have something to do with the remote serial protocol implementation on my
side, but cannot figure out what.  Here is a sample gdb session of a simple program (with debug
info) loaded into gdb (program is already loaded in microcontroller), the program is continued
without break points, the program is interrupted by Ctrl+C.  During the subsequent transfer of
memory content the error is triggered (often, but not always):

[I interrupt the running code in gdb with Ctrl+C}
Program received signal SIGINT, Interrupt.
Sending packet: $m80015e,2#2e...Ack
Packet received: 0030
Sending packet: $m50,10#5f...Ack
Saw new packet start in middle of old one
Timed out.
Timed out.
DELAY_MS (Ignoring packet error, continuing...
../../src/gdb/target.c:1376: internal-error: target_xfer_partial: Assertion `*xfered_len > 0'
A problem internal to GDB has been detected,
further debugging may prove unreliable.
this debugging session? (y or n)

The corresponding traffic from the gdbserver RSP log:
19:08:04.421  Ctrl+C received
19:08:04.533  <-
19:08:04.534  -> m72,a
19:08:04.548  <- $8115910531F0AFECB7E0#75
19:08:04.577  -> qL1160000000000000000
19:08:04.577  <- $qM0010000000000000000#4F
19:08:04.621  -> m80015e,2
19:08:04.628  <- $0030#C3
19:08:04.665  -> m50,10
19:08:04.677  <- $0ED0BC9A18BA20E126BB8AEF912D09D0#59

I don't see any response errors or overlapping replies on the server side...

I get this error both on avr-gdb 7.10.1 (Installed by Linux Mint) and gdb 8.0 (which I compiled
from source).  I don't see this error if I don't load the file with debug info into gdb. Also no
error if I use gdb 7.0.1 or 6.6 (both also compiled by me).

Any hints or ideas of where or what the problem may be?


More information about the Gdb mailing list