OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "courgette/disassembler_elf_32_x86.h" | 5 #include "courgette/disassembler_elf_32_x86.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "courgette/assembly_program.h" | 12 #include "courgette/assembly_program.h" |
12 #include "courgette/courgette.h" | 13 #include "courgette/courgette.h" |
13 | 14 |
14 namespace courgette { | 15 namespace courgette { |
15 | 16 |
16 CheckBool DisassemblerElf32X86::TypedRVAX86::ComputeRelativeTarget( | 17 CheckBool DisassemblerElf32X86::TypedRVAX86::ComputeRelativeTarget( |
17 const uint8_t* op_pointer) { | 18 const uint8_t* op_pointer) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 179 } |
179 } | 180 } |
180 | 181 |
181 std::unique_ptr<TypedRVAX86> typed_rel32_rva(new TypedRVAX86(rel32_rva)); | 182 std::unique_ptr<TypedRVAX86> typed_rel32_rva(new TypedRVAX86(rel32_rva)); |
182 if (!typed_rel32_rva->ComputeRelativeTarget(rel32)) | 183 if (!typed_rel32_rva->ComputeRelativeTarget(rel32)) |
183 return false; | 184 return false; |
184 | 185 |
185 RVA target_rva = typed_rel32_rva->rva() + | 186 RVA target_rva = typed_rel32_rva->rva() + |
186 typed_rel32_rva->relative_target(); | 187 typed_rel32_rva->relative_target(); |
187 if (IsValidTargetRVA(target_rva)) { | 188 if (IsValidTargetRVA(target_rva)) { |
188 rel32_locations_.push_back(typed_rel32_rva.release()); | 189 rel32_locations_.push_back(std::move(typed_rel32_rva)); |
189 #if COURGETTE_HISTOGRAM_TARGETS | 190 #if COURGETTE_HISTOGRAM_TARGETS |
190 ++rel32_target_rvas_[target_rva]; | 191 ++rel32_target_rvas_[target_rva]; |
191 #endif | 192 #endif |
192 p = rel32 + 4; | 193 p = rel32 + 4; |
193 continue; | 194 continue; |
194 } | 195 } |
195 } | 196 } |
196 p += 1; | 197 p += 1; |
197 } | 198 } |
198 | 199 |
199 return true; | 200 return true; |
200 } | 201 } |
201 | 202 |
202 } // namespace courgette | 203 } // namespace courgette |
OLD | NEW |