[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/18] gdbstub: Move phy_memory_mode to GDBSystemState
From: |
Ilya Leoshkevich |
Subject: |
[PATCH 02/18] gdbstub: Move phy_memory_mode to GDBSystemState |
Date: |
Mon, 23 Sep 2024 18:12:57 +0200 |
Follow the convention that all the pieces of the global stub state must
be inside a single struct.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
gdbstub/system.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gdbstub/system.c b/gdbstub/system.c
index 1ad87fe7fdf..5ce357c6c2b 100644
--- a/gdbstub/system.c
+++ b/gdbstub/system.c
@@ -35,6 +35,7 @@
typedef struct {
CharBackend chr;
Chardev *mon_chr;
+ int phy_memory_mode;
} GDBSystemState;
GDBSystemState gdbserver_system_state;
@@ -445,14 +446,12 @@ void gdb_qemu_exit(int code)
/*
* Memory access
*/
-static int phy_memory_mode;
-
int gdb_target_memory_rw_debug(CPUState *cpu, hwaddr addr,
uint8_t *buf, int len, bool is_write)
{
CPUClass *cc;
- if (phy_memory_mode) {
+ if (gdbserver_system_state.phy_memory_mode) {
if (is_write) {
cpu_physical_memory_write(addr, buf, len);
} else {
@@ -491,7 +490,8 @@ bool gdb_can_reverse(void)
void gdb_handle_query_qemu_phy_mem_mode(GArray *params,
void *ctx)
{
- g_string_printf(gdbserver_state.str_buf, "%d", phy_memory_mode);
+ g_string_printf(gdbserver_state.str_buf, "%d",
+ gdbserver_system_state.phy_memory_mode);
gdb_put_strbuf();
}
@@ -503,9 +503,9 @@ void gdb_handle_set_qemu_phy_mem_mode(GArray *params, void
*ctx)
}
if (!gdb_get_cmd_param(params, 0)->val_ul) {
- phy_memory_mode = 0;
+ gdbserver_system_state.phy_memory_mode = 0;
} else {
- phy_memory_mode = 1;
+ gdbserver_system_state.phy_memory_mode = 1;
}
gdb_put_packet("OK");
}
--
2.46.0
- [PATCH 00/18] Stop all qemu-cpu threads on a breakpoint, Ilya Leoshkevich, 2024/09/23
- [PATCH 03/18] gdbstub: Move gdb_syscall_mode to GDBSyscallState, Ilya Leoshkevich, 2024/09/23
- [PATCH 02/18] gdbstub: Move phy_memory_mode to GDBSystemState,
Ilya Leoshkevich <=
- [PATCH 04/18] gdbstub: Factor out gdb_try_stop(), Ilya Leoshkevich, 2024/09/23
- [PATCH 08/18] replay: Add replay_mutex_{lock, unlock}() stubs for qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 10/18] cpu: Use BQL in qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 16/18] cpu: Allow pausing and resuming CPUs in qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 05/18] accel/tcg: Factor out cpu_exec_user(), Ilya Leoshkevich, 2024/09/23
- [PATCH 15/18] cpu: Set current_cpu early in qemu-user, Ilya Leoshkevich, 2024/09/23
- [PATCH 14/18] cpu: Introduce cpu_is_paused(), Ilya Leoshkevich, 2024/09/23
- [PATCH 12/18] cpu: Track CPUs executing syscalls, Ilya Leoshkevich, 2024/09/23
- [PATCH 01/18] gdbstub: Make gdb_get_char() static, Ilya Leoshkevich, 2024/09/23
- [PATCH 09/18] qemu-timer: Provide qemu_clock_enable() stub for qemu-user, Ilya Leoshkevich, 2024/09/23