cvw/linux/testvector-generation/0001-bens-hack-to-turn-on-logging-mid-execution-using-GDB.patch

54 lines
1.3 KiB
Diff

From f9882bd274bde82d8c38a9c31692b6ee33d8cd9a Mon Sep 17 00:00:00 2001
From: root <root@tera.eng.hmc.edu>
Date: Mon, 28 Feb 2022 22:48:29 +0000
Subject: [PATCH] bens hack to turn on logging mid-execution using GDB
---
gdbstub.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/gdbstub.c b/gdbstub.c
index 141d7bc4ec..98ecce1b67 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2317,6 +2317,23 @@ static void handle_set_qemu_phy_mem_mode(GArray *params, void *user_ctx)
}
put_packet("OK");
}
+
+static void handle_set_qemu_logging(GArray *params, void *user_ctx)
+{
+ if (!params->len) {
+ put_packet("E22");
+ return;
+ }
+
+ int log_mask;
+ if (!get_param(params, 0)->val_ul) {
+ log_mask = 0;
+ } else {
+ log_mask = CPU_LOG_TB_IN_ASM | CPU_LOG_INT | CPU_LOG_TB_CPU | CPU_LOG_TB_NOCHAIN;
+ }
+ qemu_set_log(log_mask);
+ put_packet("OK");
+}
#endif
static const GdbCmdParseEntry gdb_gen_query_set_common_table[] = {
@@ -2430,6 +2447,12 @@ static const GdbCmdParseEntry gdb_gen_set_table[] = {
.cmd_startswith = 1,
.schema = "l0"
},
+ {
+ .handler = handle_set_qemu_logging,
+ .cmd = "qemu.Logging:",
+ .cmd_startswith = 1,
+ .schema = "l0"
+ },
#endif
};
--
2.27.0