i386/xen: implement HYPERVISOR_vcpu_op
[qemu/kevin.git] / gdbstub / user.c
blob484bd8f4617d97c9f2ed6cfe0ecff219e99ca2cf
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/gdbstub.h"
13 #include "hw/core/cpu.h"
14 #include "internals.h"
16 bool gdb_supports_guest_debug(void)
18 /* user-mode == TCG == supported */
19 return true;
22 int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len)
24 CPUState *cpu;
25 int err = 0;
27 switch (type) {
28 case GDB_BREAKPOINT_SW:
29 case GDB_BREAKPOINT_HW:
30 CPU_FOREACH(cpu) {
31 err = cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL);
32 if (err) {
33 break;
36 return err;
37 default:
38 /* user-mode doesn't support watchpoints */
39 return -ENOSYS;
43 int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len)
45 CPUState *cpu;
46 int err = 0;
48 switch (type) {
49 case GDB_BREAKPOINT_SW:
50 case GDB_BREAKPOINT_HW:
51 CPU_FOREACH(cpu) {
52 err = cpu_breakpoint_remove(cpu, addr, BP_GDB);
53 if (err) {
54 break;
57 return err;
58 default:
59 /* user-mode doesn't support watchpoints */
60 return -ENOSYS;
64 void gdb_breakpoint_remove_all(CPUState *cs)
66 cpu_breakpoint_remove_all(cs, BP_GDB);