OLD | NEW |
1 # How To Add Breakpad To Your Mac Client Application | 1 # How To Add Breakpad To Your Mac Client Application |
2 | 2 |
3 This document is a step-by-step recipe to get your Mac client app to build with | 3 This document is a step-by-step recipe to get your Mac client app to build with |
4 Breakpad. | 4 Breakpad. |
5 | 5 |
6 ## Preparing a binary build of Breakpad for use in your tree | 6 ## Preparing a binary build of Breakpad for use in your tree |
7 | 7 |
8 You can either check in a binary build of the Breakpad framework & tools or | 8 You can either check in a binary build of the Breakpad framework & tools or |
9 build it as a dependency of your project. The former is recommended, and | 9 build it as a dependency of your project. The former is recommended, and |
10 detailed here, since building dependencies through other projects is | 10 detailed here, since building dependencies through other projects is |
11 problematic(matching up configuration names), and the Breakpad code doesn't | 11 problematic(matching up configuration names), and the Breakpad code doesn't |
12 change nearly often enough as your application's will. | 12 change nearly often enough as your application's will. |
13 | 13 |
14 ## Building the requisite targets | 14 ## Building the requisite targets |
15 | 15 |
16 All directories are relative to the `src` directory of the Breakpad checkout. | 16 All directories are relative to the `src` directory of the Breakpad checkout. |
17 | 17 |
18 * Build the 'All' target of `client/mac/Breakpad.xcodeproj` in Release mode. | 18 * Build the `All` target of |
19 * Execute `cp -R client/mac/build/Release/Breakpad.framework <location in your | 19 [client/mac/Breakpad.xcodeproj](/src/client/mac/Breakpad.xcodeproj/) |
20 source tree>` | 20 in Release mode. |
21 * Inside `tools/mac/dump_syms` directory, build dump\_syms.xcodeproj, and copy | 21 * Execute `cp -R client/mac/build/Release/Breakpad.framework <location in your |
22 tools/mac/dump\_syms/build/Release/dump\_syms to a safe location where it | 22 source tree>` |
23 can be run during the build process. | 23 * Inside [tools/mac/dump_syms](/src/tools/mac/dump_syms/) directory, build |
| 24 `dump_syms.xcodeproj`, and copy |
| 25 `tools/mac/dump_syms/build/Release/dump_syms` to a safe location where it |
| 26 can be run during the build process. |
24 | 27 |
25 ## Adding Breakpad.framework | 28 ## Adding Breakpad.framework |
26 | 29 |
27 Inside your application's framework, add the Breakpad.Framework to your | 30 Inside your application's framework, add the Breakpad.Framework to your |
28 project's framework settings. When you select it from the file chooser, it will | 31 project's framework settings. When you select it from the file chooser, it will |
29 let you pick a target to add it to; go ahead and check the one that's relevant | 32 let you pick a target to add it to; go ahead and check the one that's relevant |
30 to your application. | 33 to your application. |
31 | 34 |
32 ## Copy Breakpad into your Application Package | 35 ## Copy Breakpad into your Application Package |
33 | 36 |
(...skipping 27 matching lines...) Expand all Loading... |
61 | 64 |
62 * Turn on Separate Strip, | 65 * Turn on Separate Strip, |
63 * Set the Strip Style to Non-Global Symbols. | 66 * Set the Strip Style to Non-Global Symbols. |
64 | 67 |
65 ## Write Code! | 68 ## Write Code! |
66 | 69 |
67 You'll need to have an object that acts as the delegate for NSApplication. | 70 You'll need to have an object that acts as the delegate for NSApplication. |
68 Inside this object's header, you'll need to add | 71 Inside this object's header, you'll need to add |
69 | 72 |
70 1. add an ivar for Breakpad and | 73 1. add an ivar for Breakpad and |
71 2. a declaration for the applicationShouldTerminate:(NSApplication`*` sender) | 74 2. a declaration for the `applicationShouldTerminate:(NSApplication* sender)` |
72 message. | 75 message. |
73 | 76 |
74 ``` | 77 ``` |
75 #import <Breakpad/Breakpad.h> | 78 #import <Breakpad/Breakpad.h> |
76 | 79 |
77 @interface BreakpadTest : NSObject { | 80 @interface BreakpadTest : NSObject { |
78 . | 81 . |
79 . | 82 . |
80 . | 83 . |
81 BreakpadRef breakpad; | 84 BreakpadRef breakpad; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
r { | 121 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
r { |
119 BreakpadRelease(breakpad); | 122 BreakpadRelease(breakpad); |
120 return NSTerminateNow; | 123 return NSTerminateNow; |
121 } | 124 } |
122 ``` | 125 ``` |
123 | 126 |
124 ## Configure Breakpad | 127 ## Configure Breakpad |
125 | 128 |
126 Configure Breakpad for your application. | 129 Configure Breakpad for your application. |
127 | 130 |
128 1. Take a look inside the Breakpad.framework at the Breakpad.h file for the | 131 1. Take a look inside the `Breakpad.framework` at the `Breakpad.h` file for the |
129 keys, default values, and descriptions to be passed to BreakpadCreate(). | 132 keys, default values, and descriptions to be passed to `BreakpadCreate()`. |
130 2. Add/Edit the Breakpad specific entries in the dictionary passed to | 133 2. Add/Edit the Breakpad specific entries in the dictionary passed to |
131 BreakpadCreate() -- typically your application's info plist. | 134 `BreakpadCreate()` -- typically your application's info plist. |
132 | 135 |
133 Example from the Notifier Info.plist: | 136 Example from the Notifier Info.plist: |
134 `<key>BreakpadProduct</key><string>Google_Notifier_Mac</string> | 137 `<key>BreakpadProduct</key><string>Google_Notifier_Mac</string> |
135 <key>BreakpadProductDisplay</key><string>${PRODUCT_NAME}</string> | 138 <key>BreakpadProductDisplay</key><string>${PRODUCT_NAME}</string> |
136 ` | 139 ` |
137 | 140 |
138 ## Build Your Application | 141 ## Build Your Application |
139 | 142 |
140 Almost done! | 143 Almost done! |
141 | 144 |
(...skipping 26 matching lines...) Expand all Loading... |
168 <key>BreakpadURL</key> | 171 <key>BreakpadURL</key> |
169 <string>upload URL</string> | 172 <string>upload URL</string> |
170 <key>BreakpadReportInterval</key> | 173 <key>BreakpadReportInterval</key> |
171 <string>30</string> | 174 <string>30</string> |
172 ``` | 175 ``` |
173 | 176 |
174 ## Final Notes | 177 ## Final Notes |
175 | 178 |
176 Breakpad checks whether it is being run under a debugger, and if so, normally | 179 Breakpad checks whether it is being run under a debugger, and if so, normally |
177 does nothing. But, you can force Breakpad to function under a debugger by | 180 does nothing. But, you can force Breakpad to function under a debugger by |
178 setting the Unix shell variable BREAKPAD\_IGNORE\_DEBUGGER to a non-zero value. | 181 setting the Unix shell variable `BREAKPAD_IGNORE_DEBUGGER` to a non-zero value. |
179 You can bracket the source code in the above Write The Code step with #if DEBUG | 182 You can bracket the source code in the above Write The Code step with `#if DEBUG
` |
180 to completely eliminate it from Debug builds. See | 183 to completely eliminate it from Debug builds. See |
181 //depot/googlemac/GoogleNotifier/main.m for an example. FYI, when your process | 184 `//depot/googlemac/GoogleNotifier/main.m` for an example. FYI, when your process |
182 forks(), exception handlers are reset to the default for child processes. So | 185 forks(), exception handlers are reset to the default for child processes. So |
183 they must reinitialize Breakpad, otherwise exceptions will be handled by Apple's | 186 they must reinitialize Breakpad, otherwise exceptions will be handled by Apple's |
184 Crash Reporter. | 187 Crash Reporter. |
OLD | NEW |