| OLD | NEW |
| 1 // Copyright (c) 2012, Google Inc. | 1 // Copyright (c) 2012, 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 13 matching lines...) Expand all Loading... |
| 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> | 30 // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> |
| 31 | 31 |
| 32 // dwarf2reader_die_unittest.cc: Unit tests for dwarf2reader::CompilationUnit | 32 // dwarf2reader_die_unittest.cc: Unit tests for dwarf2reader::CompilationUnit |
| 33 | 33 |
| 34 #include <stdint.h> |
| 34 #include <stdlib.h> | 35 #include <stdlib.h> |
| 35 | 36 |
| 36 #include <iostream> | 37 #include <iostream> |
| 37 #include <string> | 38 #include <string> |
| 38 #include <vector> | 39 #include <vector> |
| 39 | 40 |
| 40 #include "breakpad_googletest_includes.h" | 41 #include "breakpad_googletest_includes.h" |
| 41 #include "common/dwarf/bytereader-inl.h" | 42 #include "common/dwarf/bytereader-inl.h" |
| 42 #include "common/dwarf/dwarf2reader_test_common.h" | 43 #include "common/dwarf/dwarf2reader_test_common.h" |
| 43 #include "common/dwarf/dwarf2reader.h" | 44 #include "common/dwarf/dwarf2reader.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 enum DwarfAttribute attr, | 85 enum DwarfAttribute attr, |
| 85 enum DwarfForm form, | 86 enum DwarfForm form, |
| 86 int64 data)); | 87 int64 data)); |
| 87 MOCK_METHOD4(ProcessAttributeReference, void(uint64 offset, | 88 MOCK_METHOD4(ProcessAttributeReference, void(uint64 offset, |
| 88 enum DwarfAttribute attr, | 89 enum DwarfAttribute attr, |
| 89 enum DwarfForm form, | 90 enum DwarfForm form, |
| 90 uint64 data)); | 91 uint64 data)); |
| 91 MOCK_METHOD5(ProcessAttributeBuffer, void(uint64 offset, | 92 MOCK_METHOD5(ProcessAttributeBuffer, void(uint64 offset, |
| 92 enum DwarfAttribute attr, | 93 enum DwarfAttribute attr, |
| 93 enum DwarfForm form, | 94 enum DwarfForm form, |
| 94 const char* data, | 95 const uint8_t *data, |
| 95 uint64 len)); | 96 uint64 len)); |
| 96 MOCK_METHOD4(ProcessAttributeString, void(uint64 offset, | 97 MOCK_METHOD4(ProcessAttributeString, void(uint64 offset, |
| 97 enum DwarfAttribute attr, | 98 enum DwarfAttribute attr, |
| 98 enum DwarfForm form, | 99 enum DwarfForm form, |
| 99 const string& data)); | 100 const string& data)); |
| 100 MOCK_METHOD4(ProcessAttributeSignature, void(uint64 offset, | 101 MOCK_METHOD4(ProcessAttributeSignature, void(uint64 offset, |
| 101 DwarfAttribute attr, | 102 DwarfAttribute attr, |
| 102 enum DwarfForm form, | 103 enum DwarfForm form, |
| 103 uint64 signature)); | 104 uint64 signature)); |
| 104 MOCK_METHOD1(EndDIE, void(uint64 offset)); | 105 MOCK_METHOD1(EndDIE, void(uint64 offset)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 125 // Return a reference to a section map whose .debug_info section refers | 126 // Return a reference to a section map whose .debug_info section refers |
| 126 // to |info|, and whose .debug_abbrev section refers to |abbrevs|. This | 127 // to |info|, and whose .debug_abbrev section refers to |abbrevs|. This |
| 127 // function returns a reference to the same SectionMap each time; new | 128 // function returns a reference to the same SectionMap each time; new |
| 128 // calls wipe out maps established by earlier calls. | 129 // calls wipe out maps established by earlier calls. |
| 129 const SectionMap &MakeSectionMap() { | 130 const SectionMap &MakeSectionMap() { |
| 130 // Copy the sections' contents into strings that will live as long as | 131 // Copy the sections' contents into strings that will live as long as |
| 131 // the map itself. | 132 // the map itself. |
| 132 assert(info.GetContents(&info_contents)); | 133 assert(info.GetContents(&info_contents)); |
| 133 assert(abbrevs.GetContents(&abbrevs_contents)); | 134 assert(abbrevs.GetContents(&abbrevs_contents)); |
| 134 section_map.clear(); | 135 section_map.clear(); |
| 135 section_map[".debug_info"].first = info_contents.data(); | 136 section_map[".debug_info"].first |
| 137 = reinterpret_cast<const uint8_t *>(info_contents.data()); |
| 136 section_map[".debug_info"].second = info_contents.size(); | 138 section_map[".debug_info"].second = info_contents.size(); |
| 137 section_map[".debug_abbrev"].first = abbrevs_contents.data(); | 139 section_map[".debug_abbrev"].first |
| 140 = reinterpret_cast<const uint8_t *>(abbrevs_contents.data()); |
| 138 section_map[".debug_abbrev"].second = abbrevs_contents.size(); | 141 section_map[".debug_abbrev"].second = abbrevs_contents.size(); |
| 139 return section_map; | 142 return section_map; |
| 140 } | 143 } |
| 141 | 144 |
| 142 TestCompilationUnit info; | 145 TestCompilationUnit info; |
| 143 TestAbbrevTable abbrevs; | 146 TestAbbrevTable abbrevs; |
| 144 MockDwarf2Handler handler; | 147 MockDwarf2Handler handler; |
| 145 string abbrevs_contents, info_contents; | 148 string abbrevs_contents, info_contents; |
| 146 SectionMap section_map; | 149 SectionMap section_map; |
| 147 }; | 150 }; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 DwarfHeaderParams(kBigEndian, 4, 3, 4), | 478 DwarfHeaderParams(kBigEndian, 4, 3, 4), |
| 476 DwarfHeaderParams(kBigEndian, 4, 3, 8), | 479 DwarfHeaderParams(kBigEndian, 4, 3, 8), |
| 477 DwarfHeaderParams(kBigEndian, 4, 4, 4), | 480 DwarfHeaderParams(kBigEndian, 4, 4, 4), |
| 478 DwarfHeaderParams(kBigEndian, 4, 4, 8), | 481 DwarfHeaderParams(kBigEndian, 4, 4, 8), |
| 479 DwarfHeaderParams(kBigEndian, 8, 2, 4), | 482 DwarfHeaderParams(kBigEndian, 8, 2, 4), |
| 480 DwarfHeaderParams(kBigEndian, 8, 2, 8), | 483 DwarfHeaderParams(kBigEndian, 8, 2, 8), |
| 481 DwarfHeaderParams(kBigEndian, 8, 3, 4), | 484 DwarfHeaderParams(kBigEndian, 8, 3, 4), |
| 482 DwarfHeaderParams(kBigEndian, 8, 3, 8), | 485 DwarfHeaderParams(kBigEndian, 8, 3, 8), |
| 483 DwarfHeaderParams(kBigEndian, 8, 4, 4), | 486 DwarfHeaderParams(kBigEndian, 8, 4, 4), |
| 484 DwarfHeaderParams(kBigEndian, 8, 4, 8))); | 487 DwarfHeaderParams(kBigEndian, 8, 4, 8))); |
| OLD | NEW |