Skip to content

[lldb][FrameRecognizer] Make VerboseTrapFrameRecognizer aware of Swift-C++ interop frames #9307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

Michael137
Copy link

@Michael137 Michael137 commented Sep 20, 2024

This patch ensures that if libc++ is called from Swift (via Swift interop for example), and triggers a __builtin_verbose_trap, we don't stop in the Swift-C++ compiler-generated shims.

E.g., in the example test-case, the stacktrace looks like:

frame #0: 0x0000000102998c00 a.out`std::function_that_aborts() [inlined] __clang_trap_msg$Error$from C++ at aborts.h:0
frame #1: 0x0000000102998c00 a.out`std::function_that_aborts() at aborts.h:4:31
frame #2: 0x0000000102998c1c a.out`std::ConstIterator::operator*(this=0x0000600003954420) const at aborts.h:21:28
frame #3: 0x0000000102998ab0 a.out`std.ConstIterator.pointee.read() at <compiler-generated>:0
frame #4: 0x0000000102998a14 a.out`protocol witness for UnsafeCxxInputIterator.pointee.read in conformance std.ConstIterator at <compiler-generated>:0
frame #5: 0x0000000102998760 a.out`takes<ConstIterator>(t=Aborts.ConstIterator @ 0x000000016d46aeb8) at main.swift:4:7
frame #6: 0x00000001029985e0 a.out`main() at main.swift:9:3
frame #7: 0x0000000102998584 a.out`main at main.swift:13:1
frame #8: 0x000000019053df20 dyld`start + 1988

We want to stop in frame 5, which is where the call into std started.

rdar://136357737

@Michael137 Michael137 force-pushed the lldb/verbose-trap-ux-to-next branch from f6ea98f to 86ad179 Compare October 1, 2024 12:14
@Michael137 Michael137 force-pushed the lldb/verbose-trap-ux-to-next branch from 86ad179 to a7b5fdf Compare October 1, 2024 12:15
@Michael137 Michael137 merged commit 02a9906 into next Oct 1, 2024
@Michael137 Michael137 deleted the lldb/verbose-trap-ux-to-next branch October 1, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants