0

I've typed a very simple error into an Xcode playground:

import UIKit
        
var greeting = "Hello, playground"

["foo", "bar"][2] // error

The console correctly prints the error:

Swift/ContiguousArrayBuffer.swift:580: Fatal error: Index out of range

However the Xcode Playground error pop-up instead says:

The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.

error: Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x18f2ea5d8).

The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.


How do I "use thread return -x" in the Xcode playground, as directed? Where can I type this and what does the command do?

Is some kind of setting, such as Xcode exception breakpoints, mistakenly enabled in this Playground? Why is this error being displayed instead of the actual Fatal error: Index out of range underlying error?


NOTE: I know what the simple code issue is and can easily fix it. This question is about why that error message is being displayed, and how/if I can use thread return -x in the Playground.

pkamb
  • 33,281
  • 23
  • 160
  • 191
  • Xcode Playground doesn't give us access to the debugger like Xcode does. Go to this link https://www.objc.io/issues/19-debugging/lldb-debugging/ and scroll down to "Thread Return" which will tell you what this specific LLDB command does. – trndjc Dec 15 '21 at 23:39
  • Issue on [Swift Forums](https://forums.swift.org/t/thread-return-x-what-does-it-mean/11342) and bug [SR-8694](https://bugs.swift.org/browse/SR-8694). – pkamb Dec 16 '21 at 17:22
  • I still have the issue, does anyone know how to solve it? – Ali Qaderi Mar 03 '23 at 06:49

0 Answers0