Xcode's Time Profiler shows addresses instead of symbols - ios

In general, my problem could be seen on this screen-shot:
A lot of non-symbolicated addresses and something that looks broken inside "Symbols" menu.
Well, and some settings and actions in attempt to solve this.
But none still helped:
Profile tab is set to use Debug
Symbols stripping disabled for both Debug and Release
Optimization level is "none" for both Debug and Release
Clean, Delete, Restart, etc
mdimport ~/Library/Developer/
DWARF and dSYM format

I had the same problem - and did everything on your list as well. Here's what finally worked for me:
In Instruments, stop the process if it's running.
Go to File -> Symbols, and under dSYM path, find the library that isn't being symbolicated.
In my case, it was pointing to items in the Trash. So I emptied the Trash, deleted the Module Cache and project in the Derived Data folder, and when I rebuilt the project it started working again. In your case it could be pointing to some other file that either doesn't exist or isn't reachable by Instruments.

Activating "Always Embed Swift Standard Libraries" on the target I was profiling, fixed it for me. YMMV

I had the same problem running in the simulator, and it was driving me nuts because ALL the standard go-to fixes were not working.
What did it for me was plugging my iPad into the MacBook and running an instruments session against said app on my plugged in iPad. Instruments properly symbolicated my app when running on the iPad, and then continued to work when I disconnected the iPad and ran instruments later in the simulator.
I suspect it had something to do with updating my project to use the following...
libsqlite3.tbd instead of libsqlite3.dylib
libstdc++.6.tbd instead of libstdc++.dylib
I don't know why that would be the case, but that was the ONLY project change I had made before my symbols were lost in Instruments.

In my case I had excluded my derived data directory from spotlight. It turns out that if you do this you must add it back into instruments via Instruments -> Preferences -> Symbols

You are able to add your dSYM[About] using Instruments 12.0
Instruments -> Preferences... -> Symbols
//or
File -> Symbols...
//if File -> Symbols... is not active - stop the process and try again
*Also do not forget to generate .dSYM file beforehand

Related

Cannot hit breakpoints after "Attach to Process by PID or Name" from a custom "embedded framework" in Xcode 10

I have been trying to debug my objective-c code of a custom embedded framework I have been using/developing for the last years and recently (1-2 weeks ago) just before Xcode 10 was released all worked well. I was able to build my embedded framework with debug configuration, create an app (using NativeScript), deploy it to a simulator, open my framework's .xcodeproject, go to Debug > Attach to Process by PID or Name, select the app and add breakpoints int my objective-c code to debug it.
But today I tried to do the same and the breakpoints cannot be hit. I know my embedded framework is build in debug configuration because the .dSYM file is present. Also after the process is attached if I stop it using the button the app stops in the simulator so it must have attached correctly.
Has anyone faced such issues?
Edit:
I did verify that the embedded framework in the project contains debug symbols by comparing the output from nm -a <lib> and nm <lib> from this answer.
Edit 2:
The scenario is quite straight forward:
create an dynamic embedded framework
build its .framework and .framework.dSYS file
add it to a project's embedded frameworks
build that project into app
deploy it to a simulator
open the framework's project
attach it to the process
try to hit a breakpoint.
When you deploy it to the simulator, try stopping the xcode process and manually launch app from the simulator and then attach that Process. Refer to this answer for step by step instructions. How can I debug in a framework in Xcode?
After 3 days of research and digging around I managed to resolve this issue. The source of it still in unknown for me and it looks like it is some sort of breaking change of xcodebuild between 9.4.1 and 10 but it sounds like it could have very much been intentional or a bug fix.
Short answer:
Make sure that the .dSYM that you used with your fat library is for the correct device (simulator or a real device)
TL;DR
So the issue was that I was using the wrong .dSYM file when attaching to the simulator while the .dSYM file was taken from the xcodebuild for real device. So the steps in my build phase (done in bash) was the following:
Build the framework for simulators
Build the framework for real iphones
Create a fat library using xcrun using the above created .framework files
Copy the .dSYM from the real device location in derived data (this is wrong after XCode 10)
I see that this is incorrect but it never made any issues when doing the "Attach to Process" previously but in XCode 10 this no longer works (using debug symbols created for device with a simulator)

Missing symbol names while profiling in Instruments 7

I don't see any symbol names when I'm profiling application for iOS 8.
If I run profiler on simulator with iOS 9 everything works fine. Then I close instruments and switch to simulator with iOS 8.4 and I can see only hexadecimal addresses which reference to assembler or 'unavailable' content. Other threads are unnamed and everything, including system names are shown as binary pointers.
Instruments can't find dSYM file, so I tryied to re-symbolicate app as File ▸ Symbols... then I select missing symbols and there is option to locate dSYM file.
After select dSYM file, I get this message.
And it's over. I also tryied restart PC, rebuild application, clean project, delete Derived Data, reopen XCode and Instruments, reindexing files from this post but it has no effect.
Thanks.
PS: There is similar post without solution

