| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 CrashContext context; | 261 CrashContext context; |
| 262 memcpy(&context.siginfo, info, sizeof(siginfo_t)); | 262 memcpy(&context.siginfo, info, sizeof(siginfo_t)); |
| 263 memcpy(&context.context, uc, sizeof(struct ucontext)); | 263 memcpy(&context.context, uc, sizeof(struct ucontext)); |
| 264 memcpy(&context.float_state, ((struct ucontext *)uc)->uc_mcontext.fpregs, |
| 265 sizeof(context.float_state)); |
| 264 context.tid = sys_gettid(); | 266 context.tid = sys_gettid(); |
| 265 | 267 |
| 266 if (crash_handler_ && crash_handler_(&context, sizeof(context), | 268 if (crash_handler_ && crash_handler_(&context, sizeof(context), |
| 267 callback_context_)) | 269 callback_context_)) |
| 268 return true; | 270 return true; |
| 269 | 271 |
| 270 static const unsigned kChildStackSize = 8000; | 272 static const unsigned kChildStackSize = 8000; |
| 271 PageAllocator allocator; | 273 PageAllocator allocator; |
| 272 uint8_t* stack = (uint8_t*) allocator.Alloc(kChildStackSize); | 274 uint8_t* stack = (uint8_t*) allocator.Alloc(kChildStackSize); |
| 273 if (!stack) | 275 if (!stack) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 310 |
| 309 // This function runs in a compromised context: see the top of the file. | 311 // This function runs in a compromised context: see the top of the file. |
| 310 // Runs on the cloned process. | 312 // Runs on the cloned process. |
| 311 bool ExceptionHandler::DoDump(pid_t crashing_process, const void* context, | 313 bool ExceptionHandler::DoDump(pid_t crashing_process, const void* context, |
| 312 size_t context_size) { | 314 size_t context_size) { |
| 313 return google_breakpad::WriteMinidump( | 315 return google_breakpad::WriteMinidump( |
| 314 next_minidump_path_c_, crashing_process, context, context_size); | 316 next_minidump_path_c_, crashing_process, context, context_size); |
| 315 } | 317 } |
| 316 | 318 |
| 317 } // namespace google_breakpad | 319 } // namespace google_breakpad |
| OLD | NEW |