minidumpserver.py:support gdb can set register

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2024-07-30 20:50:21 +08:00 committed by Xiang Xiao
parent f3e2b532e1
commit bb24fd9108

View File

@ -567,9 +567,18 @@ class GDBStub:
def handle_register_single_write_packet(self, pkt):
# the 'P' packet for writing to registers
#
# We don't support writing so return error
self.put_gdb_packet(b"E01")
index, value = pkt[1:].split(b"=")
reg_val = 0
for i in range(0, len(value), 2):
data = value[i : i + 2]
reg_val = reg_val + (int("0x" + data.decode("utf8"), 16) << (i * 4))
reg = int("0x" + index.decode("utf8"), 16)
if reg < len(self.logfile.registers):
self.logfile.registers[reg] = reg_val
self.put_gdb_packet(b"OK")
def handle_memory_read_packet(self, pkt):
# the 'm' packet for reading memory: m<addr>,<len>