How movable are iOS debug symbols in Xcode? - ios

I'm using QuincyKit to analyse crash dumps from my iOS apps. QuincyKit's symbolication script is capable of handling both my code and system code - as long as the debug symbols for the relevant version of iOS are present on the machine.
Said symbols reside under (Home)/Library/Developer/Xcode/iOS DeviceSupport. Question - did anyone ever try to move those folders from one machine with Xcode to another?
I could use some 7.0.x symbols; chances of getting a device with that version are practically nil by now.

Just check the source of symbolicatecrash.pl that you use for symbolication.
It searches the iOS system symbols in the following paths:
/System/Library/Developer/Xcode/iOS DeviceSupport/
~/Library/Developer/Xcode/iOS DeviceSupport/
Xcode.app/Contents/Developer/Platforms/*.platform/DeviceSupport/
These paths are hardcoded and may change with every update of the script (as it is part of Xcode).

Related

dlopen() dynamic library for iOS Simulator, in macOS application

I have a "fat" framework built for iOS, which is being used in a debugging tool built for macOS. Previously I was linking this framework statically, which worked, even though XCode complains about it being built for the simulator (since the architecture is the same). But now, newer versions of the library are dynamic, so that route doesn't work, as the tool is a command line application, which doesn't support embedding frameworks.
I could turn it into an application bundle, it seems, in order to solve that, but I'm not sure what this entails (creating a new project?). I can certainly figure it out but ..
In the meantime, I thought I'd load the library dynamically using dlopen() etc and retrieve the classes/methods I need (I already have some code for this which at least compiles). However, that call fails with the following message:
no suitable image found. Did find:
/<path to library file>: mach-o, but built for simulator (not macOS)
Since linking statically is only a warning and actually works, is there a way to make dlopen work as well?
Recompiling the framework itself is not an option for me in this situation.
Are you considering editing the binary of the dylib framework? If so in the Macho-O header you could try changing LC_VERSION_MIN_IPHONEOS to LC_VERSION_MIN_MACOSX.Probably it won't be enough,but it's a simple change for a quick test. Here's a screenshot comparison of those load commands in MachOView
Also covered the other way round here

Symbolicating iOS crash dump: symbols not found

I'm trying to symbolicate a crash dump for an iOS app buit using Xamarin.iOS. I am seeing a lot of warning about not being able to find symbols for system binary images such a Foundation, and the output from symbolicate is ultimately missing most of the information that I need.
I'm following the process described here. I have put MyApp.app, MyApp.app.dSYM, and the crash log into a directory and run symbolicate -o crash.txt "crashreport.crash" "MyApp.app". The output crash.txt contains no symbols, and I see a lot of errors in the symbolicate console output. For example:
Finding Symbols:
.fetching symbol file for Foundation--[undef]
Searching []...-- NO MATCH
Searching in Spotlight for dsym with UUID of e596bd80bcc83f15aca36a7ef014f457
Running mdfind "com_apple_xcode_dsym_uuids == E596BD80-BCC8-3F15-ACA3-6A7EF014F457"
#dsym_paths = ( )
#exec_names = ( )
Did not find executable for dsym
## Warning: Can't find any unstripped binary that matches version of /System/Library/Frameworks/Foundation.framework/Foundation
The full output is at http://pastebin.com/W1KP1iTR
I have used dwarfdump to verify that the UUID in MyApp.pSYM is the same as the one in the crash dump.
I'm using Xamarin studio 5.7.1 on with xcode 6.1.1.
Can anyone suggest what is going wrong here?
Apple's symbolicate tool requires that you add all executables and mach-o binaries to Spotlight database prior to querying for symbols.
This of course a tedious job that is required. I could never find how to remove it from the index, or to know what the queue has been completed and the binary with its UUIDs are indexed.
Plug: I wrote this symbolicate-pro tool.
Here's a program I wrote for TestFairy (the company). It's called symbolicate-pro and it has a few key differences that Apple's symbolicate:
It does not require any indexing.
You can specify directories where your iOS symbols are located.
It's 10x faster.
And if you get otool compiled for another OS, it can run on other platforms than Mac.
TestFairy uses it for its production and is updating when iOS changes the crash reports.
You can find it on github at: https://github.com/testfairy/symbolicatecrash-pro
Hope this helps ;)

Extract dyld_shared_cache on iOS7.1?

I was trying to get the header files from the ToneKit framework on iOS7.1, but I found that I cannot use class-dump because there are no executable files inside the framework. From what I have found after some research, it seems as if the actual executable file is inside the dyld_shared_cache on the device. After reading this article, it seems as if there are some tools to decrypt the cache, but since iOS 3, Apple has implemented ASLR which has made the decryption tools not work. How can I extract the Frameworks from inside the dyld_shared_cache on iOS7.1?
I am very new to jailbroken ios development so please bear with me.
If you're interested in how they got those headers then the answer is very simple - iOS SDK. SDK contains ARM binaries of public and private frameworks because they are required to compile iOS applications. Class-dump them and you will get headers you need. ToneKit.framework binary is also in there.
Usually you don't need dyld_shared_cache, almost everything you need is either in iOS SDK or on a device itself like SpringBoard, other system applications etc.
Of course there are rare cases when dyld_shared_cache is the only place you can find certain binaries as they are missing from both iOS SDK and device. In that case I use IDA. It has free demo version that can open dyld_shared_cache files - you can even open individual binaries inside it rather than dump everything. You just need to copy dyld_shared_cache on your PC.
I think Elias Limneos's classdump-dyld can help you. If not, check out RuntimeBrowser. Failing that, even, weak-classdump has proven to be a very useful runtime tool for me.

Error in generating Archives

I m using Xcode 4.2 and i have add AviarySDK 2.4.4 in my project.
Application runs fine in Simulator 5.0 and 4.3. I also test it on device having ios 4.1. So i want to generate .ipa file for my client. But by some reason it can not generate Archives.
It gives following error
"/usr/bin/strip -S /Applications/Projects/AppName/AppName/AviarySDK/Resources/AviarySDKResources.bundle/AviarySDKResources -o /Users/User/Library/Developer/Xcode/DerivedData/WDYWT-avjpbcnwjylobvgevipvsqttnopd/ArchiveIntermediates/WDYWT/InstallationBuildProductsLocation/Applications/WDYWT.app/AviarySDKResources.bundle/AviarySDKResources
/usr/bin/strip: for architecture armv7 object: /Applications/Projects/AppName/AppName/AviarySDK/Resources/AviarySDKResources.bundle/AviarySDKResources malformed object (unknown load command 10)
error: strip /Applications/Projects/AppName/AppName/AviarySDK/Resources/AviarySDKResources.bundle/AviarySDKResources: /usr/bin/strip exited with 1
"
Any help will really great. Many thanks in advance.
Strip errors are generally caused if you have duplicate debugging symbols in your project. Just try the following:
First Method:
Go to build settings of your project
Type Strip in the search Bar.
Under Strip Debug Symbols During Copy, you shall find Debug and under that you shall find Any SDK.
Select NO in Any SDK, select YES in Debug and select YES in Strip Debug Symbols during copy.
A little below you shall find Use Separate Strip. Select YES.
Check that Strip Style should remain All Symbols [If not then change it to that].
Second Method:
Since your error also mentions derived data, their might me duplicacy of your derived data as well. Delete Your project file from the derived data folder.
If you don't know where the derived data folder is, Google it.
I am using aviary in my current project. I have a Mac Mini and a MacAir [for work at home].
I was facing the same strip issues with aviary which I resolved using the first method mentioned above.
It took me a week to figure this out cuz i am a relative newbie in development and nothing regarding this issue has been mentioned in aviary forums as well.
PS:
MacMini: Xcode 4.5
MacAir: Xcode 4.2
Hope this helps

Cannot step into a particular function in a library in Xcode 4.2/iOS 5.0

I am working on an iPhone app in which I need to include a library (lib.a) for the app to work. This library (lib.a) consists of multiple files(classes). While debugging, I noticed that I could not step into any function in the file sync.m (included via lib.a), but I could step into any function in file (data.m) (also included via lib.a). I am wondering as to why I can step into one file and not another. I am using XCode4.2/iOS 5.0
I have checked all the debug settings in both my app and the library.
Generate Debug Symbols => yes (for debug)
I am also in the "run for debug mode".
The only thing that I suspect at this point is that I moved the sync.m from one folder to another ... Would that cause a problem with respect to the debug symbols ??? Where are the debug symbols stored? In the dsym file? Where can I find this file as I would like to see which debug symbols are being generated and which are not.
I would appreciate it if anyone can throw some light on this issue.
The object was not being retained and thus was pointing to nothing(NULL). Obviously, therefore function couldn't be stepped into.

Resources