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 #include "courgette/disassembler_elf_32_x86.h" | 5 #include "courgette/disassembler_elf_32_x86.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 | 13 |
14 #include "courgette/assembly_program.h" | 14 #include "courgette/assembly_program.h" |
15 #include "courgette/courgette.h" | 15 #include "courgette/courgette.h" |
16 #include "courgette/encoded_program.h" | 16 #include "courgette/encoded_program.h" |
17 | 17 |
18 namespace courgette { | 18 namespace courgette { |
19 | 19 |
20 DisassemblerElf32X86::DisassemblerElf32X86(const void* start, size_t length) | 20 DisassemblerElf32X86::DisassemblerElf32X86(const void* start, size_t length) |
21 : Disassembler(start, length) { | 21 : Disassembler(start, length), |
| 22 header_(NULL), |
| 23 section_header_table_(NULL), |
| 24 section_header_table_size_(0), |
| 25 program_header_table_(NULL), |
| 26 program_header_table_size_(0), |
| 27 default_string_section_(NULL) { |
22 } | 28 } |
23 | 29 |
24 bool DisassemblerElf32X86::ParseHeader() { | 30 bool DisassemblerElf32X86::ParseHeader() { |
25 if (length() < sizeof(Elf32_Ehdr)) | 31 if (length() < sizeof(Elf32_Ehdr)) |
26 return Bad("Too small"); | 32 return Bad("Too small"); |
27 | 33 |
28 header_ = (Elf32_Ehdr *)start(); | 34 header_ = (Elf32_Ehdr *)start(); |
29 | 35 |
30 // Have magic for elf header? | 36 // Have magic for elf header? |
31 if (header_->e_ident[0] != 0x7f || | 37 if (header_->e_ident[0] != 0x7f || |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 continue; | 581 continue; |
576 } | 582 } |
577 } | 583 } |
578 p += 1; | 584 p += 1; |
579 } | 585 } |
580 | 586 |
581 return true; | 587 return true; |
582 } | 588 } |
583 | 589 |
584 } // namespace courgette | 590 } // namespace courgette |
OLD | NEW |