OLD | NEW |
1 // Copyright (c) 2014, Google Inc. | 1 // Copyright (c) 2014, 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 16 matching lines...) Expand all Loading... |
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 // This translation unit generates microdumps into the console (logcat on | 30 // This translation unit generates microdumps into the console (logcat on |
31 // Android). See crbug.com/410294 for more info and design docs. | 31 // Android). See crbug.com/410294 for more info and design docs. |
32 | 32 |
33 #include "client/linux/microdump_writer/microdump_writer.h" | 33 #include "client/linux/microdump_writer/microdump_writer.h" |
34 | 34 |
35 #include <sys/utsname.h> | 35 #include <sys/utsname.h> |
36 | 36 |
37 #include "client/linux/dump_writer_common/seccomp_unwinder.h" | |
38 #include "client/linux/dump_writer_common/thread_info.h" | 37 #include "client/linux/dump_writer_common/thread_info.h" |
39 #include "client/linux/dump_writer_common/ucontext_reader.h" | 38 #include "client/linux/dump_writer_common/ucontext_reader.h" |
40 #include "client/linux/handler/exception_handler.h" | 39 #include "client/linux/handler/exception_handler.h" |
41 #include "client/linux/log/log.h" | 40 #include "client/linux/log/log.h" |
42 #include "client/linux/minidump_writer/linux_ptrace_dumper.h" | 41 #include "client/linux/minidump_writer/linux_ptrace_dumper.h" |
43 #include "common/linux/linux_libc_support.h" | 42 #include "common/linux/linux_libc_support.h" |
44 | 43 |
45 namespace { | 44 namespace { |
46 | 45 |
47 using google_breakpad::ExceptionHandler; | 46 using google_breakpad::ExceptionHandler; |
48 using google_breakpad::LinuxDumper; | 47 using google_breakpad::LinuxDumper; |
49 using google_breakpad::LinuxPtraceDumper; | 48 using google_breakpad::LinuxPtraceDumper; |
50 using google_breakpad::MappingInfo; | 49 using google_breakpad::MappingInfo; |
51 using google_breakpad::MappingList; | 50 using google_breakpad::MappingList; |
52 using google_breakpad::RawContextCPU; | 51 using google_breakpad::RawContextCPU; |
53 using google_breakpad::SeccompUnwinder; | |
54 using google_breakpad::ThreadInfo; | 52 using google_breakpad::ThreadInfo; |
55 using google_breakpad::UContextReader; | 53 using google_breakpad::UContextReader; |
56 | 54 |
57 const size_t kLineBufferSize = 2048; | 55 const size_t kLineBufferSize = 2048; |
58 | 56 |
59 class MicrodumpWriter { | 57 class MicrodumpWriter { |
60 public: | 58 public: |
61 MicrodumpWriter(const ExceptionHandler::CrashContext* context, | 59 MicrodumpWriter(const ExceptionHandler::CrashContext* context, |
62 const MappingList& mappings, | 60 const MappingList& mappings, |
63 const char* build_fingerprint, | 61 const char* build_fingerprint, |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 if (!DumpThreadStack(thread.thread_id, stack_ptr, -1, &stack_copy)) | 278 if (!DumpThreadStack(thread.thread_id, stack_ptr, -1, &stack_copy)) |
281 return false; | 279 return false; |
282 | 280 |
283 RawContextCPU cpu; | 281 RawContextCPU cpu; |
284 my_memset(&cpu, 0, sizeof(RawContextCPU)); | 282 my_memset(&cpu, 0, sizeof(RawContextCPU)); |
285 #if !defined(__ARM_EABI__) && !defined(__mips__) | 283 #if !defined(__ARM_EABI__) && !defined(__mips__) |
286 UContextReader::FillCPUContext(&cpu, ucontext_, float_state_); | 284 UContextReader::FillCPUContext(&cpu, ucontext_, float_state_); |
287 #else | 285 #else |
288 UContextReader::FillCPUContext(&cpu, ucontext_); | 286 UContextReader::FillCPUContext(&cpu, ucontext_); |
289 #endif | 287 #endif |
290 if (stack_copy) | |
291 SeccompUnwinder::PopSeccompStackFrame(&cpu, thread, stack_copy); | |
292 DumpCPUState(&cpu); | 288 DumpCPUState(&cpu); |
293 } | 289 } |
294 return true; | 290 return true; |
295 } | 291 } |
296 | 292 |
297 void DumpCPUState(RawContextCPU* cpu) { | 293 void DumpCPUState(RawContextCPU* cpu) { |
298 LogAppend("C "); | 294 LogAppend("C "); |
299 LogAppend(cpu, sizeof(*cpu)); | 295 LogAppend(cpu, sizeof(*cpu)); |
300 LogCommitLine(); | 296 LogCommitLine(); |
301 } | 297 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 dumper.set_crash_thread(context->tid); | 416 dumper.set_crash_thread(context->tid); |
421 } | 417 } |
422 MicrodumpWriter writer(context, mappings, build_fingerprint, product_info, | 418 MicrodumpWriter writer(context, mappings, build_fingerprint, product_info, |
423 &dumper); | 419 &dumper); |
424 if (!writer.Init()) | 420 if (!writer.Init()) |
425 return false; | 421 return false; |
426 return writer.Dump(); | 422 return writer.Dump(); |
427 } | 423 } |
428 | 424 |
429 } // namespace google_breakpad | 425 } // namespace google_breakpad |
OLD | NEW |