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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 #include "client/linux/dump_writer_common/thread_info.h" | 67 #include "client/linux/dump_writer_common/thread_info.h" |
68 #include "client/linux/dump_writer_common/ucontext_reader.h" | 68 #include "client/linux/dump_writer_common/ucontext_reader.h" |
69 #include "client/linux/handler/exception_handler.h" | 69 #include "client/linux/handler/exception_handler.h" |
70 #include "client/linux/minidump_writer/cpu_set.h" | 70 #include "client/linux/minidump_writer/cpu_set.h" |
71 #include "client/linux/minidump_writer/line_reader.h" | 71 #include "client/linux/minidump_writer/line_reader.h" |
72 #include "client/linux/minidump_writer/linux_dumper.h" | 72 #include "client/linux/minidump_writer/linux_dumper.h" |
73 #include "client/linux/minidump_writer/linux_ptrace_dumper.h" | 73 #include "client/linux/minidump_writer/linux_ptrace_dumper.h" |
74 #include "client/linux/minidump_writer/proc_cpuinfo_reader.h" | 74 #include "client/linux/minidump_writer/proc_cpuinfo_reader.h" |
75 #include "client/minidump_file_writer.h" | 75 #include "client/minidump_file_writer.h" |
| 76 #include "common/linux/file_id.h" |
76 #include "common/linux/linux_libc_support.h" | 77 #include "common/linux/linux_libc_support.h" |
77 #include "common/minidump_type_helper.h" | 78 #include "common/minidump_type_helper.h" |
78 #include "google_breakpad/common/minidump_format.h" | 79 #include "google_breakpad/common/minidump_format.h" |
79 #include "third_party/lss/linux_syscall_support.h" | 80 #include "third_party/lss/linux_syscall_support.h" |
80 | 81 |
81 namespace { | 82 namespace { |
82 | 83 |
83 using google_breakpad::AppMemoryList; | 84 using google_breakpad::AppMemoryList; |
84 using google_breakpad::ExceptionHandler; | 85 using google_breakpad::ExceptionHandler; |
85 using google_breakpad::CpuSet; | 86 using google_breakpad::CpuSet; |
| 87 using google_breakpad::kMaxBuildID; |
86 using google_breakpad::LineReader; | 88 using google_breakpad::LineReader; |
87 using google_breakpad::LinuxDumper; | 89 using google_breakpad::LinuxDumper; |
88 using google_breakpad::LinuxPtraceDumper; | 90 using google_breakpad::LinuxPtraceDumper; |
89 using google_breakpad::MDTypeHelper; | 91 using google_breakpad::MDTypeHelper; |
90 using google_breakpad::MappingEntry; | 92 using google_breakpad::MappingEntry; |
91 using google_breakpad::MappingInfo; | 93 using google_breakpad::MappingInfo; |
92 using google_breakpad::MappingList; | 94 using google_breakpad::MappingList; |
93 using google_breakpad::MinidumpFileWriter; | 95 using google_breakpad::MinidumpFileWriter; |
94 using google_breakpad::PageAllocator; | 96 using google_breakpad::PageAllocator; |
95 using google_breakpad::ProcCpuInfoReader; | 97 using google_breakpad::ProcCpuInfoReader; |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 bool FillRawModule(const MappingInfo& mapping, | 534 bool FillRawModule(const MappingInfo& mapping, |
533 bool member, | 535 bool member, |
534 unsigned int mapping_id, | 536 unsigned int mapping_id, |
535 MDRawModule* mod, | 537 MDRawModule* mod, |
536 const uint8_t* identifier) { | 538 const uint8_t* identifier) { |
537 my_memset(mod, 0, MD_MODULE_SIZE); | 539 my_memset(mod, 0, MD_MODULE_SIZE); |
538 | 540 |
539 mod->base_of_image = mapping.start_addr; | 541 mod->base_of_image = mapping.start_addr; |
540 mod->size_of_image = mapping.size; | 542 mod->size_of_image = mapping.size; |
541 | 543 |
542 uint8_t cv_buf[MDCVInfoPDB70_minsize + NAME_MAX]; | 544 uint8_t cv_buf[MDCVInfoELF_minsize + kMaxBuildID]; |
543 uint8_t* cv_ptr = cv_buf; | 545 uint8_t* cv_ptr = cv_buf; |
544 | 546 |
545 const uint32_t cv_signature = MD_CVINFOPDB70_SIGNATURE; | 547 const uint32_t cv_signature = MD_CVINFOELF_SIGNATURE; |
546 my_memcpy(cv_ptr, &cv_signature, sizeof(cv_signature)); | 548 my_memcpy(cv_ptr, &cv_signature, sizeof(cv_signature)); |
547 cv_ptr += sizeof(cv_signature); | 549 cv_ptr += sizeof(cv_signature); |
548 uint8_t* signature = cv_ptr; | 550 uint8_t* signature = cv_ptr; |
549 cv_ptr += sizeof(MDGUID); | 551 size_t signature_length = 0; |
550 if (identifier) { | 552 if (identifier) { |
551 // GUID was provided by caller. | 553 // GUID was provided by caller. |
552 my_memcpy(signature, identifier, sizeof(MDGUID)); | 554 my_memcpy(signature, identifier, sizeof(MDGUID)); |
| 555 signature_length = sizeof(MDGUID); |
553 } else { | 556 } else { |
554 // Note: ElfFileIdentifierForMapping() can manipulate the |mapping.name|. | 557 // Note: ElfFileIdentifierForMapping() can manipulate the |mapping.name|. |
555 dumper_->ElfFileIdentifierForMapping(mapping, member, | 558 dumper_->ElfFileIdentifierForMapping(mapping, |
556 mapping_id, signature); | 559 member, |
| 560 mapping_id, |
| 561 signature, |
| 562 &signature_length); |
557 } | 563 } |
558 my_memset(cv_ptr, 0, sizeof(uint32_t)); // Set age to 0 on Linux. | 564 UntypedMDRVA cv(&minidump_writer_); |
559 cv_ptr += sizeof(uint32_t); | 565 if (!cv.Allocate(MDCVInfoELF_minsize + signature_length)) |
| 566 return false; |
| 567 |
| 568 cv.Copy(cv_buf, MDCVInfoELF_minsize + signature_length); |
| 569 |
| 570 mod->cv_record = cv.location(); |
560 | 571 |
561 char file_name[NAME_MAX]; | 572 char file_name[NAME_MAX]; |
562 char file_path[NAME_MAX]; | 573 char file_path[NAME_MAX]; |
563 LinuxDumper::GetMappingEffectiveNameAndPath( | 574 LinuxDumper::GetMappingEffectiveNameAndPath( |
564 mapping, file_path, sizeof(file_path), file_name, sizeof(file_name)); | 575 mapping, file_path, sizeof(file_path), file_name, sizeof(file_name)); |
565 | 576 |
566 const size_t file_name_len = my_strlen(file_name); | |
567 UntypedMDRVA cv(&minidump_writer_); | |
568 if (!cv.Allocate(MDCVInfoPDB70_minsize + file_name_len + 1)) | |
569 return false; | |
570 | |
571 // Write pdb_file_name | |
572 my_memcpy(cv_ptr, file_name, file_name_len + 1); | |
573 cv.Copy(cv_buf, MDCVInfoPDB70_minsize + file_name_len + 1); | |
574 | |
575 mod->cv_record = cv.location(); | |
576 | |
577 MDLocationDescriptor ld; | 577 MDLocationDescriptor ld; |
578 if (!minidump_writer_.WriteString(file_path, my_strlen(file_path), &ld)) | 578 if (!minidump_writer_.WriteString(file_path, my_strlen(file_path), &ld)) |
579 return false; | 579 return false; |
580 mod->module_name_rva = ld.rva; | 580 mod->module_name_rva = ld.rva; |
581 return true; | 581 return true; |
582 } | 582 } |
583 | 583 |
584 bool WriteMemoryListStream(MDRawDirectory* dirent) { | 584 bool WriteMemoryListStream(MDRawDirectory* dirent) { |
585 TypedMDRVA<uint32_t> list(&minidump_writer_); | 585 TypedMDRVA<uint32_t> list(&minidump_writer_); |
586 if (memory_blocks_.size()) { | 586 if (memory_blocks_.size()) { |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 const MappingList& mappings, | 1351 const MappingList& mappings, |
1352 const AppMemoryList& appmem, | 1352 const AppMemoryList& appmem, |
1353 LinuxDumper* dumper) { | 1353 LinuxDumper* dumper) { |
1354 MinidumpWriter writer(filename, -1, NULL, mappings, appmem, dumper); | 1354 MinidumpWriter writer(filename, -1, NULL, mappings, appmem, dumper); |
1355 if (!writer.Init()) | 1355 if (!writer.Init()) |
1356 return false; | 1356 return false; |
1357 return writer.Dump(); | 1357 return writer.Dump(); |
1358 } | 1358 } |
1359 | 1359 |
1360 } // namespace google_breakpad | 1360 } // namespace google_breakpad |
OLD | NEW |