---
mcdstub/mcdstub.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/mcdstub/mcdstub.c b/mcdstub/mcdstub.c
index 56854c4c76..cd2f5db8e4 100644
--- a/mcdstub/mcdstub.c
+++ b/mcdstub/mcdstub.c
@@ -1466,3 +1466,32 @@ void handle_query_regs_c(GArray *params, void *user_ctx)
TCP_ARGUMENT_OPCODE, my_register.opcode);
mcd_put_strbuf();
}
+
+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;
+ }
+}
--
2.34.1