XCode won't run my application on a device/simulator anymore

I am kind of stuck with my XCode problem. First of all: I have a project that contains 5 different targets. Now something went wrong (I can't remember changing anything related to project settings).
If I want to run any target on device or simulator the build succeeds but then nothing happens. Neither the app is started in simulator nor on a device. So I checked the Scheme (-> "Edit scheme") and I could not select my app in the Executable menu. I think I can remember that the .app file was selected there before (as it is if i create any new project). Does anyone know why I can't select anything there?
What I am curious about, is the fact that choosing "Other" in the Executable menu brings me to my DerivedData directory that indeed contains the *.app file resulting from the build. That leads me to my next problem.
If I select this *.app file explicitly and try to run the app XCode gives me the error " does not have an architecture that can execute." But I checked my settings many times and I am definitly using $(ARCHS_STANDARD) in every target.
I am a little bit lost here ... does anyone has a hint, what could have messed up my project and how to fix it?
Might not work, but I've found a lot of bugs in xcode which simply require quitting it, and reopening.
You could also try clearing out the DerivedData directory. Do a full clean build (hold down option key when selecting clean build).
And lastly, reset the simulator via the menu iOS Simulator > Reset Content and Settings.
I got this when I changed the name of my App on one development machine and then tried to work on it a few months later on another machine. I fixed it by deleting the old scheme and Autocreating the new scheme. The settings are under Product - Scheme - Manage Schemes.
OK I solved the problem by myself. I was on the right track before. I did compare the project.pbxproj file again using FileMerge. I merged all lines related to an *.app file from the working version into my corrupt project file. After that my project was fixed. The *.app files showed up under the "Product" group in XCode and I could run the application on simulator/devices again. It seems that I forgot something while I was merging the files via copy & paste. ;)
Rather than cleaning out the DerivedData directory from Xcode, have you tried the "old fashioned" way from Finder? Try quitting Xcode, nuking ~/Library/Developer/Xcode/DerivedData/ModuleCache from Finder, and restarting Xcode.

armv6 and armv7

I've got an app that I created that I'm trying to test on an older iphone 3g. I've used this phone many times for testing but this new app for some reason will not accept the build.
I've done some searching and found that I need to charge the architecture from "armv7" to "armv6", I did this in both the project and target. After doing that I get the following error when trying to build to the device (construction is the name of the app)
Could not launch "construction"
No such file or directory (/Users/Matthew/Library/Developer/Xcode/DerivedData/Construction-cqtujdbjhpvbkrehtfzwvuhvxdrs/Build/Products/Debug-iphoneos/Construction.app/Construction)
But I can build in the simulator at it works fine... any idea?
thank you so much - clearing UIRequiredDeviceCapabilities in Info.plist would have never appeared to me.
None of these solutions worked for me. I'm using XCode 4.5 and ML. What I ended up doing (and still need to test thoroughly), was to re-create my project, started clean and then moved all sources and libraries to the new project and chose my provisioning profile for this new project. In the copy, I also manually copied the contents of the old Info.plist file and pasted them onto the newly Info.plist replacing them all.
In my case, I'm using CorePlot and that library needs armv7 (according to linker), so I can't just go armv6.
What I'm trying to figure out is when (cheap) XCode changed some settings to not run as a debugger on the device. I'm guessing something in the 'project.pbxproj' file. Otherwise I can't explain why the newly created project works and the old one doesn't.
I know this solution might not work for everyone, as in my case, as would lose all svn changes.
I'll post any progress on this.
My next step is to add CorePlot and let the project build it and not use the prebuilt one.
None of these worked for me either. But this DID work...
DO THE USUAL THINGS:
I cleared the build directory (cmd-k),
cleared the DerivedData (see prefs|Locations),
deleted the app from my iPhone 5,
unplugged the iPhone, and
restarted Xcode.
AND LASTLY DO THIS:
Open Xcode Organizer. Click on Devices | (your device name) | Applications. And finally, delete your application from here (aka. delete the app from your device, AGAIN).
Build and run...
Sorry I answered my own question! I figure I should leave this up in case anyone else has the same problem... I didn't update the plist setting to armv6 before... I did have to delete the armv7 in the plist to make it work

Xcode will run app on simulator but not on device

