[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 15/17] mcdstub: skeleton for reset handling added
From: |
Nicolas Eder |
Subject: |
[PATCH v4 15/17] mcdstub: skeleton for reset handling added |
Date: |
Thu, 7 Dec 2023 22:03:56 +0100 |
---
debug/mcdstub/mcdstub.c | 46 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/debug/mcdstub/mcdstub.c b/debug/mcdstub/mcdstub.c
index 794e7d1312..cc1587396d 100644
--- a/debug/mcdstub/mcdstub.c
+++ b/debug/mcdstub/mcdstub.c
@@ -826,6 +826,37 @@ static void handle_vm_stop(GArray *params, void *user_ctx)
mcd_vm_stop();
}
+/**
+ * mcd_exit() - Terminates QEMU.
+ *
+ * If the mcdserver_state has not been initialized the function exits before
+ * terminating QEMU. Terminting is done with the qemu_chr_fe_deinit function.
+ * @code: An exitcode, which can be used in the future.
+ */
+static void mcd_exit(int code)
+{
+ /* terminate qemu */
+ if (!mcdserver_state.init) {
+ return;
+ }
+
+ qemu_chr_fe_deinit(&mcdserver_system_state.chr, true);
+}
+
+/**
+ * handle_reset() - Handler for performing resets.
+ *
+ * This function is currently not in use.
+ * @params: GArray with all TCP packet parameters.
+ */
+static void handle_reset(GArray *params, void *user_ctx)
+{
+ /*
+ * int reset_id = get_param(params, 0)->data_int;
+ * TODO: implement resets
+ */
+}
+
/**
* mcd_handle_packet() - Evaluates the type of received packet and chooses the
* correct handler.
@@ -927,6 +958,21 @@ static int mcd_handle_packet(const char *line_buf)
cmd_parser = &break_cmd_desc;
}
break;
+ case TCP_CHAR_KILLQEMU:
+ /* kill qemu completely */
+ error_report("QEMU: Terminated via MCDstub");
+ mcd_exit(0);
+ exit(0);
+ case TCP_CHAR_RESET:
+ {
+ static MCDCmdParseEntry reset_cmd_desc = {
+ .handler = handle_reset,
+ };
+ reset_cmd_desc.cmd = (char[2]) { TCP_CHAR_RESET, '\0' };
+ strcpy(reset_cmd_desc.schema, (char[2]) { ARG_SCHEMA_INT, '\0' });
+ cmd_parser = &reset_cmd_desc;
+ }
+ break;
default:
/* command not supported */
mcd_put_packet("");
--
2.34.1
- [PATCH v4 03/17] gdbstub: GDBRegisterState moved to gdbstub.h so it can be used outside of the gdbstub, (continued)
- [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, 2023/12/07
- [PATCH v4 15/17] mcdstub: skeleton for reset handling added,
Nicolas Eder <=
- [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