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

Side by Side Diff: courgette/disassembler.h

Issue 2583373002: [Courgette] Simple AssemblyProgram and Disassembler cleanups. (Closed)
Patch Set: Tune up header inclusion. Created 3 years, 11 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 | « courgette/assembly_program.cc ('k') | courgette/disassembler_elf_32.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_H_ 5 #ifndef COURGETTE_DISASSEMBLER_H_
6 #define COURGETTE_DISASSEMBLER_H_ 6 #define COURGETTE_DISASSEMBLER_H_
7 7
8 #include <stddef.h>
9 #include <stdint.h> 8 #include <stdint.h>
10 9
11 #include <vector> 10 #include <vector>
12 11
13 #include "base/macros.h" 12 #include "base/macros.h"
14 #include "courgette/courgette.h" 13 #include "courgette/courgette.h"
15 #include "courgette/image_utils.h" 14 #include "courgette/image_utils.h"
16 15
17 namespace courgette { 16 namespace courgette {
18 17
(...skipping 29 matching lines...) Expand all
48 47
49 private: 48 private:
50 const AddressTranslator& translator_; 49 const AddressTranslator& translator_;
51 50
52 DISALLOW_COPY_AND_ASSIGN(RvaVisitor_Rel32); 51 DISALLOW_COPY_AND_ASSIGN(RvaVisitor_Rel32);
53 }; 52 };
54 53
55 virtual ~Disassembler(); 54 virtual ~Disassembler();
56 55
57 // AddressTranslator interfaces. 56 // AddressTranslator interfaces.
58 virtual RVA FileOffsetToRVA(FileOffset file_offset) const override = 0; 57 RVA FileOffsetToRVA(FileOffset file_offset) const override = 0;
59 virtual FileOffset RVAToFileOffset(RVA rva) const override = 0; 58 FileOffset RVAToFileOffset(RVA rva) const override = 0;
60 const uint8_t* FileOffsetToPointer(FileOffset file_offset) const override; 59 const uint8_t* FileOffsetToPointer(FileOffset file_offset) const override;
61 const uint8_t* RVAToPointer(RVA rva) const override; 60 const uint8_t* RVAToPointer(RVA rva) const override;
62 RVA PointerToTargetRVA(const uint8_t* p) const = 0; 61 RVA PointerToTargetRVA(const uint8_t* p) const override = 0;
63 62
64 virtual ExecutableType kind() const = 0; 63 virtual ExecutableType kind() const = 0;
65 64
65 // Returns the preferred image base address. Using uint64_t to accommodate the
66 // general case of 64-bit architectures.
67 virtual uint64_t image_base() const = 0;
68
66 // Returns a caller-owned new RvaVisitor to iterate through abs32 target RVAs. 69 // Returns a caller-owned new RvaVisitor to iterate through abs32 target RVAs.
67 virtual RvaVisitor* CreateAbs32TargetRvaVisitor() = 0; 70 virtual RvaVisitor* CreateAbs32TargetRvaVisitor() = 0;
68 71
69 // Returns a caller-owned new RvaVisitor to iterate through rel32 target RVAs. 72 // Returns a caller-owned new RvaVisitor to iterate through rel32 target RVAs.
70 virtual RvaVisitor* CreateRel32TargetRvaVisitor() = 0; 73 virtual RvaVisitor* CreateRel32TargetRvaVisitor() = 0;
71 74
72 // Removes unused rel32 locations (architecture-specific). This is needed 75 // Removes unused rel32 locations (architecture-specific). This is needed
73 // because we may remove rel32 Labels along the way. As a result the matching 76 // because we may remove rel32 Labels along the way. As a result the matching
74 // matching rel32 addresses become unused. Removing them saves space. 77 // matching rel32 addresses become unused. Removing them saves space.
75 virtual void RemoveUnusedRel32Locations(AssemblyProgram* program) = 0; 78 virtual void RemoveUnusedRel32Locations(AssemblyProgram* program) = 0;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 size_t length_; // In current memory. 123 size_t length_; // In current memory.
121 const uint8_t* start_; // In current memory, base for 'file offsets'. 124 const uint8_t* start_; // In current memory, base for 'file offsets'.
122 const uint8_t* end_; // In current memory. 125 const uint8_t* end_; // In current memory.
123 126
124 DISALLOW_COPY_AND_ASSIGN(Disassembler); 127 DISALLOW_COPY_AND_ASSIGN(Disassembler);
125 }; 128 };
126 129
127 } // namespace courgette 130 } // namespace courgette
128 131
129 #endif // COURGETTE_DISASSEMBLER_H_ 132 #endif // COURGETTE_DISASSEMBLER_H_
OLDNEW
« no previous file with comments | « courgette/assembly_program.cc ('k') | courgette/disassembler_elf_32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698