[clang] [clang][CodeGen] Added SanitizerHandler mapping, trap messages in debug info, and corresponding test cases. (PR #143758)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 13 01:20:15 PDT 2025
================
@@ -4051,6 +4144,14 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
llvm::BasicBlock *&TrapBB = TrapBBs[CheckHandlerID];
+ llvm::DILocation *TrapLocation = Builder.getCurrentDebugLocation();
+ llvm::StringRef Category = GetTrapMessageForHandler(CheckHandlerID);
+
+ if (getDebugInfo() && !Category.empty()) {
+ TrapLocation = getDebugInfo()->CreateTrapFailureMessageFor(
+ TrapLocation, Category, TrapMessage);
----------------
Michael137 wrote:
Correct me if I'm wrong, but shouldn't `TrapMessage` be what `GetTrapMessageForHandler` provides, and `Category` be something like `UBSan Trap`?
The way the fake inline frame name gets constructed is:
```
__clang_trap_msg$<category>$<trap message>
```
Currently you are omitting the "<trap message>" and putting the failure reason into the category. It would still technically work out with LLDB (it will display the category even if no message was provided), but it wouldn't be consistent with how `__verbose_trap` is handled
https://github.com/llvm/llvm-project/pull/143758
More information about the cfe-commits
mailing list