Skip to content
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

[SR-8694] LLDB should not print this message for a playground #51207

Open
swift-ci opened this issue Sep 5, 2018 · 5 comments
Open

[SR-8694] LLDB should not print this message for a playground #51207

swift-ci opened this issue Sep 5, 2018 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Sep 5, 2018

Previous ID SR-8694
Radar None
Original Reporter nhatlee89 (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 2f4ade21ce41e088b2d80939860c9406

Issue Description:

I use the below code in playground of Xcode 10 beta 6:

let string = "123 Main St. / (555) 555-1234"
let types: NSTextCheckingResult.CheckingType = [.phoneNumber, .address]
let detector = try NSDataDetector(types: types.rawValue)
let range = NSRange(string)
detector.enumerateMatches(in: string, options: [], range: range!)
{ (result, _, _) in     print(result) }

But got the error:

error: Execution was interrupted, reason: signal SIGABRT.
 The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
@belkadan
Copy link
Contributor

belkadan commented Sep 5, 2018

jingham@apple.com (JIRA User), who's the right person to look at this?

@swift-ci
Copy link
Collaborator Author

swift-ci commented Sep 5, 2018

Comment by Jim Ingham (JIRA)

If you put the same code (plus "import Foundation") in a .swift file, compile and run it you get:

2018-09-05 09:51:36.277 doesitcrash[23667:9587705] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSDataDetector enumerateMatchesInString:options:range:usingBlock:]: Range or index out of bounds'

*

**

      • First throw call stack:

(

0 CoreFoundation 0x00007fff2c4342db __exceptionPreprocess + 171

1 libobjc.A.dylib 0x00007fff535e0c76 objc_exception_throw + 48

2 CoreFoundation 0x00007fff2c4c5d7d +[NSException raise:format:] + 205

3 Foundation 0x00007fff2e5235c3 -[NSDataDetector enumerateMatchesInString:options:range:usingBlock:] + 440

4 doesitcrash 0x00000001067b73bb main + 1035

5 libdyld.dylib 0x00007fff541fa015 start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

Abort

I don't know enough about the NSRange & NSRangeDetectors to see if this a bug in the code snippet, or in Foundation.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Sep 5, 2018

Comment by Jim Ingham (JIRA)

I removed lldb from the component since this clearly isn't an lldb bug. Not sure what the right component is, however.

@belkadan
Copy link
Contributor

belkadan commented Sep 5, 2018

No, no. This bug is about not printing 'The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.' when a playground fails, because that's not an option. It's not about the actual mistake in the code (which is user error).

@swift-ci
Copy link
Collaborator Author

swift-ci commented Sep 5, 2018

Comment by Jim Ingham (JIRA)

Ah, I see.

The playground runner tells lldb to run an expression, the expression crashes, and this is the string we return when an expression crashes and we've been told not to unwind. Note, the expression evaluation also returns a status which the runner can use to tell directly that the expression crashed.

This isn't a bug in any of the tools covered here. We have no way of knowing that the playground expression isn't being run interactively, and even if we did we don't know what message the runner might want to see. So I don't think it's worthwhile to change the message lldb prints. It's really up to the runner to print what it thinks is useful information from this event. For instance they could use Kuba's new frame detectors to print the ObjC exception message when we stop at an ObjC exception...

This bug really needs to get filed on Xcode.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

2 participants