I receive the following error when trying to run the app on my device.
error: failed to launch '/Users/michael/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/Word Processor.app/Word Processor' -- No such file or directory (/Users/michael/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/Word Processor.app/Word Processor)
The app runs fine in the simulator. When I try to debug on the device, it appears to copy the app (I can see the icon), but then stalls with the above message. Xcode says it is running the app on my iPod, but nothing is happening on my iPod.
When I click on the app, the app appears to launch, but seems to be missing resources.
Other projects of mine work properly. What setting do I need to change to make this work properly.? Looking at the error message, it seems to be looking in my mac for the app. But this doesn't make sense since I am trying to run it on my 4th gen iPod touch. I am using Xcode 4.3.1 and iOS 5.1
With Mountain Lion and the latest version of Xcode (4.4.4F250), none of the suggestions in this thread worked directly (clean, clean project, remove derived data folder, etc). This sequence did. From DhilipSiva:
Disconnect your device
Delete the app from your device
Quit Xcode (Don't just simply close the window, quit it)
Delete derived data folder rm -fr ~/Library/Developer/Xcode/DerivedData (console)
Start Xcode,connect device & run the project
I solve this by going to Targets-> Info -> Required Device capabilities and delete the option with armv7.
Hope this helps!
This is a recurring problem that many developers are having with the current version of Xcode. The temporary workaround has been consistently deleting the DerivedData folder.
You can add doing it to a build script or even make it a cron job:
rm -rf ~/Library/Developer/Xcode/DerivedData
Sad, but true.
For me restarting of Xcode, cleaning DerivedData and restaring device wasn't enough in most cases, until I had figured out that iTunes was also running, and after quitting iTunes everything worked fine!
So my steps now are simple:
1. Quit Xcode.
2. If iTunes is running, quit iTunes.
3. Reopen project.
No need to remove app from the device, clean project or restart/disconnect device.
I think that's because Xcode and iTunes use some common libraries (as you know, Xcode Installer always asks to quit iTunes on installing iOS SDK).
I also had this problem after changing from a lower XCode and iOS version to the current XCode and iOS version.
I fixed this problem by changing th iOS Depolyment Target to a lower version, since my Device is not updated to the latest iOS yet.
You can do this by clicking the project inside the Info tab.
Have you looked at the Developer Certs and Distribution Certs if you have. When running in debug mode from Xcode your will need your app assigned with the developer cert and not the distribution cert. The distribution certs do not allow for debugging.
This error will manifest whenever the device capabilities described in the Info.plist do not match those of the device.
In my case, I was requesting GPS support and location-services support and trying to test on an iPod touch.
I struggled with this problem for 2 days and went through all the posts, tried all the options including, restarting Xcode, device, deleting DerivedData folder etc.
Finally, the problem was with the Info.plist file. In my case, I had improper icon paths in the Info.plist file. I suggest you to archive the application and then validate it to get the exact problem in you case. Only when I did that, I was able to find the issue.
I solved this problem many times with DhilipSiva's solution. However, it may not work sometimes. If that is the case, consider deleting and re-adding the target.
Removed armv6 support and it started working again
I stumbled upon this same problem on several diferent projects, researched a lot on forums and even here on Stack overflow. A lot of solutions were given, and some people seemed to get them working, but none of them worked for me.
So we tried some pretty obvious course of action, which for some reason we didn't tought about before: I've done a CHMOD -R 777 on the EXACT path indicated by the error message (I copied it directly).
Worked like a charm, 100% times!
Hope it helps, guys!
As Chronos mentiod, the device capabilities might be the reason. In addition I would say that in my case it was all about the UIRequiresPersistentWiFi key, which (for some unclear reason) didn't let me to install my app on an iPhone4. Hope this helps ones who tried everything else and haven't fixed the problem yet.
I solve this by going to Targets-> Info -> Required Device capabilities and check id at 0 index if armv7 not in 0 index then remove other things and armv7 set on 0 index and clean app connect device and run.
Hope this helps fine!
I did these steps:
Delete derived data: rm -rf ~/Library/Developer/Xcode/DerivedData
Deep cleaned the project: Shift Key + Option Key + Command Key + letter K key
Quit the project
Quit XCode
Deleted the app from my device
When I reopened the Xcode, launched the project, and then launched the app it successively ran on my device
For me it was Command Line Tools
Go to Xcode -> Preferences -> Locations -> Command Line Tools
Make sure you select latest Xcode version. I selected Xcode 11.0, and everything started working.
I get the similar question and has searched via the internet the whole day without solution yet...
Xcode 12, iOS 14.
I'm using a cocoaPods call GCDWebServer, which will open a build-in http service in iOS. Now it works fine in simulator and I could open a home page of it in my Mac's browser. But I cannot open the home page if running it with real iPhone. The browser said "Cannot connect to server"
And in console, everything is same without any errors provided for me.
Thus, how could I debug this?
[DEBUG] Did open IPv4 listening socket 3
[DEBUG] Did open IPv6 listening socket 4
[INFO] GCDWebUploader started on port 80 and reachable at http://192.168.1.3/

Resources