OLD | NEW |
1 // Copyright (c) 2010 Google Inc. | 1 // Copyright (c) 2010 Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 12 matching lines...) Expand all Loading... |
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 #ifndef CLIENT_LINUX_HANDLER_EXCEPTION_HANDLER_H_ | 30 #ifndef CLIENT_LINUX_HANDLER_EXCEPTION_HANDLER_H_ |
31 #define CLIENT_LINUX_HANDLER_EXCEPTION_HANDLER_H_ | 31 #define CLIENT_LINUX_HANDLER_EXCEPTION_HANDLER_H_ |
32 | 32 |
| 33 #include <string> |
33 #include <vector> | 34 #include <vector> |
34 #include <string> | |
35 | 35 |
36 #include <pthread.h> | 36 #include <pthread.h> |
37 #include <signal.h> | 37 #include <signal.h> |
| 38 #include <stdint.h> |
38 #include <stdio.h> | 39 #include <stdio.h> |
39 | 40 |
40 #if defined(__ANDROID__) | 41 #if defined(__ANDROID__) |
41 #include "client/linux/android_ucontext.h" | 42 #include "client/linux/android_ucontext.h" |
42 #endif | 43 #endif |
43 #include "client/linux/crash_generation/crash_generation_client.h" | 44 #include "client/linux/crash_generation/crash_generation_client.h" |
| 45 #include "client/linux/minidump_writer/minidump_writer.h" |
| 46 #include "google_breakpad/common/minidump_format.h" |
44 #include "processor/scoped_ptr.h" | 47 #include "processor/scoped_ptr.h" |
45 | 48 |
46 struct sigaction; | 49 struct sigaction; |
47 | 50 |
48 namespace google_breakpad { | 51 namespace google_breakpad { |
49 | 52 |
50 class ExceptionHandler; | 53 class ExceptionHandler; |
51 | 54 |
52 // ExceptionHandler | 55 // ExceptionHandler |
53 // | 56 // |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // #ifdef this out because FP state is not part of user ABI for Linux ARM. | 177 // #ifdef this out because FP state is not part of user ABI for Linux ARM. |
175 struct _libc_fpstate float_state; | 178 struct _libc_fpstate float_state; |
176 #endif | 179 #endif |
177 }; | 180 }; |
178 | 181 |
179 // Returns whether out-of-process dump generation is used or not. | 182 // Returns whether out-of-process dump generation is used or not. |
180 bool IsOutOfProcess() const { | 183 bool IsOutOfProcess() const { |
181 return crash_generation_client_.get() != NULL; | 184 return crash_generation_client_.get() != NULL; |
182 } | 185 } |
183 | 186 |
| 187 // Add information about a memory mapping. This can be used if |
| 188 // a custom library loader is used that maps things in a way |
| 189 // that the linux dumper can't handle by reading the maps file. |
| 190 void AddMappingInfo(const std::string& name, |
| 191 const u_int8_t identifier[sizeof(MDGUID)], |
| 192 uintptr_t start_address, |
| 193 size_t mapping_size, |
| 194 size_t file_offset); |
| 195 |
184 private: | 196 private: |
185 void Init(const std::string &dump_path, | 197 void Init(const std::string &dump_path, |
186 const int server_fd); | 198 const int server_fd); |
187 bool InstallHandlers(); | 199 bool InstallHandlers(); |
188 void UninstallHandlers(); | 200 void UninstallHandlers(); |
189 void PreresolveSymbols(); | 201 void PreresolveSymbols(); |
190 bool GenerateDump(CrashContext *context); | 202 bool GenerateDump(CrashContext *context); |
191 void SendContinueSignalToChild(); | 203 void SendContinueSignalToChild(); |
192 void WaitForContinueSignal(); | 204 void WaitForContinueSignal(); |
193 | 205 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 241 |
230 // A vector of the old signal handlers. | 242 // A vector of the old signal handlers. |
231 std::vector<std::pair<int, struct sigaction *> > old_handlers_; | 243 std::vector<std::pair<int, struct sigaction *> > old_handlers_; |
232 | 244 |
233 // We need to explicitly enable ptrace of parent processes on some | 245 // We need to explicitly enable ptrace of parent processes on some |
234 // kernels, but we need to know the PID of the cloned process before we | 246 // kernels, but we need to know the PID of the cloned process before we |
235 // can do this. We create a pipe which we can use to block the | 247 // can do this. We create a pipe which we can use to block the |
236 // cloned process after creating it, until we have explicitly enabled | 248 // cloned process after creating it, until we have explicitly enabled |
237 // ptrace. This is used to store the file descriptors for the pipe | 249 // ptrace. This is used to store the file descriptors for the pipe |
238 int fdes[2]; | 250 int fdes[2]; |
| 251 |
| 252 // Callers can add extra info about mappings for cases where the |
| 253 // dumper code cannot extract enough information from /proc/<pid>/maps. |
| 254 MappingList mapping_info_; |
239 }; | 255 }; |
240 | 256 |
241 } // namespace google_breakpad | 257 } // namespace google_breakpad |
242 | 258 |
243 #endif // CLIENT_LINUX_HANDLER_EXCEPTION_HANDLER_H_ | 259 #endif // CLIENT_LINUX_HANDLER_EXCEPTION_HANDLER_H_ |
OLD | NEW |