Skip to content

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

Merged
medismailben merged 1 commit into
swiftlang:swift/masterfrom
medismailben:swift/master
Feb 12, 2020
Merged

[lldb/Plugins] Add Swift Runtime Failure Recognizer#773
medismailben merged 1 commit into
swiftlang:swift/masterfrom
medismailben:swift/master

Conversation

@medismailben
Copy link
Copy Markdown

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 medismail.bennani@gmail.com

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 <medismail.bennani@gmail.com>
@medismailben
Copy link
Copy Markdown
Author

@swift-ci please test

@medismailben medismailben merged commit 73a3352 into swiftlang:swift/master Feb 12, 2020
@medismailben
Copy link
Copy Markdown
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