Print self in symbolic breakpoint for deinit

Does anyone know how to print the name of an instance or self in this symbolic breakpoint? I would like to know which Coordinator instance was deallocated. I'm using similar approach for view controllers but it's Objective-C API.

55

1 Like

How about --- deinit @self@ @title@?

I’m not sure why the log action in the tweet you linked doesn’t just use --- dealloc @self@ @self.title@, btw.

I tried expressions like this but it prints only "--- dealloc" string with error:

Swift expressions require OS X 10.10 / iOS 8 SDKs or later.

Huh, that’s strange. Stupid question, but: You’re using one of those SDKs, right?

It worked for me in a macOS command line target using Xcode 10.1.

What kind of target is your breakpoint in (macOS, iOS Simulator, iOS device, …)?
Which version of Xcode are you using?
Does it work when you set a breakpoint in your Swift code and try to run some Swift there, e.g. po self in a class instance method, for example?

Yes, I'm using macOS 10.14.3 / Xcode 10.1 and the code is in framework with deployment target iOS 9.0.
I'm trying this on iOS simulator.
Breakpoints work normally when I set them in code editor, just as debug commands like po self. But when I uncheck the "Automatically continue after evaluating actions" option in the deinit symbolic breakpoint - the po self command ends with same error as a wrote.

Hi,
I was also looking for a symbolic breakpoint on the deinit of a Swift class and came across this thread.

For me, --- deinit @self@ yeilds -- deinit 0x0000000000000000

I believe that's kind of expected as we are releasing self and by the time the breakpoint action is executed, self is already released, isn't it?