On 6/30/26 10:15, Shivang Upadhyay wrote:
check_for_breakpoints_slow() currently performs a linear scan of
cpu->breakpoints on every breakpoint check. As the number of
breakpoints grows, this increases the cost of each lookup.
Replace cpu->breakpoints with a GTree to provide efficient lookups by
address.
Additionally, maintain a second GTree, cpu->page_breakpoints, containing
the guest page numbers of all installed breakpoints. This detaches, pc
lookup and page lookup, into 2 different Gtrees.
Both trees are kept in sync when breakpoints are inserted or removed.
Signed-off-by: Shivang Upadhyay<[email protected]>
---
accel/tcg/cpu-exec.c | 26 +++++----
cpu-common.c | 108 +++++++++++++++++++++++++++++++-------
hw/core/cpu-common.c | 1 -
include/exec/breakpoint.h | 1 -
include/hw/core/cpu.h | 14 ++---
linux-user/main.c | 13 +++--
6 files changed, 118 insertions(+), 45 deletions(-)
I think it would be better to use IntervalTree, so that we don't have to keep that second
tree of pages. Obviously, IntervalTree can query an interval, which takes care of
querying for entries within a page.
r~