| 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 25 matching lines...) Expand all Loading... |
| 36 #define __STDC_FORMAT_MACROS | 36 #define __STDC_FORMAT_MACROS |
| 37 #endif /* __STDC_FORMAT_MACROS */ | 37 #endif /* __STDC_FORMAT_MACROS */ |
| 38 | 38 |
| 39 #include "common/dwarf_cu_to_module.h" | 39 #include "common/dwarf_cu_to_module.h" |
| 40 | 40 |
| 41 #include <assert.h> | 41 #include <assert.h> |
| 42 #if !defined(__ANDROID__) | 42 #if !defined(__ANDROID__) |
| 43 #include <cxxabi.h> | 43 #include <cxxabi.h> |
| 44 #endif | 44 #endif |
| 45 #include <inttypes.h> | 45 #include <inttypes.h> |
| 46 #include <stdint.h> |
| 46 #include <stdio.h> | 47 #include <stdio.h> |
| 47 | 48 |
| 48 #include <algorithm> | 49 #include <algorithm> |
| 49 #include <utility> | 50 #include <utility> |
| 50 | 51 |
| 51 #include "common/dwarf_line_to_module.h" | 52 #include "common/dwarf_line_to_module.h" |
| 52 #include "common/unordered.h" | 53 #include "common/unordered.h" |
| 53 | 54 |
| 54 namespace google_breakpad { | 55 namespace google_breakpad { |
| 55 | 56 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 : filename_(filename), | 134 : filename_(filename), |
| 134 module_(module), | 135 module_(module), |
| 135 handle_inter_cu_refs_(handle_inter_cu_refs), | 136 handle_inter_cu_refs_(handle_inter_cu_refs), |
| 136 file_private_(new FilePrivate()) { | 137 file_private_(new FilePrivate()) { |
| 137 } | 138 } |
| 138 | 139 |
| 139 DwarfCUToModule::FileContext::~FileContext() { | 140 DwarfCUToModule::FileContext::~FileContext() { |
| 140 } | 141 } |
| 141 | 142 |
| 142 void DwarfCUToModule::FileContext::AddSectionToSectionMap( | 143 void DwarfCUToModule::FileContext::AddSectionToSectionMap( |
| 143 const string& name, const char* contents, uint64 length) { | 144 const string& name, const uint8_t *contents, uint64 length) { |
| 144 section_map_[name] = std::make_pair(contents, length); | 145 section_map_[name] = std::make_pair(contents, length); |
| 145 } | 146 } |
| 146 | 147 |
| 147 void DwarfCUToModule::FileContext::ClearSectionMapForTest() { | 148 void DwarfCUToModule::FileContext::ClearSectionMapForTest() { |
| 148 section_map_.clear(); | 149 section_map_.clear(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 const dwarf2reader::SectionMap& | 152 const dwarf2reader::SectionMap& |
| 152 DwarfCUToModule::FileContext::section_map() const { | 153 DwarfCUToModule::FileContext::section_map() const { |
| 153 return section_map_; | 154 return section_map_; |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 dwarf2reader::SectionMap::const_iterator map_entry | 808 dwarf2reader::SectionMap::const_iterator map_entry |
| 808 = section_map.find(".debug_line"); | 809 = section_map.find(".debug_line"); |
| 809 // Mac OS X puts DWARF data in sections whose names begin with "__" | 810 // Mac OS X puts DWARF data in sections whose names begin with "__" |
| 810 // instead of ".". | 811 // instead of ".". |
| 811 if (map_entry == section_map.end()) | 812 if (map_entry == section_map.end()) |
| 812 map_entry = section_map.find("__debug_line"); | 813 map_entry = section_map.find("__debug_line"); |
| 813 if (map_entry == section_map.end()) { | 814 if (map_entry == section_map.end()) { |
| 814 cu_context_->reporter->MissingSection(".debug_line"); | 815 cu_context_->reporter->MissingSection(".debug_line"); |
| 815 return; | 816 return; |
| 816 } | 817 } |
| 817 const char *section_start = map_entry->second.first; | 818 const uint8_t *section_start = map_entry->second.first; |
| 818 uint64 section_length = map_entry->second.second; | 819 uint64 section_length = map_entry->second.second; |
| 819 if (offset >= section_length) { | 820 if (offset >= section_length) { |
| 820 cu_context_->reporter->BadLineInfoOffset(offset); | 821 cu_context_->reporter->BadLineInfoOffset(offset); |
| 821 return; | 822 return; |
| 822 } | 823 } |
| 823 line_reader_->ReadProgram(section_start + offset, section_length - offset, | 824 line_reader_->ReadProgram(section_start + offset, section_length - offset, |
| 824 cu_context_->file_context->module_, &lines_); | 825 cu_context_->file_context->module_, &lines_); |
| 825 } | 826 } |
| 826 | 827 |
| 827 namespace { | 828 namespace { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 return dwarf_version >= 2; | 1065 return dwarf_version >= 2; |
| 1065 } | 1066 } |
| 1066 | 1067 |
| 1067 bool DwarfCUToModule::StartRootDIE(uint64 offset, enum DwarfTag tag) { | 1068 bool DwarfCUToModule::StartRootDIE(uint64 offset, enum DwarfTag tag) { |
| 1068 // We don't deal with partial compilation units (the only other tag | 1069 // We don't deal with partial compilation units (the only other tag |
| 1069 // likely to be used for root DIE). | 1070 // likely to be used for root DIE). |
| 1070 return tag == dwarf2reader::DW_TAG_compile_unit; | 1071 return tag == dwarf2reader::DW_TAG_compile_unit; |
| 1071 } | 1072 } |
| 1072 | 1073 |
| 1073 } // namespace google_breakpad | 1074 } // namespace google_breakpad |
| OLD | NEW |