DerekSelander / dsdump

An improved nm + Objective-C & Swift class-dump

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

With iOS 14 images, dsdump terminates with an assertion failure if --arch option is not specified.

MLKrisJohnson opened this issue · comments

I've tried using dsdump on some executables on the iOS 14 Developer Disk Image and found that if you don't specify the -a/--arch option, then dsdump apparently can't determine the default architecture and will terminate.

The Developer Disk Image can be found at /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/14.0/DeveloperDiskImage.dmg after installing the Xcode 12 beta. Double-click it to mount it.

Then, run one of these commands:

dsdump /Volumes/DeveloperDiskImage/usr/libexec/testmanagerd
dsdump /Volumes/DeveloperDiskImage/Library/Frameworks/XCTest.framework/XCTest

The output is

Multiple arches found: [ arm64 | arm64e ]
Assertion failed: (len == sizeof(uint32_t)), function -[XRMachOLibrary(FAT) defaultArchitectureName]_block_invoke, file /Users/lolgrep/code/dsdump/dsdump/FAT/XRMachOLibrary+FAT.mm, line 144.
[1]    37661 abort      ~/Downloads/dsdump 

The workaround is to simply add --arch arm64 or --arch arm64e to the command line.

@DerekSelander not sure if this is your issue, but they started using ARM64e capabilities in iOS14 so now you need to mask by ~ 0xff000000 to get cpu_subtype. You can see how I solved it here https://github.com/blacktop/go-macho/blob/master/types/cpu.go#L122

commented

Decided to make users explicitly opt for the arch instead of trying to be smart about what I think they'd want

Would it be much trouble to add an option for it to fail gracefully i.e. run with the latest supported arch?