From bb24fd9108d6dac7e910eb081e675d439db7b064 Mon Sep 17 00:00:00 2001 From: anjiahao Date: Tue, 30 Jul 2024 20:50:21 +0800 Subject: [PATCH] minidumpserver.py:support gdb can set register Signed-off-by: anjiahao --- tools/minidumpserver.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/minidumpserver.py b/tools/minidumpserver.py index e2c404c4b9..9e86cad204 100755 --- a/tools/minidumpserver.py +++ b/tools/minidumpserver.py @@ -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,