Get code in app from stack trace

Zaibatsu 0 Reputation points
2024-04-09T07:50:26.5733333+00:00

I have a Xamarin.Forms project with support for iOS smart devices. In Organizer from Xcode we can download crash logs from our users (AppStore build). How can we pinpoint (native) functions in the stack trace to the Forms code in our app?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,346 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2024-04-09T07:50:26.5833333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To pinpoint native functions in the stack trace to the Forms code in your app, you can use the mtouch tool that comes with Xamarin.iOS. This tool can symbolicate the stack trace and map it to the corresponding source code.

    Here are the steps to use mtouch:

    1. Retrieve the crash log from the user's device.
    2. Open Xcode's Organizer and select the crash log.
    3. Right-click on the log and select "Show in Finder".
    4. Copy the .ips file to your development machine.
    5. Open Terminal and navigate to the directory containing the .ips file.
    6. Use the symbolicatecrash tool to symbolicate the crash log:
         xcrun atos -o YourAppName.app/YourAppName -arch arm64 -l <load-address> <memory-address>
      
      Replace <load-address> with the load address of the binary (found in the crash log) and <memory-address> with the memory address from the crash log.
    7. The output of the symbolicatecrash tool will contain the stack trace with the corresponding source code file and line number.

    References:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.