Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: courgette/disassembler_elf_32_arm.cc

Issue 2771753004: [Courgette] Refactor: Unify Disassembler::Disassemble() and instantiate AssemblyProgram there. (Closed)
Patch Set: Fix signed/unsigned comparison issue in test. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « courgette/disassembler_elf_32.cc ('k') | courgette/disassembler_elf_32_x86.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "courgette/disassembler_elf_32_arm.h" 5 #include "courgette/disassembler_elf_32_arm.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 const Elf32_Rel* section_relocs_iter = reinterpret_cast<const Elf32_Rel*>( 359 const Elf32_Rel* section_relocs_iter = reinterpret_cast<const Elf32_Rel*>(
360 FileOffsetToPointer(section_header->sh_offset)); 360 FileOffsetToPointer(section_header->sh_offset));
361 361
362 uint32_t section_relocs_count = 362 uint32_t section_relocs_count =
363 section_header->sh_size / section_header->sh_entsize; 363 section_header->sh_size / section_header->sh_entsize;
364 364
365 if (abs32_locations_.size() > section_relocs_count) 365 if (abs32_locations_.size() > section_relocs_count)
366 match = false; 366 match = false;
367 367
368 if (!abs32_locations_.empty()) { 368 if (!abs32_locations_.empty()) {
369 std::vector<RVA>::iterator reloc_iter = abs32_locations_.begin(); 369 std::vector<RVA>::const_iterator reloc_iter = abs32_locations_.begin();
370 370
371 for (uint32_t i = 0; i < section_relocs_count; ++i) { 371 for (uint32_t i = 0; i < section_relocs_count; ++i) {
372 if (section_relocs_iter->r_offset == *reloc_iter) 372 if (section_relocs_iter->r_offset == *reloc_iter)
373 break; 373 break;
374 374
375 if (!ParseSimpleRegion(file_offset, file_offset + sizeof(Elf32_Rel), 375 if (!ParseSimpleRegion(file_offset, file_offset + sizeof(Elf32_Rel),
376 receptor)) { 376 receptor)) {
377 return false; 377 return false;
378 } 378 }
379 379
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // Move 2 bytes at a time, but track 32-bit boundaries 519 // Move 2 bytes at a time, but track 32-bit boundaries
520 p += 2; 520 p += 2;
521 on_32bit = ((on_32bit + 1) % 2) != 0; 521 on_32bit = ((on_32bit + 1) % 2) != 0;
522 } 522 }
523 } 523 }
524 524
525 return true; 525 return true;
526 } 526 }
527 527
528 } // namespace courgette 528 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/disassembler_elf_32.cc ('k') | courgette/disassembler_elf_32_x86.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698