Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: src/processor/minidump.cc

Issue 2060663002: Server-side workaround to handle overlapping modules. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Fix whitespace. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/processor/microdump_processor_unittest.cc ('k') | src/processor/minidump_processor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 // Mac OS X and Linux, instead of forcing them to adhere to the dotted 2102 // Mac OS X and Linux, instead of forcing them to adhere to the dotted
2103 // quad of 16-bit ints that Windows uses. 2103 // quad of 16-bit ints that Windows uses.
2104 2104
2105 BPLOG_IF(INFO, version.empty()) << "MinidumpModule could not determine " 2105 BPLOG_IF(INFO, version.empty()) << "MinidumpModule could not determine "
2106 "version for " << *name_; 2106 "version for " << *name_;
2107 2107
2108 return version; 2108 return version;
2109 } 2109 }
2110 2110
2111 2111
2112 const CodeModule* MinidumpModule::Copy() const { 2112 CodeModule* MinidumpModule::Copy() const {
2113 return new BasicCodeModule(this); 2113 return new BasicCodeModule(this);
2114 } 2114 }
2115 2115
2116 2116
2117 uint64_t MinidumpModule::shrink_down_delta() const {
2118 return 0;
2119 }
2120
2121 void MinidumpModule::SetShrinkDownDelta(uint64_t shrink_down_delta) {
2122 // Not implemented
2123 assert(false);
2124 }
2125
2126
2117 const uint8_t* MinidumpModule::GetCVRecord(uint32_t* size) { 2127 const uint8_t* MinidumpModule::GetCVRecord(uint32_t* size) {
2118 if (!module_valid_) { 2128 if (!module_valid_) {
2119 BPLOG(ERROR) << "Invalid MinidumpModule for GetCVRecord"; 2129 BPLOG(ERROR) << "Invalid MinidumpModule for GetCVRecord";
2120 return NULL; 2130 return NULL;
2121 } 2131 }
2122 2132
2123 if (!cv_record_) { 2133 if (!cv_record_) {
2124 // This just guards against 0-sized CodeView records; more specific checks 2134 // This just guards against 0-sized CodeView records; more specific checks
2125 // are used when the signature is checked against various structure types. 2135 // are used when the signature is checked against various structure types.
2126 if (module_.cv_record.data_size == 0) { 2136 if (module_.cv_record.data_size == 0) {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 2500
2491 2501
2492 uint32_t MinidumpModuleList::max_modules_ = 1024; 2502 uint32_t MinidumpModuleList::max_modules_ = 1024;
2493 2503
2494 2504
2495 MinidumpModuleList::MinidumpModuleList(Minidump* minidump) 2505 MinidumpModuleList::MinidumpModuleList(Minidump* minidump)
2496 : MinidumpStream(minidump), 2506 : MinidumpStream(minidump),
2497 range_map_(new RangeMap<uint64_t, unsigned int>()), 2507 range_map_(new RangeMap<uint64_t, unsigned int>()),
2498 modules_(NULL), 2508 modules_(NULL),
2499 module_count_(0) { 2509 module_count_(0) {
2510 range_map_->SetEnableShrinkDown(minidump_->IsAndroid());
2500 } 2511 }
2501 2512
2502 2513
2503 MinidumpModuleList::~MinidumpModuleList() { 2514 MinidumpModuleList::~MinidumpModuleList() {
2504 delete range_map_; 2515 delete range_map_;
2505 delete modules_; 2516 delete modules_;
2506 } 2517 }
2507 2518
2508 2519
2509 bool MinidumpModuleList::Read(uint32_t expected_size) { 2520 bool MinidumpModuleList::Read(uint32_t expected_size) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2702 return NULL; 2713 return NULL;
2703 } 2714 }
2704 2715
2705 if (sequence >= module_count_) { 2716 if (sequence >= module_count_) {
2706 BPLOG(ERROR) << "MinidumpModuleList sequence out of range: " << 2717 BPLOG(ERROR) << "MinidumpModuleList sequence out of range: " <<
2707 sequence << "/" << module_count_; 2718 sequence << "/" << module_count_;
2708 return NULL; 2719 return NULL;
2709 } 2720 }
2710 2721
2711 unsigned int module_index; 2722 unsigned int module_index;
2712 if (!range_map_->RetrieveRangeAtIndex(sequence, &module_index, 2723 if (!range_map_->RetrieveRangeAtIndex(sequence, &module_index,
2713 NULL /* base */, NULL /* delta */, 2724 NULL /* base */, NULL /* delta */,
2714 NULL /* size */)) { 2725 NULL /* size */)) {
2715 BPLOG(ERROR) << "MinidumpModuleList has no module at sequence " << sequence; 2726 BPLOG(ERROR) << "MinidumpModuleList has no module at sequence " << sequence;
2716 return NULL; 2727 return NULL;
2717 } 2728 }
2718 2729
2719 return GetModuleAtIndex(module_index); 2730 return GetModuleAtIndex(module_index);
2720 } 2731 }
2721 2732
2722 2733
(...skipping 11 matching lines...) Expand all
2734 } 2745 }
2735 2746
2736 return &(*modules_)[index]; 2747 return &(*modules_)[index];
2737 } 2748 }
2738 2749
2739 2750
2740 const CodeModules* MinidumpModuleList::Copy() const { 2751 const CodeModules* MinidumpModuleList::Copy() const {
2741 return new BasicCodeModules(this); 2752 return new BasicCodeModules(this);
2742 } 2753 }
2743 2754
2755 vector<linked_ptr<const CodeModule> >
2756 MinidumpModuleList::GetShrunkRangeModules() const {
2757 return vector<linked_ptr<const CodeModule> >();
2758 }
2759
2760 bool MinidumpModuleList::IsModuleShrinkEnabled() const {
2761 return range_map_->IsShrinkDownEnabled();
2762 }
2744 2763
2745 void MinidumpModuleList::Print() { 2764 void MinidumpModuleList::Print() {
2746 if (!valid_) { 2765 if (!valid_) {
2747 BPLOG(ERROR) << "MinidumpModuleList cannot print invalid data"; 2766 BPLOG(ERROR) << "MinidumpModuleList cannot print invalid data";
2748 return; 2767 return;
2749 } 2768 }
2750 2769
2751 printf("MinidumpModuleList\n"); 2770 printf("MinidumpModuleList\n");
2752 printf(" module_count = %d\n", module_count_); 2771 printf(" module_count = %d\n", module_count_);
2753 printf("\n"); 2772 printf("\n");
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
4525 MinidumpMemoryInfoList* Minidump::GetMemoryInfoList() { 4544 MinidumpMemoryInfoList* Minidump::GetMemoryInfoList() {
4526 MinidumpMemoryInfoList* memory_info_list; 4545 MinidumpMemoryInfoList* memory_info_list;
4527 return GetStream(&memory_info_list); 4546 return GetStream(&memory_info_list);
4528 } 4547 }
4529 4548
4530 MinidumpLinuxMapsList *Minidump::GetLinuxMapsList() { 4549 MinidumpLinuxMapsList *Minidump::GetLinuxMapsList() {
4531 MinidumpLinuxMapsList *linux_maps_list; 4550 MinidumpLinuxMapsList *linux_maps_list;
4532 return GetStream(&linux_maps_list); 4551 return GetStream(&linux_maps_list);
4533 } 4552 }
4534 4553
4554 bool Minidump::IsAndroid() {
4555 // Save the current stream position
4556 off_t saved_position = Tell();
4557 if (saved_position == -1) {
4558 return false;
4559 }
4560 const MDRawSystemInfo* system_info =
4561 GetSystemInfo() ? GetSystemInfo()->system_info() : NULL;
4562
4563 // Restore position and return
4564 if (!SeekSet(saved_position)) {
4565 BPLOG(ERROR) << "Couldn't seek back to saved position";
4566 return false;
4567 }
4568
4569 return system_info && system_info->platform_id == MD_OS_ANDROID;
4570 }
4571
4535 static const char* get_stream_name(uint32_t stream_type) { 4572 static const char* get_stream_name(uint32_t stream_type) {
4536 switch (stream_type) { 4573 switch (stream_type) {
4537 case MD_UNUSED_STREAM: 4574 case MD_UNUSED_STREAM:
4538 return "MD_UNUSED_STREAM"; 4575 return "MD_UNUSED_STREAM";
4539 case MD_RESERVED_STREAM_0: 4576 case MD_RESERVED_STREAM_0:
4540 return "MD_RESERVED_STREAM_0"; 4577 return "MD_RESERVED_STREAM_0";
4541 case MD_RESERVED_STREAM_1: 4578 case MD_RESERVED_STREAM_1:
4542 return "MD_RESERVED_STREAM_1"; 4579 return "MD_RESERVED_STREAM_1";
4543 case MD_THREAD_LIST_STREAM: 4580 case MD_THREAD_LIST_STREAM:
4544 return "MD_THREAD_LIST_STREAM"; 4581 return "MD_THREAD_LIST_STREAM";
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
4638 directory_entry->location.data_size); 4675 directory_entry->location.data_size);
4639 printf(" location.rva = 0x%x\n", directory_entry->location.rva); 4676 printf(" location.rva = 0x%x\n", directory_entry->location.rva);
4640 printf("\n"); 4677 printf("\n");
4641 } 4678 }
4642 4679
4643 printf("Streams:\n"); 4680 printf("Streams:\n");
4644 for (MinidumpStreamMap::const_iterator iterator = stream_map_->begin(); 4681 for (MinidumpStreamMap::const_iterator iterator = stream_map_->begin();
4645 iterator != stream_map_->end(); 4682 iterator != stream_map_->end();
4646 ++iterator) { 4683 ++iterator) {
4647 uint32_t stream_type = iterator->first; 4684 uint32_t stream_type = iterator->first;
4648 MinidumpStreamInfo info = iterator->second; 4685 const MinidumpStreamInfo& info = iterator->second;
4649 printf(" stream type 0x%x (%s) at index %d\n", stream_type, 4686 printf(" stream type 0x%x (%s) at index %d\n", stream_type,
4650 get_stream_name(stream_type), 4687 get_stream_name(stream_type),
4651 info.stream_index); 4688 info.stream_index);
4652 } 4689 }
4653 printf("\n"); 4690 printf("\n");
4654 } 4691 }
4655 4692
4656 4693
4657 const MDRawDirectory* Minidump::GetDirectoryEntryAtIndex(unsigned int index) 4694 const MDRawDirectory* Minidump::GetDirectoryEntryAtIndex(unsigned int index)
4658 const { 4695 const {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
4795 return false; 4832 return false;
4796 } 4833 }
4797 4834
4798 MinidumpStreamMap::const_iterator iterator = stream_map_->find(stream_type); 4835 MinidumpStreamMap::const_iterator iterator = stream_map_->find(stream_type);
4799 if (iterator == stream_map_->end()) { 4836 if (iterator == stream_map_->end()) {
4800 // This stream type didn't exist in the directory. 4837 // This stream type didn't exist in the directory.
4801 BPLOG(INFO) << "SeekToStreamType: type " << stream_type << " not present"; 4838 BPLOG(INFO) << "SeekToStreamType: type " << stream_type << " not present";
4802 return false; 4839 return false;
4803 } 4840 }
4804 4841
4805 MinidumpStreamInfo info = iterator->second; 4842 const MinidumpStreamInfo& info = iterator->second;
4806 if (info.stream_index >= header_.stream_count) { 4843 if (info.stream_index >= header_.stream_count) {
4807 BPLOG(ERROR) << "SeekToStreamType: type " << stream_type << 4844 BPLOG(ERROR) << "SeekToStreamType: type " << stream_type <<
4808 " out of range: " << 4845 " out of range: " <<
4809 info.stream_index << "/" << header_.stream_count; 4846 info.stream_index << "/" << header_.stream_count;
4810 return false; 4847 return false;
4811 } 4848 }
4812 4849
4813 MDRawDirectory* directory_entry = &(*directory_)[info.stream_index]; 4850 MDRawDirectory* directory_entry = &(*directory_)[info.stream_index];
4814 if (!SeekSet(directory_entry->location.rva)) { 4851 if (!SeekSet(directory_entry->location.rva)) {
4815 BPLOG(ERROR) << "SeekToStreamType could not seek to stream type " << 4852 BPLOG(ERROR) << "SeekToStreamType could not seek to stream type " <<
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4870 return NULL; 4907 return NULL;
4871 } 4908 }
4872 4909
4873 *stream = new_stream.release(); 4910 *stream = new_stream.release();
4874 info->stream = *stream; 4911 info->stream = *stream;
4875 return *stream; 4912 return *stream;
4876 } 4913 }
4877 4914
4878 4915
4879 } // namespace google_breakpad 4916 } // namespace google_breakpad
OLDNEW
« no previous file with comments | « src/processor/microdump_processor_unittest.cc ('k') | src/processor/minidump_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698