From 836715a2d61fce2b4bd48325a5b5f6454acc95c4 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Mon, 11 Mar 2024 17:31:46 +0800 Subject: [PATCH] tools/minidumpserver.py: support quit with gdb This patch supports quiting of minidumpserver along with gdb so that to reduce usage efforts. Signed-off-by: Yanfeng Liu --- tools/minidumpserver.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/minidumpserver.py b/tools/minidumpserver.py index 9196bc618d..b796e4637b 100755 --- a/tools/minidumpserver.py +++ b/tools/minidumpserver.py @@ -587,6 +587,11 @@ class GDBStub: def handle_general_query_packet(self, pkt): self.put_gdb_packet(b"") + def handle_vkill_packet(self, pkt): + self.put_gdb_packet(b"OK") + logger.debug("quit with gdb") + sys.exit(0) + def run(self, socket: socket.socket): self.socket = socket @@ -618,9 +623,9 @@ class GDBStub: self.handle_memory_write_packet(pkt) elif pkt_type == b"q": self.handle_general_query_packet(pkt) - elif pkt_type == b"k": + elif pkt.startswith(b"vKill") or pkt_type == b"k": # GDB quits - break + self.handle_vkill_packet(pkt) else: self.put_gdb_packet(b"")