Beyond using interval-tree for breakpoints:
- Pass the matching breakpoint to the target debug hook,
- Allow the target to record an id/index for each BP or WP
so that the target doesn't have to search for which item
triggered, so that the target doesn't have to search again.
- Convert both BP and WP to IntervalTree.
- Merge CPUBreakpoint and CPUWatchpoint.
- Clean up tcg_ops->debug_excp_hander implementations.
On the to-do list:
- Handle ARMv6 BE-32 within debug_check_watchpoint,
which will allow dropping adjust_watchpoint_address.
- Change cpu_watchpoint_insert from addr+len to first+last.
This will allow the entire address space to be covered with
a single call (existing workaround in s390x; also possible with
unimplemented Arm not-matched address trigger).
- Breakpoint ranges, for Arm FEAT_BWE.
r~
Philippe Mathieu-Daudé (4):
cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h'
cpu: Define BreakpointFlags type
target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint()
accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers
Richard Henderson (42):
cpu: Move cpu_breakpoint_test out of line
exec/breakpoint: Move BP declarations from hw/core/cpu.h
exec/breakpoint: Merge watchpoint.h
qemu/typedefs: Declare CPUBreakpoint and CPUWatchpoint globally
hw/core/cpu: Remove exec/breakpoint.h include
exec/breakpoint: Add CPUBreakpoint.id
exec/watchpoint: Add CPUWatchpoint.id
accel/tcg: Pass CPUBreakpoint to debug_check_breakpoint
target/arm: Split is_wp out of bp_wp_matches
target/arm: Use bp argument in arm_debug_check_breakpoint
target/arm: Use wp argument in arm_debug_check_watchpoint
target/riscv: Use bp argument in riscv_cpu_debug_check_breakpoint
target/riscv: Use bp argument in riscv_cpu_debug_check_watchpoint
target/xtensa: Use bp argument in xtensa_debug_check_breakpoint
cpu: Use interval-tree for CPUBreakpoint
target/arm: Make check_watchpoint_in_range static
gdbstub: Report actual watchpoint trigger address
cpu: Use interval-tree for CPUWatchpoint
exec/breakpoint: Return the new bp from cpu_breakpoint_insert
system: Remove cpu_watchpoint_insert error return path
exec/breakpoint: Return the new wp from cpu_watchpoint_insert
system: Validate flags in cpu_watchpoint_insert
cpu-common: Validate flags in cpu_breakpoint_insert
exec/breakpoint: Add CPUWatchpoint.hitlast
exec/breakpoint: Merge CPUBreakpoint and CPUWatchpoint
accel/tcg: Pass watchpoint hit to debug_excp_handler
accel/tcg: Pass breakpoint hit to debug_excp_handler
target/arm: Use CPUBreakpoint arg in arm_debug_excp_handler
target/i386: Pass wp_hit to check_hw_breakpoints
target/i386: Use CPUBreakpoint arg in breakpoint_handler
target/ppc: Use CPUBreakpoint arg in breakpoint_handler
target/ppc: Simplify ppc_cpu_debug_check_breakpoint
target/ppc: Simplify ppc_cpu_debug_check_watchpoint
target/s390x: Use CPUBreakpoint arg in breakpoint_handler
target/riscv: Simplify riscv_cpu_debug_excp_handler
target/riscv: Set badaddr in riscv_cpu_debug_excp_handler
target/riscv: Merge riscv_cpu_debug_check_{break,watch}point
target/xtensa: Restrict xtensa_breakpoint_handler to system mode
target/xtensa: Rename xtensa_breakpoint_handler
target/xtensa: Simplify xtensa_cpu_debug_excp_handler
accel/tcg: Clear BP_WATCHPOINT_HIT after use
accel/tcg: Merge CPUState.{break,watch}point_hit
include/accel/tcg/cpu-ops.h | 17 +--
include/exec/breakpoint.h | 47 ++++++--
include/exec/watchpoint.h | 18 ---
include/hw/core/cpu.h | 46 +-------
include/qemu/typedefs.h | 1 +
target/arm/cpu.h | 4 +-
target/arm/internals.h | 13 +--
target/i386/cpu.h | 4 +-
target/i386/tcg/helper-tcg.h | 4 +-
target/ppc/cpu.h | 4 +-
target/ppc/internal.h | 6 +-
target/riscv/cpu.h | 4 +-
target/riscv/debug.h | 5 +-
target/s390x/tcg/tcg_s390x.h | 2 +-
target/xtensa/cpu.h | 8 +-
accel/tcg/cpu-exec.c | 76 +++++++------
accel/tcg/cputlb.c | 12 +-
accel/tcg/tcg-accel-ops.c | 34 +++---
accel/tcg/user-exec-stub.c | 19 ++--
accel/tcg/watchpoint.c | 166 ++++++++++++++++------------
accel/whpx/whpx-common.c | 9 +-
cpu-common.c | 69 +++++++-----
gdbstub/system.c | 50 +++++----
gdbstub/user.c | 9 +-
hw/core/cpu-common.c | 2 -
linux-user/main.c | 14 ++-
system/watchpoint.c | 73 ++++++------
target/arm/debug_helper.c | 2 +-
target/arm/hvf/hvf.c | 6 +-
target/arm/hyp_gdbstub.c | 7 +-
target/arm/kvm.c | 5 +-
target/arm/tcg/debug.c | 120 +++++---------------
target/arm/tcg/mte_helper.c | 3 +-
target/i386/cpu.c | 2 +-
target/i386/kvm/kvm.c | 11 +-
target/i386/machine.c | 2 +-
target/i386/tcg/bpt_helper.c | 2 +-
target/i386/tcg/system/bpt_helper.c | 81 ++++++--------
target/i386/tcg/tcg-cpu.c | 2 +-
target/i386/whpx/whpx-all.c | 15 +--
target/ppc/cpu.c | 9 +-
target/ppc/cpu_init.c | 2 +-
target/ppc/kvm.c | 14 ++-
target/ppc/tcg-excp_helper.c | 85 ++++++--------
target/riscv/cpu_helper.c | 6 +-
target/riscv/debug.c | 159 ++++----------------------
target/riscv/tcg/tcg-cpu.c | 4 +-
target/s390x/helper.c | 1 -
target/s390x/kvm/kvm.c | 7 +-
target/s390x/tcg/debug.c | 22 ++--
target/xtensa/cpu.c | 2 +-
target/xtensa/dbg_helper.c | 31 ++----
target/xtensa/helper.c | 46 +++-----
53 files changed, 568 insertions(+), 794 deletions(-)
delete mode 100644 include/exec/watchpoint.h
--
2.43.0