diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2023-03-02 18:57:46 -0800 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2023-03-07 17:06:41 +0000 |
commit | b6fa2ec238e48d0bfba618011ec154867e386587 (patch) | |
tree | 9c7911014d8330ca448732b2d843fcf0567ba871 /gdbstub/internals.h | |
parent | 36e067b2f28892afd91d319b89350d4753ef82af (diff) | |
download | qemu-b6fa2ec238e48d0bfba618011ec154867e386587.zip qemu-b6fa2ec238e48d0bfba618011ec154867e386587.tar.gz qemu-b6fa2ec238e48d0bfba618011ec154867e386587.tar.bz2 |
gdbstub: move chunk of softmmu functionality to own file
This is mostly code motion but a number of things needed to be done
for this minimal patch set:
- move shared structures to internals.h
- splitting some functions into user and softmmu versions
- fixing a few casting issues to keep softmmu common
More CONFIG_USER_ONLY stuff will be handled in a following patches.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230302190846.2593720-11-alex.bennee@linaro.org>
Message-Id: <20230303025805.625589-11-richard.henderson@linaro.org>
Diffstat (limited to 'gdbstub/internals.h')
-rw-r--r-- | gdbstub/internals.h | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/gdbstub/internals.h b/gdbstub/internals.h index cf76627..83989af 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -17,6 +17,18 @@ * Shared structures and definitions */ +enum { + GDB_SIGNAL_0 = 0, + GDB_SIGNAL_INT = 2, + GDB_SIGNAL_QUIT = 3, + GDB_SIGNAL_TRAP = 5, + GDB_SIGNAL_ABRT = 6, + GDB_SIGNAL_ALRM = 14, + GDB_SIGNAL_IO = 23, + GDB_SIGNAL_XCPU = 24, + GDB_SIGNAL_UNKNOWN = 143 +}; + typedef struct GDBProcess { uint32_t pid; bool attached; @@ -57,6 +69,8 @@ typedef struct GDBState { int supported_sstep_flags; } GDBState; +/* lives in main gdbstub.c */ +extern GDBState gdbserver_state; /* * Inline utility function, convert from int to hex and back @@ -101,7 +115,6 @@ CPUState *gdb_first_attached_cpu(void); void gdb_append_thread_id(CPUState *cpu, GString *buf); int gdb_get_cpu_index(CPUState *cpu); -void gdb_init_gdbserver_state(void); void gdb_create_default_process(GDBState *s); /* @@ -110,6 +123,34 @@ void gdb_create_default_process(GDBState *s); void gdb_put_buffer(const uint8_t *buf, int len); /* + * Command handlers - either softmmu or user only + */ +void gdb_init_gdbserver_state(void); + +typedef enum GDBThreadIdKind { + GDB_ONE_THREAD = 0, + GDB_ALL_THREADS, /* One process, all threads */ + GDB_ALL_PROCESSES, + GDB_READ_THREAD_ERR +} GDBThreadIdKind; + +typedef union GdbCmdVariant { + const char *data; + uint8_t opcode; + unsigned long val_ul; + unsigned long long val_ull; + struct { + GDBThreadIdKind kind; + uint32_t pid; + uint32_t tid; + } thread_id; +} GdbCmdVariant; + +#define get_param(p, i) (&g_array_index(p, GdbCmdVariant, i)) + +void gdb_handle_query_rcmd(GArray *params, void *user_ctx); /* softmmu */ + +/* * Break/Watch point support - there is an implementation for softmmu * and user mode. */ |