target/i386: validate VEX prefixes via the instructions' exception classes
[qemu.git] / gdbstub / user.c
blob033e5fdd71f701d31f77e16301a49457be0f1b5b
1 /*
2 * gdbstub user-mode helper routines.
4 * We know for user-mode we are using TCG so we can call stuff directly.
6 * Copyright (c) 2022 Linaro Ltd
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #include "qemu/osdep.h"
12 #include "exec/hwaddr.h"
13 #include "exec/gdbstub.h"
14 #include "hw/core/cpu.h"
15 #include "internals.h"
17 bool gdb_supports_guest_debug(void)
19 /* user-mode == TCG == supported */
20 return true;
23 int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len)
25 CPUState *cpu;
26 int err = 0;
28 switch (type) {
29 case GDB_BREAKPOINT_SW:
30 case GDB_BREAKPOINT_HW:
31 CPU_FOREACH(cpu) {
32 err = cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL);
33 if (err) {
34 break;
37 return err;
38 default:
39 /* user-mode doesn't support watchpoints */
40 return -ENOSYS;
44 int gdb_breakpoint_remove(CPUState *cs, int type, hwaddr addr, hwaddr len)
46 CPUState *cpu;
47 int err = 0;
49 switch (type) {
50 case GDB_BREAKPOINT_SW:
51 case GDB_BREAKPOINT_HW:
52 CPU_FOREACH(cpu) {
53 err = cpu_breakpoint_remove(cpu, addr, BP_GDB);
54 if (err) {
55 break;
58 return err;
59 default:
60 /* user-mode doesn't support watchpoints */
61 return -ENOSYS;
65 void gdb_breakpoint_remove_all(CPUState *cs)
67 cpu_breakpoint_remove_all(cs, BP_GDB);