Skip to content

Instantly share code, notes, and snippets.

@keithel
Created May 9, 2023 19:15
Show Gist options
  • Save keithel/f4576efa4e2c31a5756b9b8517d40a15 to your computer and use it in GitHub Desktop.
Save keithel/f4576efa4e2c31a5756b9b8517d40a15 to your computer and use it in GitHub Desktop.
Apple devbugging tips

Apple debugging tips

  1. Create a blank Xcode project for the purpose of debugging your app, if it was not built with Xcode.
  2. Select your executable you wish to debug using Debug->Debug Executable... or Debug->Attach to process.
  3. You can modify startup parameters for the app using the scheme, accessible at Product->Scheme->Edit Scheme....
  4. To load debug versions of libraries, like the Qt libraries, set the environment variable DYLD_IMAGE_SUFFIX to _debug which will load the the debug versions of the Qt libraries. You can set this in the Arguments tab of the Scheme editor.
  5. In Scheme editor, make sure that the Document Versions ☐ Allow debugging when browsing versions checkbox is unchecked - it defaults to on. Without doing this, you will often have applications failing on startup because Xcode inserts command line options to the application that the app is not expecting.
  6. Make sure that the .dSYM files are located adjacent to the .frameworks and/or .dyld libraries.
  7. Running image lookup --verbose --address $pc in the lldb command line interface in xcode, when you have stepped into code that XCode is not showing you the sources for will show you the source path that is present in the debug symbol file, which you need when mapping sources to the sources on your local machine.
  8. Set up the source mapping from the build machine's source location to the location of the sources on your machine can be done with the following command: settings set target.source-map /Volumes/DATA/local/S/workspace/qt_maya/src /Users/kyzikadmin/Build/qt-git/qt5
  9. Step into the library code!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment