[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 14/17] mcdstub: state query added
From: |
Nicolas Eder |
Subject: |
[PATCH v4 14/17] mcdstub: state query added |
Date: |
Thu, 7 Dec 2023 22:03:55 +0100 |
---
debug/mcdstub/mcdstub.c | 44 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/debug/mcdstub/mcdstub.c b/debug/mcdstub/mcdstub.c
index 83582f7fa5..794e7d1312 100644
--- a/debug/mcdstub/mcdstub.c
+++ b/debug/mcdstub/mcdstub.c
@@ -1412,6 +1412,43 @@ static void handle_query_regs_c(GArray *params, void
*user_ctx)
mcd_put_strbuf();
}
+/**
+ * handle_query_state() - Handler for the state query.
+ *
+ * This function collects all data stored in the
+ * cpu_state member of the mcdserver_state and formats and sends it to the
+ * library.
+ * @params: GArray with all TCP packet parameters.
+ */
+static void handle_query_state(GArray *params, void *user_ctx)
+{
+ /*
+ * TODO: multicore support
+ * get state info
+ */
+ mcd_cpu_state_st state_info = mcdserver_state.cpu_state;
+ /* TODO: add event information */
+ uint32_t event = 0;
+ /* send data */
+ g_string_printf(mcdserver_state.str_buf,
+ "%s=%s.%s=%u.%s=%u.%s=%u.%s=%lu.%s=%s.%s=%s.",
+ TCP_ARGUMENT_STATE, state_info.state,
+ TCP_ARGUMENT_EVENT, event, TCP_ARGUMENT_THREAD, 0,
+ TCP_ARGUMENT_TYPE, state_info.bp_type,
+ TCP_ARGUMENT_ADDRESS, state_info.bp_address,
+ TCP_ARGUMENT_STOP_STRING, state_info.stop_str,
+ TCP_ARGUMENT_INFO_STRING, state_info.info_str);
+ mcd_put_strbuf();
+
+ /* reset debug info after first query */
+ if (strcmp(state_info.state, CORE_STATE_DEBUG) == 0) {
+ mcdserver_state.cpu_state.stop_str = "";
+ mcdserver_state.cpu_state.info_str = "";
+ mcdserver_state.cpu_state.bp_type = 0;
+ mcdserver_state.cpu_state.bp_address = 0;
+ }
+}
+
/**
* init_query_cmds_table() - Initializes all query functions.
*
@@ -1507,6 +1544,13 @@ static void init_query_cmds_table(MCDCmdParseEntry
*mcd_query_cmds_table)
strcpy(query_regs_c.schema, (char[2]) { ARG_SCHEMA_QRYHANDLE, '\0' });
mcd_query_cmds_table[cmd_number] = query_regs_c;
cmd_number++;
+
+ MCDCmdParseEntry query_state = {
+ .handler = handle_query_state,
+ .cmd = QUERY_ARG_STATE,
+ };
+ strcpy(query_state.schema, (char[2]) { ARG_SCHEMA_CORENUM, '\0' });
+ mcd_query_cmds_table[cmd_number] = query_state;
}
/**
--
2.34.1
- [PATCH v4 01/17] gdbstub, mcdstub: file and build structure adapted to accomodate for the mcdstub, (continued)
- [PATCH v4 01/17] gdbstub, mcdstub: file and build structure adapted to accomodate for the mcdstub, Nicolas Eder, 2023/12/07
- [PATCH v4 03/17] gdbstub: GDBRegisterState moved to gdbstub.h so it can be used outside of the gdbstub, Nicolas Eder, 2023/12/07
- [PATCH v4 04/17] gdbstub: DebugClass added to system mode., Nicolas Eder, 2023/12/07
- [PATCH v4 05/17] mcdstub: memory helper functions added, Nicolas Eder, 2023/12/07
- [PATCH v4 12/17] mcdstub: all core specific queries added, Nicolas Eder, 2023/12/07
- [PATCH v4 06/17] mcdstub: -mcd start option added, mcd specific defines added, Nicolas Eder, 2023/12/07
- [PATCH v4 07/17] mcdstub: mcdserver initialization functions added, Nicolas Eder, 2023/12/07
- [PATCH v4 16/17] mcdstub: register access added, Nicolas Eder, 2023/12/07
- [PATCH v4 08/17] cutils: qemu_strtou32 function added, Nicolas Eder, 2023/12/07
- [PATCH v4 13/17] mcdstub: go, step and break added, Nicolas Eder, 2023/12/07
- [PATCH v4 14/17] mcdstub: state query added,
Nicolas Eder <=
- [PATCH v4 15/17] mcdstub: skeleton for reset handling added, Nicolas Eder, 2023/12/07
- [PATCH v4 11/17] mcdstub: system and core queries added, Nicolas Eder, 2023/12/07
- [PATCH v4 09/17] mcdstub: TCP packet plumbing added, Nicolas Eder, 2023/12/07
- [PATCH v4 10/17] mcdstub: open and close server funcitons added, Nicolas Eder, 2023/12/07
- [PATCH v4 17/17] mcdstub: break/watchpoints added, Nicolas Eder, 2023/12/07