Skip to content

Commit

Permalink
Handle error response in read32At: and readAt:nBytes:
Browse files Browse the repository at this point in the history
This addresses shingarov#1.
  • Loading branch information
janvrany committed Jun 30, 2023
1 parent d09c414 commit 8784429
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/GDB/RemoteGDB.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ RemoteGDB >> read32At: addr [
answer := rsp q: 'm',
addr printStringHex,
',4'.
(answer size = 3 and:[answer first == $E]) ifTrue:[
self error:'Failed to read 4 bytes at 0x', addr printStringHex.
^nil.
].
answer := Integer readFrom: answer radix: 16.
processorDescription endian ifLittle: [ answer := answer byteSwap32 ].
^answer
Expand All @@ -133,6 +137,10 @@ RemoteGDB >> readAt: addr nBytes: n [
addr printStringHex,
',',
n printStringHex.
(answer size = 3 and:[answer first == $E]) ifTrue:[
self error:'Failed to read ',n printString,' bytes at 0x', addr printStringHex.
^nil.
].
stream := ReadStream on: answer
from: 1
to: answer size.
Expand Down

0 comments on commit 8784429

Please sign in to comment.