| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COURGETTE_DISASSEMBLER_ELF_32_H_ | 5 #ifndef COURGETTE_DISASSEMBLER_ELF_32_H_ |
| 6 #define COURGETTE_DISASSEMBLER_ELF_32_H_ | 6 #define COURGETTE_DISASSEMBLER_ELF_32_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 bool UpdateLength(); | 94 bool UpdateLength(); |
| 95 | 95 |
| 96 // Misc Section Helpers | 96 // Misc Section Helpers |
| 97 | 97 |
| 98 Elf32_Half SectionHeaderCount() const { | 98 Elf32_Half SectionHeaderCount() const { |
| 99 return section_header_table_size_; | 99 return section_header_table_size_; |
| 100 } | 100 } |
| 101 | 101 |
| 102 const Elf32_Shdr* SectionHeader(Elf32_Half id) const { | 102 const Elf32_Shdr* SectionHeader(Elf32_Half id) const { |
| 103 assert(id >= 0 && id < SectionHeaderCount()); | 103 assert(id >= 0 && id < SectionHeaderCount()); |
| 104 return section_header_table_ + id; | 104 return §ion_header_table_[id]; |
| 105 } | 105 } |
| 106 | 106 |
| 107 const uint8_t* SectionBody(Elf32_Half id) const { | 107 const uint8_t* SectionBody(Elf32_Half id) const { |
| 108 return FileOffsetToPointer(SectionHeader(id)->sh_offset); | 108 return FileOffsetToPointer(SectionHeader(id)->sh_offset); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Misc Segment Helpers | 111 // Misc Segment Helpers |
| 112 | 112 |
| 113 Elf32_Half ProgramSegmentHeaderCount() const { | 113 Elf32_Half ProgramSegmentHeaderCount() const { |
| 114 return program_header_table_size_; | 114 return program_header_table_size_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 FileOffset end_file_offset, | 155 FileOffset end_file_offset, |
| 156 AssemblyProgram* program) WARN_UNUSED_RESULT; | 156 AssemblyProgram* program) WARN_UNUSED_RESULT; |
| 157 | 157 |
| 158 CheckBool ParseAbs32Relocs() WARN_UNUSED_RESULT; | 158 CheckBool ParseAbs32Relocs() WARN_UNUSED_RESULT; |
| 159 | 159 |
| 160 CheckBool CheckSection(RVA rva) WARN_UNUSED_RESULT; | 160 CheckBool CheckSection(RVA rva) WARN_UNUSED_RESULT; |
| 161 | 161 |
| 162 CheckBool ParseRel32RelocsFromSections() WARN_UNUSED_RESULT; | 162 CheckBool ParseRel32RelocsFromSections() WARN_UNUSED_RESULT; |
| 163 | 163 |
| 164 const Elf32_Ehdr* header_; | 164 const Elf32_Ehdr* header_; |
| 165 const Elf32_Shdr* section_header_table_; | 165 std::vector<Elf32_Shdr> section_header_table_; |
| 166 Elf32_Half section_header_table_size_; | 166 Elf32_Half section_header_table_size_; |
| 167 | 167 |
| 168 const Elf32_Phdr* program_header_table_; | 168 const Elf32_Phdr* program_header_table_; |
| 169 Elf32_Half program_header_table_size_; | 169 Elf32_Half program_header_table_size_; |
| 170 | 170 |
| 171 // Section header for default | 171 // Section header for default |
| 172 const char* default_string_section_; | 172 const char* default_string_section_; |
| 173 | 173 |
| 174 std::vector<RVA> abs32_locations_; | 174 std::vector<RVA> abs32_locations_; |
| 175 ScopedVector<TypedRVA> rel32_locations_; | 175 ScopedVector<TypedRVA> rel32_locations_; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32); | 177 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 } // namespace courgette | 180 } // namespace courgette |
| 181 | 181 |
| 182 #endif // COURGETTE_DISASSEMBLER_ELF_32_H_ | 182 #endif // COURGETTE_DISASSEMBLER_ELF_32_H_ |
| OLD | NEW |