[all-commits] [llvm/llvm-project] 304c68: [lldb] Step over non-lldb breakpoints (#174348)
Duncan McBain via All-commits
all-commits at lists.llvm.org
Wed Feb 11 02:19:03 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 304c680809f05923edd097835d1056e6460a3646
https://github.com/llvm/llvm-project/commit/304c680809f05923edd097835d1056e6460a3646
Author: Duncan McBain <git at mail.duncanmcba.in>
Date: 2026-02-11 (Wed, 11 Feb 2026)
Changed paths:
M lldb/include/lldb/Core/Architecture.h
M lldb/include/lldb/Target/Platform.h
M lldb/include/lldb/Target/StopInfo.h
M lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp
M lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h
M lldb/source/Plugins/Architecture/Arm/ArchitectureArm.cpp
M lldb/source/Plugins/Architecture/Arm/ArchitectureArm.h
M lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
M lldb/source/Plugins/Architecture/Mips/ArchitectureMips.h
M lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
M lldb/source/Plugins/Process/Utility/StopInfoMachException.h
M lldb/source/Target/Platform.cpp
M lldb/source/Target/StopInfo.cpp
A lldb/test/API/functionalities/builtin-debugtrap/Makefile
A lldb/test/API/functionalities/builtin-debugtrap/TestBuiltinDebugTrap.py
A lldb/test/API/functionalities/builtin-debugtrap/main.c
R lldb/test/API/macosx/builtin-debugtrap/Makefile
R lldb/test/API/macosx/builtin-debugtrap/TestBuiltinDebugTrap.py
R lldb/test/API/macosx/builtin-debugtrap/main.cpp
Log Message:
-----------
[lldb] Step over non-lldb breakpoints (#174348)
Several languages support some sort of "breakpoint" function, which adds
ISA-specific instructions to generate an interrupt at runtime. However,
on some platforms, these instructions don't increment the program
counter. When LLDB sets these instructions it isn't a problem, as we
remove them before continuing, then re-add them after stepping over the
location. However, for breakpoint sequences that are part of the
inferior process, this doesn't happen - and so users might be left
unable to continue past the breakpoint without manually interfering with
the program counter.
This patch adds logic to LLDB to intercept SIGTRAPs, inspect the bytes
of the inferior at the program counter, and if the instruction looks
like a BRK or BKPT or similar, increment the pc by the size of the
instruction we found. This unifies platform behaviour (e.g. on x86_64,
LLDB debug sessions already look like this) and improves UX (in my
opinion, but I think it beats messing with stuff every break).
Some ISAs (like AArch64) require slightly different handling, as while
there are multiple possible instructions, we should be careful only to
find the ones likely to have been emitted by a compiler backend, and not
those inserted from (for example) the UB sanitizer, or any others.
There is an existing builtin-debugtrap test which was under the macos
folder before. I've now moved that to "functionalities", made it pure C
only, and updated it a little bit so that it works regardless of
platform.
What I've not done is change the existing code in debugserver which was
added by Jason Molenda about five years ago
(https://reviews.llvm.org/D91238, 92b036d). It might not be required any
more after this change. Reading the history there, it seems like it was
agreed that this behaviour (skipping over unknown bps) was the desired
end goal.
Fixes #56268
---------
Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list