| 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" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 uint64 ReadU64(const uint8* address, size_t offset) { | 62 uint64 ReadU64(const uint8* address, size_t offset) { |
| 63 return *reinterpret_cast<const uint64*>(address + offset); | 63 return *reinterpret_cast<const uint64*>(address + offset); |
| 64 } | 64 } |
| 65 | 65 |
| 66 static uint32 Read32LittleEndian(const void* address) { | 66 static uint32 Read32LittleEndian(const void* address) { |
| 67 return *reinterpret_cast<const uint32*>(address); | 67 return *reinterpret_cast<const uint32*>(address); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Reduce the length of the image in memory. Does not actually free | 70 // Reduce the length of the image in memory. Does not actually free |
| 71 // (or realloc) any memory. Unusally only called via ParseHeader() | 71 // (or realloc) any memory. Usually only called via ParseHeader() |
| 72 void ReduceLength(size_t reduced_length); | 72 void ReduceLength(size_t reduced_length); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 const char* failure_reason_; | 75 const char* failure_reason_; |
| 76 | 76 |
| 77 // | 77 // |
| 78 // Basic information that is always valid after Construction, though | 78 // Basic information that is always valid after Construction, though |
| 79 // ParseHeader may shorten the length if the executable is shorter than | 79 // ParseHeader may shorten the length if the executable is shorter than |
| 80 // the total data. | 80 // the total data. |
| 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 |