| OLD | NEW |
| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "courgette/assembly_program.h" | 10 #include "courgette/assembly_program.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // ParseRelocationSection verifies the organization of the ELF | 23 // ParseRelocationSection verifies the organization of the ELF |
| 24 // relocation table, and ParseRel32RelocsFromSection finds branch | 24 // relocation table, and ParseRel32RelocsFromSection finds branch |
| 25 // targets by looking for relative jump/call opcodes in the particular | 25 // targets by looking for relative jump/call opcodes in the particular |
| 26 // architecture's machine code. | 26 // architecture's machine code. |
| 27 class DisassemblerElf32 : public Disassembler { | 27 class DisassemblerElf32 : public Disassembler { |
| 28 public: | 28 public: |
| 29 // Different instructions encode the target rva differently. This | 29 // Different instructions encode the target rva differently. This |
| 30 // class encapsulates this behavior. public for use in unit tests. | 30 // class encapsulates this behavior. public for use in unit tests. |
| 31 class TypedRVA { | 31 class TypedRVA { |
| 32 public: | 32 public: |
| 33 explicit TypedRVA(RVA rva) : rva_(rva), offset_(-1) { | 33 explicit TypedRVA(RVA rva) : rva_(rva), offset_(static_cast<size_t>(-1)) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 virtual ~TypedRVA() { }; | 36 virtual ~TypedRVA() { }; |
| 37 | 37 |
| 38 RVA rva() { | 38 RVA rva() { |
| 39 return rva_; | 39 return rva_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 RVA relative_target() { | 42 RVA relative_target() { |
| 43 return relative_target_; | 43 return relative_target_; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 std::vector<RVA> abs32_locations_; | 202 std::vector<RVA> abs32_locations_; |
| 203 ScopedVector<TypedRVA> rel32_locations_; | 203 ScopedVector<TypedRVA> rel32_locations_; |
| 204 | 204 |
| 205 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32); | 205 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32); |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 } // namespace courgette | 208 } // namespace courgette |
| 209 | 209 |
| 210 #endif // COURGETTE_DISASSEMBLER_ELF_32_H_ | 210 #endif // COURGETTE_DISASSEMBLER_ELF_32_H_ |
| OLD | NEW |