[all-commits] [llvm/llvm-project] 8a27ef: [lldb] Add frame recognizer for __builtin_verbose_...
Michael Buch via All-commits
all-commits at lists.llvm.org
Mon Jul 15 20:28:39 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8a27ef676e3c607daede048e5021db18a970aa71
https://github.com/llvm/llvm-project/commit/8a27ef676e3c607daede048e5021db18a970aa71
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2024-07-16 (Tue, 16 Jul 2024)
Changed paths:
A lldb/include/lldb/Target/VerboseTrapFrameRecognizer.h
M lldb/source/Target/CMakeLists.txt
M lldb/source/Target/Process.cpp
A lldb/source/Target/VerboseTrapFrameRecognizer.cpp
A lldb/test/Shell/Recognizer/Inputs/verbose_trap.cpp
A lldb/test/Shell/Recognizer/verbose_trap.test
Log Message:
-----------
[lldb] Add frame recognizer for __builtin_verbose_trap (#80368)
This patch adds a frame recognizer for Clang's
`__builtin_verbose_trap`, which behaves like a
`__builtin_trap`, but emits a failure-reason string into debug-info in
order for debuggers to display
it to a user.
The frame recognizer triggers when we encounter
a frame with a function name that begins with
`__clang_trap_msg`, which is the magic prefix
Clang emits into debug-info for verbose traps.
Once such frame is encountered we display the
frame function name as the `Stop Reason` and display that frame to the
user.
Example output:
```
(lldb) run
warning: a.out was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 35942 launched: 'a.out' (arm64)
Process 35942 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = Misc.: Function is not implemented
frame #1: 0x0000000100003fa4 a.out`main [inlined] Dummy::func(this=<unavailable>) at verbose_trap.cpp:3:5 [opt]
1 struct Dummy {
2 void func() {
-> 3 __builtin_verbose_trap("Misc.", "Function is not implemented");
4 }
5 };
6
7 int main() {
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = Misc.: Function is not implemented
frame #0: 0x0000000100003fa4 a.out`main [inlined] __clang_trap_msg$Misc.$Function is not implemented$ at verbose_trap.cpp:0 [opt]
* frame #1: 0x0000000100003fa4 a.out`main [inlined] Dummy::func(this=<unavailable>) at verbose_trap.cpp:3:5 [opt]
frame #2: 0x0000000100003fa4 a.out`main at verbose_trap.cpp:8:13 [opt]
frame #3: 0x0000000189d518b4 dyld`start + 1988
```
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