OLD | NEW |
---|---|
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> | 8 #include <stddef.h> |
grt (UTC plus 2)
2017/01/12 11:56:41
is this needed here and elsewhere?
huangs
2017/01/12 19:54:42
<stddef.h> for nullptr.
<stdint.h> for uint8_t, et
grt (UTC plus 2)
2017/01/13 08:27:33
nullptr is a keyword, so no headers are needed for
huangs
2017/01/13 16:44:54
Ah okay. Removed.
| |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "courgette/courgette.h" | 14 #include "courgette/courgette.h" |
15 #include "courgette/image_utils.h" | 15 #include "courgette/image_utils.h" |
16 | 16 |
17 namespace courgette { | 17 namespace courgette { |
18 | 18 |
(...skipping 29 matching lines...) Expand all Loading... | |
48 | 48 |
49 private: | 49 private: |
50 const AddressTranslator& translator_; | 50 const AddressTranslator& translator_; |
51 | 51 |
52 DISALLOW_COPY_AND_ASSIGN(RvaVisitor_Rel32); | 52 DISALLOW_COPY_AND_ASSIGN(RvaVisitor_Rel32); |
53 }; | 53 }; |
54 | 54 |
55 virtual ~Disassembler(); | 55 virtual ~Disassembler(); |
56 | 56 |
57 // AddressTranslator interfaces. | 57 // AddressTranslator interfaces. |
58 virtual RVA FileOffsetToRVA(FileOffset file_offset) const override = 0; | 58 RVA FileOffsetToRVA(FileOffset file_offset) const override = 0; |
59 virtual FileOffset RVAToFileOffset(RVA rva) const override = 0; | 59 FileOffset RVAToFileOffset(RVA rva) const override = 0; |
60 const uint8_t* FileOffsetToPointer(FileOffset file_offset) const override; | 60 const uint8_t* FileOffsetToPointer(FileOffset file_offset) const override; |
61 const uint8_t* RVAToPointer(RVA rva) const override; | 61 const uint8_t* RVAToPointer(RVA rva) const override; |
62 RVA PointerToTargetRVA(const uint8_t* p) const = 0; | 62 RVA PointerToTargetRVA(const uint8_t* p) const = 0; |
grt (UTC plus 2)
2017/01/12 11:56:41
nit: blank line before this since it isn't part of
huangs
2017/01/12 19:54:42
Actually it is, but I missed the override keyword.
grt (UTC plus 2)
2017/01/13 08:27:32
Huh. I would have thought you'd have gotten a comp
huangs
2017/01/13 16:44:54
I thought error would arise if "override" exists,
| |
63 | 63 |
64 virtual ExecutableType kind() const = 0; | 64 virtual ExecutableType kind() const = 0; |
65 | 65 |
66 // Returns the preferred image base address. Using uint64_t to accommodate the | |
67 // general case of 64-bit architectures. | |
68 virtual uint64_t image_base() const = 0; | |
69 | |
66 // Returns a caller-owned new RvaVisitor to iterate through abs32 target RVAs. | 70 // Returns a caller-owned new RvaVisitor to iterate through abs32 target RVAs. |
67 virtual RvaVisitor* CreateAbs32TargetRvaVisitor() = 0; | 71 virtual RvaVisitor* CreateAbs32TargetRvaVisitor() = 0; |
68 | 72 |
69 // Returns a caller-owned new RvaVisitor to iterate through rel32 target RVAs. | 73 // Returns a caller-owned new RvaVisitor to iterate through rel32 target RVAs. |
70 virtual RvaVisitor* CreateRel32TargetRvaVisitor() = 0; | 74 virtual RvaVisitor* CreateRel32TargetRvaVisitor() = 0; |
71 | 75 |
72 // Removes unused rel32 locations (architecture-specific). This is needed | 76 // Removes unused rel32 locations (architecture-specific). This is needed |
73 // because we may remove rel32 Labels along the way. As a result the matching | 77 // because we may remove rel32 Labels along the way. As a result the matching |
74 // matching rel32 addresses become unused. Removing them saves space. | 78 // matching rel32 addresses become unused. Removing them saves space. |
75 virtual void RemoveUnusedRel32Locations(AssemblyProgram* program) = 0; | 79 virtual void RemoveUnusedRel32Locations(AssemblyProgram* program) = 0; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 size_t length_; // In current memory. | 124 size_t length_; // In current memory. |
121 const uint8_t* start_; // In current memory, base for 'file offsets'. | 125 const uint8_t* start_; // In current memory, base for 'file offsets'. |
122 const uint8_t* end_; // In current memory. | 126 const uint8_t* end_; // In current memory. |
123 | 127 |
124 DISALLOW_COPY_AND_ASSIGN(Disassembler); | 128 DISALLOW_COPY_AND_ASSIGN(Disassembler); |
125 }; | 129 }; |
126 | 130 |
127 } // namespace courgette | 131 } // namespace courgette |
128 | 132 |
129 #endif // COURGETTE_DISASSEMBLER_H_ | 133 #endif // COURGETTE_DISASSEMBLER_H_ |
OLD | NEW |