[binutils-gdb] Fix remote 'g' command error handling (PR remote/9665)

sergiodj+buildbot@sergiodj.net sergiodj+buildbot@sergiodj.net
Thu Apr 26 23:25:00 GMT 2018


*** TEST RESULTS FOR COMMIT b75abf5bb636869fd893ecf98414b8b2fe0d4a12 ***

Author: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Branch: master
Commit: b75abf5bb636869fd893ecf98414b8b2fe0d4a12

Fix remote 'g' command error handling (PR remote/9665)

'g' command returns hex-string as response so simply checking for 'E'
to determine if it failed is not enough and can trigger spurious error
messages.  For example, invalid behaviour can be easily triggered on
Cortex-M as follows:

  (gdb) set $r0 = 0xe0
  Sending packet: $P0=e0000000#72...Packet received: OK
  Packet P (set-register) is supported
  Sending packet: $g#67...Packet received: E0000000849A0020...
  Remote failure reply: E0000000849A0020...

This patch fixes the problem by calling putpkt()/getpkt() directly and
checking result with packet_check_result().  This works fine since Enn
response has odd number of bytes while proper response has even number
of bytes.

Also, remote_send() is now not used anywhere so it can be removed.

gdb/Changelog:
2018-04-26  Andrzej Kaczmarek  <andrzej.kaczmarek@codecoup.pl>

	PR remote/9665
	* remote.c (send_g_packet): Use putpkt/getpkt/packet_check_result
	instead of remote_send.
	(remote_send): Remove.



More information about the Gdb-testers mailing list