I am trying to demangle a string that I found via dwarfdump. The string is $S8BullsEye14ViewControllerC9showAlertyyF
. If I run xcrun swift-demangle -compact $S8BullsEye14ViewControllerC9showAlertyyF
, it just hangs and never comes back. Is there a way to debug this and understand why this is happening? If I checkout the swift-4.2-RELASE tag, how can I debug this?
The problem is $
is a special character in many shells. You need to escape (\$
) it like this:
xcrun swift-demangle -compact \$S8BullsEye14ViewControllerC9showAlertyyF
BullsEye.ViewController.showAlert() -> ()
You can also omit the $
to make this easier:
xcrun swift-demangle -compact S8BullsEye14ViewControllerC9showAlertyyF
BullsEye.ViewController.showAlert() -> ()
Thanks! I always forget that for some reason. I knew it had to be something I was doing :D.
Another option, on macOS, is to use pbpaste
to pass the symbol.
pbpaste | xcrun swift-demangle
In addition to working with single symbols, this mode also handles symbols embedded in regular text, which is useful for stack traces.
For example if I copy the original question text and run, the output is:
I am trying to demangle a string that I found via dwarfdump. The string is BullsEye.ViewController.showAlert() -> () with unmangled suffix "." If I run xcrun swift-demangle -compact BullsEye.ViewController.showAlert() -> (), it just hangs and never comes back.