Forráskód Böngészése

Added Debugging information about iOS+XCode

mathiaswking 6 éve
szülő
commit
50b6bbd510

+ 10 - 2
docs/en/manuals/extensions-debugging-android.md

@@ -30,12 +30,18 @@ Here we list some ways to debug your executable running on an Android Device
 
 * Path mappings help you remap where the individual paths from where the executable was built (in the cloud) to an actual folder on your local drive.
 
-* Add a mapping your local drive
+* Select the .so file, then add a mapping your local drive
 
 	![path_mapping1](images/extensions/debugging/android/path_mappings_android.png)
 
 	![path_mapping2](images/extensions/debugging/android/path_mappings_android2.png)
 
+* If you have access to the engine source, ad a path mapping to that too
+
+		* make sure to checkout the version you are currently debugging
+
+			defold$ git checkout 1.2.148
+
 * Press `Apply changes`
 
 * You should now see the source mapped in your project
@@ -53,7 +59,7 @@ Here we list some ways to debug your executable running on an Android Device
 * You can now step in the callstack as well as inspect the variables
 
 
-## Caveats
+## Notes
 
 ### Native Extension job folder
 
@@ -62,4 +68,6 @@ is random for each build, making the path mapping invalid for each build.
 
 However, it works fine for a debugging session.
 
+The path mappings are stored in the <project>.iml file in the Android Studio project.
+It's possible to get the job folder from
 

+ 125 - 0
docs/en/manuals/extensions-debugging-ios.md

@@ -0,0 +1,125 @@
+# Debugging on iOS/macOS
+
+Here we describe how to debug a build using [XCode](https://developer.apple.com/xcode/), Apple's preferred IDE for developing for macOS and iOS.
+
+## Xcode
+
+* Bundle the app as using bob, with the `--with-symbols` option
+
+		$ cd myproject
+		$ wget http://d.defold.com/archive/<sha1>/bob/bob.jar
+		$ java -jar bob.jar --platform armv7-darwin build --with-symbols debug --archive bundle -bo build/ios -mp <app>.mobileprovision --identity "iPhone Developer: Your Name (ID)" -bo build/ios
+
+* Install the app, either with `XCode`, `iTunes` or [ios-deploy](https://github.com/ios-control/ios-deploy)
+
+		$ ios-deploy -b VideoPlayer.ipa
+
+* Get the `.dSYM` folder (i.e the debug symbols)
+
+	* If it's not using Native Extensions, you can download the `.dSYM` file from [d.defold.com](http://d.defold.com)
+
+	* If you are using a native extension, then the `.dSYM` folder is generated when you build with [bob.jar](https://www.defold.com/manuals/bob/). Only building is required (no archive or bundling):
+
+			$ cd myproject
+			$ unzip .internal/cache/arm64-ios/build.zip
+			$ mv dmengine.dSYM <AppName>.dSYM
+			$ mv <AppName>.dSYM/Contents/Resources/DWARF/dmengine <AppName>.dSYM/Contents/Resources/DWARF/<AppName>
+
+
+### Create Project
+
+To properly debug, we need to have a project, and the source code mapped.
+We're not using this project to build things, only debug.
+
+* Create new XCode project, choose the `Game` template
+
+	![project_template](images/extensions/debugging/ios/project_template.png)
+
+* Choose a name (e.g. `debug`) and the default settings
+
+* Choose a folder to save the project into
+
+* Add your code to the app
+
+	![add_files](images/extensions/debugging/ios/add_files.png)
+
+* Make sure the "Copy items if needed" is unchecked.
+
+	![add_source](images/extensions/debugging/ios/add_source.png)
+
+* This is the end result
+
+	![added_source](images/extensions/debugging/ios/added_source.png)
+
+
+* Disable the `Build` step
+
+	![edit_scheme](images/extensions/debugging/ios/edit_scheme.png)
+
+	![disable_build](images/extensions/debugging/ios/disable_build.png)
+
+* Set the `Deployment target` version so it's now larger than your device iOS version
+
+	![deployment_version](images/extensions/debugging/ios/deployment_version.png)
+
+* Select the target device
+
+	![select_device](images/extensions/debugging/ios/select_device.png)
+
+
+### Launch the debugger
+
+You have a few options to debug an app
+
+1. Either choose `Debug` -> `Attach to process...` and select the app from there
+
+1. Or choose the `Attach to process by PID or Process name`
+
+	![select_device](images/extensions/debugging/ios/attach_to_process_name.png)
+
+	1. Start the app on the device
+
+1. In `Edit Scheme` add the <AppName>.app folder as the executable
+
+### Debug symbols
+
+**To use lldb, the execution must be paused**
+
+* Add the `.dSYM` path to lldb
+
+		(lldb) add-dsym <PathTo.dSYM>
+
+	![add_dsym](images/extensions/debugging/ios/add_dsym.png)
+
+* Verify that `lldb` read the symbols successfully
+
+		(lldb) image list <AppName>
+
+### Path mappings
+
+* Add the engine source (change accordingly for your need)
+
+		(lldb) settings set target.source-map /Users/builder/ci/builds/engine-ios-64-master/build /Users/mathiaswesterdahl/work/defold
+		(lldb) settings append target.source-map /private/var/folders/m5/bcw7ykhd6vq9lwjzq1mkp8j00000gn/T/job4836347589046353012/upload/videoplayer/src /Users/mathiaswesterdahl/work/projects/extension-videoplayer-native/videoplayer/src
+
+* Verify the source mappings
+
+		(lldb) settings show target.source-map
+
+You can check what source file a symbol was originating from using
+
+	(lldb) image lookup -va <SymbolName>
+
+### Breakpoints
+
+* Open a file in the project view, and set a breakpoint
+
+	![breakpoint](images/extensions/debugging/ios/breakpoint.png)
+
+## Notes
+
+### Check UUID of binary
+
+In order for the debugger to accept the `.dSYM` folder, the UUID need to match the UUID of the executable being debugged. You can check the UUID like so:
+
+	$ dwarfdump -u <PathToBinary>

BIN
docs/en/manuals/images/extensions/debugging/ios/add_dsym.png


BIN
docs/en/manuals/images/extensions/debugging/ios/add_files.png


BIN
docs/en/manuals/images/extensions/debugging/ios/add_source.png


BIN
docs/en/manuals/images/extensions/debugging/ios/added_source.png


BIN
docs/en/manuals/images/extensions/debugging/ios/attach_to_process_name.png


BIN
docs/en/manuals/images/extensions/debugging/ios/breakpoint.png


BIN
docs/en/manuals/images/extensions/debugging/ios/deployment_version.png


BIN
docs/en/manuals/images/extensions/debugging/ios/disable_build.png


BIN
docs/en/manuals/images/extensions/debugging/ios/edit_scheme.png


BIN
docs/en/manuals/images/extensions/debugging/ios/project_template.png


BIN
docs/en/manuals/images/extensions/debugging/ios/select_device.png