]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix gdbreplay checksum calculation
authorTom Tromey <tromey@adacore.com>
Mon, 9 Dec 2024 17:40:48 +0000 (10:40 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 11 Dec 2024 17:00:47 +0000 (10:00 -0700)
commita32d76186d24be8f23bd4c2fd20d9cf762dc3673
tree2fbbb6270c1d3e20316d54c0358ab196f4f27086
parenta5939d229614a4913daf3c687ec54fdf3020d496
Fix gdbreplay checksum calculation

I needed to use gdbreplay today.  It didn't work quite right, and
using "set debug remote 1" showed that gdb was rejecting some
responses like:

  [remote] Sending packet: $vCont?#49
  [remote] Junk: #vCont?
  [remote] Junk: 8vCont?
  [remote] Junk: 3vCont?
  [remote] Received Ack

The checksum recalculation seems to have gone wrong.  Looking at the
code, it seems like 'where_csum' is calculated inconsistently: in the
main loop it is after the '#' but in the "== 0" case it is before the
'#'.

This patch fixes the problem and also avoids a string copy.

CC: Alexandra Hájková <ahajkova@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdbserver/gdbreplay.cc