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

Side by Side Diff: courgette/disassembler_elf_32.h

Issue 1658463002: [Courgette] Fix AssemblyProgram parsing for ELF-ARM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused DisassemblerElf32 accessors. Created 4 years, 10 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 | « no previous file | courgette/disassembler_elf_32.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 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 const Elf32_Shdr *SectionHeader(int id) const { 110 const Elf32_Shdr *SectionHeader(int id) const {
111 assert(id >= 0 && id < SectionHeaderCount()); 111 assert(id >= 0 && id < SectionHeaderCount());
112 return section_header_table_ + id; 112 return section_header_table_ + id;
113 } 113 }
114 114
115 const uint8_t* SectionBody(int id) const { 115 const uint8_t* SectionBody(int id) const {
116 return OffsetToPointer(SectionHeader(id)->sh_offset); 116 return OffsetToPointer(SectionHeader(id)->sh_offset);
117 } 117 }
118 118
119 Elf32_Word SectionBodySize(int id) const {
120 return SectionHeader(id)->sh_size;
121 }
122
123 // Misc Segment Helpers 119 // Misc Segment Helpers
124 120
125 Elf32_Half ProgramSegmentHeaderCount() const { 121 Elf32_Half ProgramSegmentHeaderCount() const {
126 return program_header_table_size_; 122 return program_header_table_size_;
127 } 123 }
128 124
129 const Elf32_Phdr *ProgramSegmentHeader(int id) const { 125 const Elf32_Phdr *ProgramSegmentHeader(int id) const {
130 assert(id >= 0 && id < ProgramSegmentHeaderCount()); 126 assert(id >= 0 && id < ProgramSegmentHeaderCount());
131 return program_header_table_ + id; 127 return program_header_table_ + id;
132 } 128 }
133 129
134 // The virtual memory address at which this program segment will be loaded
135 Elf32_Addr ProgramSegmentMemoryBegin(int id) const {
136 return ProgramSegmentHeader(id)->p_vaddr;
137 }
138
139 // The number of virtual memory bytes for this program segment
140 Elf32_Word ProgramSegmentMemorySize(int id) const {
141 return ProgramSegmentHeader(id)->p_memsz;
142 }
143
144 // Pointer into the source file for this program segment
145 Elf32_Addr ProgramSegmentFileOffset(int id) const {
146 return ProgramSegmentHeader(id)->p_offset;
147 }
148
149 // Number of file bytes for this program segment. Is <= ProgramMemorySize.
150 Elf32_Word ProgramSegmentFileSize(int id) const {
151 return ProgramSegmentHeader(id)->p_filesz;
152 }
153
154 // Misc address space helpers 130 // Misc address space helpers
155 131
156 CheckBool IsValidRVA(RVA rva) const WARN_UNUSED_RESULT; 132 CheckBool IsValidRVA(RVA rva) const WARN_UNUSED_RESULT;
157 133
158 // Convert an ELF relocation struction into an RVA 134 // Convert an ELF relocation struction into an RVA
159 virtual CheckBool RelToRVA(Elf32_Rel rel, RVA* result) 135 virtual CheckBool RelToRVA(Elf32_Rel rel, RVA* result)
160 const WARN_UNUSED_RESULT = 0; 136 const WARN_UNUSED_RESULT = 0;
161 137
162 // Returns kNoOffset if there is no file offset corresponding to 'rva'. 138 // Returns kNoOffset if there is no file offset corresponding to 'rva'.
163 CheckBool RVAToFileOffset(RVA rva, size_t* result) const WARN_UNUSED_RESULT; 139 CheckBool RVAToFileOffset(RVA rva, size_t* result) const WARN_UNUSED_RESULT;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 180
205 std::vector<RVA> abs32_locations_; 181 std::vector<RVA> abs32_locations_;
206 ScopedVector<TypedRVA> rel32_locations_; 182 ScopedVector<TypedRVA> rel32_locations_;
207 183
208 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32); 184 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32);
209 }; 185 };
210 186
211 } // namespace courgette 187 } // namespace courgette
212 188
213 #endif // COURGETTE_DISASSEMBLER_ELF_32_H_ 189 #endif // COURGETTE_DISASSEMBLER_ELF_32_H_
OLDNEW
« no previous file with comments | « no previous file | courgette/disassembler_elf_32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698