1 /* 2 * gdb server stub - softmmu specific bits 3 * 4 * Debug integration depends on support from the individual 5 * accelerators so most of this involves calling the ops helpers. 6 * 7 * Copyright (c) 2022 Linaro Ltd 8 * 9 * SPDX-License-Identifier: GPL-2.0-or-later 10 */ 11 12 #include "qemu/osdep.h" 13 #include "exec/gdbstub.h" 14 #include "exec/hwaddr.h" 15 #include "sysemu/cpus.h" 16 #include "internals.h" 17 18 bool gdb_supports_guest_debug(void) 19 { 20 const AccelOpsClass *ops = cpus_get_accel(); 21 if (ops->supports_guest_debug) { 22 return ops->supports_guest_debug(); 23 } 24 return false; 25 } 26 27 int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len) 28 { 29 const AccelOpsClass *ops = cpus_get_accel(); 30 if (ops->insert_breakpoint) { 31 return ops->insert_breakpoint(cs, type, addr, len); 32 } 33 return -ENOSYS; 34 } 35 36 int gdb_breakpoint_remove(CPUState *cs, int type, hwaddr addr, hwaddr len) 37 { 38 const AccelOpsClass *ops = cpus_get_accel(); 39 if (ops->remove_breakpoint) { 40 return ops->remove_breakpoint(cs, type, addr, len); 41 } 42 return -ENOSYS; 43 } 44 45 void gdb_breakpoint_remove_all(CPUState *cs) 46 { 47 const AccelOpsClass *ops = cpus_get_accel(); 48 if (ops->remove_all_breakpoints) { 49 ops->remove_all_breakpoints(cs); 50 } 51 } 52