Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.IOS and Instruments profiling trouble

I've tried using Instruments to detect memory troubles. I used the following guide to show me how to setup Xamarin->Instruments, http://docs.xamarin.com/guides/ios/deployment,_testing,_and_metrics/instruments_walkthrough/

However, I see that Instruments have changed some in Xcode5, not that it really matters, but some of the button names etc have changed names. Anyway, my problem is that when running Instruments I don't get the "mono code" when selecting a entry in the call stack in instruments (mentioned in step 14 in the guide above). Sometimes i only get assembler/hex (?) references to calls made in the app (probably because instruments failed to match the dsym file), and most of the time I only get names in the call stack as such: "native_to_managed_trampoline__", which shows some obj-c obfuscated code.

So, how on earth can i profile my app in instruments, see the correct call stack, and when i click on the call stack entry, see the c# code in question (just as in the guide) ??

like image 906
tskulbru Avatar asked Mar 21 '23 20:03

tskulbru


1 Answers

A few things to check:

  • Profile on device, not the simulator. On device you should get symbols for managed frames, while in the simulator you will not (this is because in the simulator the code is jitted, and the information to translate from memory addresses to method names is only present in the process' memory).

  • Make sure the app name (foo.app) is the same as your executable name (foo.exe), for some reason symbolication may not work properly otherwise. You can check/modify the executable name in the project's Build/Output options (the 'Assembly Name' field).

  • Don't rebuild your app, and then profile an earlier build. Rebuilding will overwrite the dSYM directory, and make it incompatible with any previous builds.

  • If you're profiling a Release build, make sure the C# compiler emits debugging information (in the project's Build/Compiler options, set 'Debug information' to 'Full'). This will not impact the final app in any way, it will only make the dSYM directory contain more debugging information (file name / line numbers), so it's safe to leave this option on for your releases too.

like image 179
Rolf Bjarne Kvinge Avatar answered Mar 29 '23 08:03

Rolf Bjarne Kvinge