@samitouri / QOSamiQemu / commits / af97fe2eaf

gdbstub: Introduce GdbBreakpointType enumerator

Introduce the GdbBreakpointType enumerator to better follow code related to GDB protocol handling. Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260705215729.62196-25-philmd@oss.qualcomm.com>

Philippe Mathieu-Daudé committed Jun 26, 2026 at 17:30 UTC af97fe2eafe4acebf13bdcb64de32d67a2e5a237
4 files changed +20 -11
gdbstub/internals.h
+5 -2
@@ -11,6 +11,7 @@
11
12 #include "qemu/accel.h"
13 #include "exec/cpu-common.h"
14 +#include "gdbstub/enums.h"
15
16 /*
17 * Most "large" transfers (e.g. memory reads, feature XML
@@ -217,8 +218,10 @@ void gdb_syscall_handling(const char *syscall_packet);
218 * Break/Watch point support - there is an implementation for system
219 * and user mode.
220 */
220 -int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len);
221 -int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len);
221 +int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
222 + vaddr addr, vaddr len);
223 +int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
224 + vaddr addr, vaddr len);
225 void gdb_breakpoint_remove_all(CPUState *cs);
226
227 /**
gdbstub/system.c
+4 -2
@@ -623,7 +623,8 @@ int gdb_signal_to_target(int sig)
623 * Break/Watch point helpers
624 */
625
626 -int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
626 +int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
627 + vaddr addr, vaddr len)
628 {
629 const AccelOpsClass *ops = cpus_get_accel();
630 if (ops->insert_breakpoint) {
@@ -632,7 +633,8 @@ int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
633 return -ENOSYS;
634 }
635
635 -int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len)
636 +int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
637 + vaddr addr, vaddr len)
638 {
639 const AccelOpsClass *ops = cpus_get_accel();
640 if (ops->remove_breakpoint) {
gdbstub/user.c
+4 -2
@@ -790,7 +790,8 @@ unsigned int gdb_get_max_cpus(void)
790 * Break/Watch point helpers
791 */
792
793 -int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
793 +int gdb_breakpoint_insert(CPUState *cs, GdbBreakpointType type,
794 + vaddr addr, vaddr len)
795 {
796 CPUState *cpu;
797 int err = 0;
@@ -811,7 +812,8 @@ int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
812 }
813 }
814
814 -int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len)
815 +int gdb_breakpoint_remove(CPUState *cs, GdbBreakpointType type,
816 + vaddr addr, vaddr len)
817 {
818 CPUState *cpu;
819 int err = 0;
include/gdbstub/enums.h
+7 -5
@@ -12,10 +12,12 @@
12 #define DEFAULT_GDBSTUB_PORT "1234"
13
14 /* GDB breakpoint/watchpoint types */
15 -#define GDB_BREAKPOINT_SW 0
16 -#define GDB_BREAKPOINT_HW 1
17 -#define GDB_WATCHPOINT_WRITE 2
18 -#define GDB_WATCHPOINT_READ 3
19 -#define GDB_WATCHPOINT_ACCESS 4
15 +typedef enum GdbBreakpointType {
16 + GDB_BREAKPOINT_SW = 0,
17 + GDB_BREAKPOINT_HW = 1,
18 + GDB_WATCHPOINT_WRITE = 2,
19 + GDB_WATCHPOINT_READ = 3,
20 + GDB_WATCHPOINT_ACCESS = 4,
21 +} GdbBreakpointType;
22
23 #endif /* GDBSTUB_ENUMS_H */