Skip to content

[lldb/Plugins] Add Swift Runtime Failure Recognizer #773

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
Feb 12, 2020

Conversation

medismailben
Copy link

This patch add support for Swift Runtime Failure messages in the debugger.

The trap failure messages is wrapped into an artificial inline function
in the debug info, whose name is the actual error message.

When a thread stops in one of these inlined frames, the recognizer fetch
the function name and set it as the stop reason message and select the
parent frame as the current one.

rdar://53003975

Signed-off-by: Med Ismail Bennani [email protected]

This patch add support for Swift Runtime Failure messages in the debugger.

The trap failure messages is wrapped into an artificial inline function
in the debug info, whose name is the actual error message.

When a thread stops in one of these inlined frames, the recognizer fetch
the function name and set it as the stop reason message and select the
parent frame as the current one.

rdar://53003975

Signed-off-by: Med Ismail Bennani <[email protected]>
@medismailben
Copy link
Author

@swift-ci please test

@medismailben medismailben merged commit 73a3352 into swiftlang:swift/master Feb 12, 2020
@medismailben
Copy link
Author

Reviewed in #750. Create a new PR to accommodate the swift rebranch.

eeckstein added a commit to eeckstein/swift that referenced this pull request Feb 18, 2020
The implementation was done quite a while ago.
Now, that we have support in lldb (swiftlang/llvm-project#773), we can enable it by default in the compiler.

LLDB now shows the runtime failure reason, for example:

* thread #1, queue = 'com.apple.main-thread', stop reason = Swift runtime failure: arithmetic overflow
    frame #1: 0x0000000100000f0d a.out`testit(a=127) at trap_message.swift:4
   1
   2   	@inline(never)
   3   	func testit(_ a: Int8) -> Int8 {
-> 4   	  return a + 1
   5   	}
   6

For details, see swiftlang#25978

rdar://problem/51278690
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.

1 participant