[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/7] gdbstub: add support for the qRegisterInfo query
From: |
Matheus Tavares Bernardino |
Subject: |
[PATCH 3/7] gdbstub: add support for the qRegisterInfo query |
Date: |
Thu, 6 Apr 2023 16:29:45 -0300 |
From: Brian Cain <bcain@quicinc.com>
Signed-off-by: Brian Cain <bcain@quicinc.com>
Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
---
include/hw/core/cpu.h | 4 ++++
gdbstub/gdbstub.c | 27 +++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 821e937020..b16b4e0de5 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -124,6 +124,8 @@ struct SysemuCPUOps;
* its Harvard architecture split code and data.
* @gdb_num_core_regs: Number of core registers accessible to GDB.
* @gdb_core_xml_file: File name for core registers GDB XML description.
+ * @gdb_qreg_info_lines: Array of lines of registers qRegisterInfo description.
+ * @gdb_qreg_info_line_count: Count of lines for @gdb_qreg_info_lines.
* @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
* before the insn which triggers a watchpoint rather than after it.
* @gdb_arch_name: Optional callback that returns the architecture name known
@@ -159,6 +161,8 @@ struct CPUClass {
vaddr (*gdb_adjust_breakpoint)(CPUState *cpu, vaddr addr);
const char *gdb_core_xml_file;
+ const char **gdb_qreg_info_lines;
+ int gdb_qreg_info_line_count;
gchar * (*gdb_arch_name)(CPUState *cpu);
const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 9d326a1d2d..2edd7d6d88 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -1409,6 +1409,27 @@ static void handle_query_curr_tid(GArray *params, void
*user_ctx)
gdb_put_strbuf();
}
+static void handle_query_regs(GArray *params, void *user_ctx)
+{
+ if (!params->len) {
+ return;
+ }
+
+ CPUClass *cc = CPU_GET_CLASS(gdbserver_state.g_cpu);
+ if (!cc->gdb_qreg_info_lines) {
+ gdb_put_packet("");
+ return;
+ }
+
+ int reg_num = get_param(params, 0)->val_ul;
+ if (reg_num >= cc->gdb_qreg_info_line_count) {
+ gdb_put_packet("");
+ return;
+ }
+
+ gdb_put_packet(cc->gdb_qreg_info_lines[reg_num]);
+}
+
static void handle_query_threads(GArray *params, void *user_ctx)
{
if (!gdbserver_state.query_cpu) {
@@ -1578,6 +1599,12 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = {
.handler = handle_query_curr_tid,
.cmd = "C",
},
+ {
+ .handler = handle_query_regs,
+ .cmd = "RegisterInfo",
+ .cmd_startswith = 1,
+ .schema = "l0"
+ },
{
.handler = handle_query_threads,
.cmd = "sThreadInfo",
--
2.39.1
- [PATCH 0/7] Hexagon: add lldb support, Matheus Tavares Bernardino, 2023/04/06
- [PATCH 1/7] gdbstub: only send stop-reply packets when allowed to, Matheus Tavares Bernardino, 2023/04/06
- [PATCH 2/7] gdbstub: add test for untimely stop-reply packets, Matheus Tavares Bernardino, 2023/04/06
- [PATCH 3/7] gdbstub: add support for the qRegisterInfo query,
Matheus Tavares Bernardino <=
- [PATCH 6/7] Hexagon (gdbstub): add HVX support, Matheus Tavares Bernardino, 2023/04/06
- [PATCH 7/7] Hexagon (linux-user/hexagon): handle breakpoints, Matheus Tavares Bernardino, 2023/04/06
- [PATCH 5/7] Hexagon (gdbstub): fix p3:0 read and write via stub, Matheus Tavares Bernardino, 2023/04/06
- [PATCH 4/7] Hexagon: support qRegisterInfo at gdbstub, Matheus Tavares Bernardino, 2023/04/06