summaryrefslogtreecommitdiff
path: root/sim/gdbstub.py
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-12-06 15:27:42 -0600
committerAlejandro Soto <alejandro@34project.org>2022-12-06 15:27:42 -0600
commitb1761b8eac5777c09723bbc8cd31cc05d8ec35ae (patch)
treea7a50591a1b5f9d7e26a7f6797a97d9ac213879a /sim/gdbstub.py
parent064b72ae4eb22336438288a9664a37c0dd07f4bc (diff)
Implement breakpoints
Diffstat (limited to '')
-rw-r--r--sim/gdbstub.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/sim/gdbstub.py b/sim/gdbstub.py
index b262971..e214a73 100644
--- a/sim/gdbstub.py
+++ b/sim/gdbstub.py
@@ -50,14 +50,14 @@ def halt():
client.send(b'+')
- if data[0] == b'?'[0]:
+ if data == b'?':
out = b'S05'
elif data[0] == b'c'[0]:
assert not data[1:] #TODO
break
- elif data[0] == b'D'[0]:
+ elif data == b'D':
out = b'OK'
- elif data[0] == b'g'[0]:
+ elif data == b'g':
out = hexout(read_reg(gdb_reg(r)) for r in range(16))
elif data[0] == b'm'[0]:
addr, length = (int(x, 16) for x in data[1:].split(b','))
@@ -128,7 +128,6 @@ def hexout(data, size=4):
elif type(data) is bytes:
return data.hex().encode('ascii')
elif type(data) is int:
- data = [data]
-
- return b''.join(hex(d)[2:].zfill(2 * size)[:2 * size].encode('ascii') for d in data)
+ return data.to_bytes(size, 'little').hex().encode('ascii')
+ return b''.join(hexout(d) for d in data)