OLD | NEW |
1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 return thread_arg->handler->DoDump(thread_arg->pid, thread_arg->context, | 251 return thread_arg->handler->DoDump(thread_arg->pid, thread_arg->context, |
252 thread_arg->context_size) == false; | 252 thread_arg->context_size) == false; |
253 } | 253 } |
254 | 254 |
255 // This function runs in a compromised context: see the top of the file. | 255 // This function runs in a compromised context: see the top of the file. |
256 // Runs on the crashing thread. | 256 // Runs on the crashing thread. |
257 bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) { | 257 bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) { |
258 if (filter_ && !filter_(callback_context_)) | 258 if (filter_ && !filter_(callback_context_)) |
259 return false; | 259 return false; |
260 | 260 |
| 261 // Allow ourselves to be dumped. |
| 262 sys_prctl(PR_SET_DUMPABLE, 1); |
| 263 |
261 CrashContext context; | 264 CrashContext context; |
262 memcpy(&context.siginfo, info, sizeof(siginfo_t)); | 265 memcpy(&context.siginfo, info, sizeof(siginfo_t)); |
263 memcpy(&context.context, uc, sizeof(struct ucontext)); | 266 memcpy(&context.context, uc, sizeof(struct ucontext)); |
264 memcpy(&context.float_state, ((struct ucontext *)uc)->uc_mcontext.fpregs, | 267 memcpy(&context.float_state, ((struct ucontext *)uc)->uc_mcontext.fpregs, |
265 sizeof(context.float_state)); | 268 sizeof(context.float_state)); |
266 context.tid = sys_gettid(); | 269 context.tid = sys_gettid(); |
267 | 270 |
268 if (crash_handler_ && crash_handler_(&context, sizeof(context), | 271 if (crash_handler_ && crash_handler_(&context, sizeof(context), |
269 callback_context_)) | 272 callback_context_)) |
270 return true; | 273 return true; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 313 |
311 // This function runs in a compromised context: see the top of the file. | 314 // This function runs in a compromised context: see the top of the file. |
312 // Runs on the cloned process. | 315 // Runs on the cloned process. |
313 bool ExceptionHandler::DoDump(pid_t crashing_process, const void* context, | 316 bool ExceptionHandler::DoDump(pid_t crashing_process, const void* context, |
314 size_t context_size) { | 317 size_t context_size) { |
315 return google_breakpad::WriteMinidump( | 318 return google_breakpad::WriteMinidump( |
316 next_minidump_path_c_, crashing_process, context, context_size); | 319 next_minidump_path_c_, crashing_process, context, context_size); |
317 } | 320 } |
318 | 321 |
319 } // namespace google_breakpad | 322 } // namespace google_breakpad |
OLD | NEW |