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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 #include "courgette/courgette.h" | 10 #include "courgette/courgette.h" |
11 | 11 |
12 namespace courgette { | 12 namespace courgette { |
13 | 13 |
14 class AssemblyProgram; | 14 class AssemblyProgram; |
15 | 15 |
16 // A Relative Virtual Address is the address in the image file after it is | 16 // A Relative Virtual Address is the address in the image file after it is |
17 // loaded into memory relative to the image load address. | 17 // loaded into memory relative to the image load address. |
18 typedef uint32 RVA; | 18 typedef uint32 RVA; |
19 | 19 |
20 class Disassembler { | 20 class Disassembler { |
21 public: | 21 public: |
22 virtual ~Disassembler(); | 22 virtual ~Disassembler(); |
23 | 23 |
24 virtual ExecutableType kind() { return UNKNOWN; } | 24 virtual ExecutableType kind() { return EXE_UNKNOWN; } |
25 | 25 |
26 // ok() may always be called but returns 'true' only after ParseHeader | 26 // ok() may always be called but returns 'true' only after ParseHeader |
27 // succeeds. | 27 // succeeds. |
28 bool ok() const { return failure_reason_ == NULL; } | 28 bool ok() const { return failure_reason_ == NULL; } |
29 | 29 |
30 // Returns 'true' if the buffer appears to be a valid executable of the | 30 // Returns 'true' if the buffer appears to be a valid executable of the |
31 // expected type. It is not required that this be called before Disassemble. | 31 // expected type. It is not required that this be called before Disassemble. |
32 virtual bool ParseHeader() = 0; | 32 virtual bool ParseHeader() = 0; |
33 | 33 |
34 // Disassembles the item passed to the factory method into the output | 34 // Disassembles the item passed to the factory method into the output |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // | 81 // |
82 size_t length_; // In current memory. | 82 size_t length_; // In current memory. |
83 const uint8* start_; // In current memory, base for 'file offsets'. | 83 const uint8* start_; // In current memory, base for 'file offsets'. |
84 const uint8* end_; // In current memory. | 84 const uint8* end_; // In current memory. |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(Disassembler); | 86 DISALLOW_COPY_AND_ASSIGN(Disassembler); |
87 }; | 87 }; |
88 | 88 |
89 } // namespace courgette | 89 } // namespace courgette |
90 #endif // COURGETTE_DISASSEMBLER_H_ | 90 #endif // COURGETTE_DISASSEMBLER_H_ |
OLD | NEW |