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

Side by Side Diff: courgette/disassembler_elf_32_x86_unittest.cc

Issue 2793153003: [Courgette] Refactor: Store Label Annotation in AssemblyProgram for patch generation. (Closed)
Patch Set: Rename *_label_annotation to *_label_annotations. Created 3 years, 8 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.cc ('k') | courgette/patch_generator_x86_32.h » ('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 (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 <ctype.h> 7 #include <ctype.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 EXPECT_EQ(file1.length(), disassembler->length()); 84 EXPECT_EQ(file1.length(), disassembler->length());
85 85
86 const uint8_t* offset_p = disassembler->FileOffsetToPointer(0); 86 const uint8_t* offset_p = disassembler->FileOffsetToPointer(0);
87 EXPECT_EQ(reinterpret_cast<const void*>(file1.c_str()), 87 EXPECT_EQ(reinterpret_cast<const void*>(file1.c_str()),
88 reinterpret_cast<const void*>(offset_p)); 88 reinterpret_cast<const void*>(offset_p));
89 EXPECT_EQ(0x7F, offset_p[0]); 89 EXPECT_EQ(0x7F, offset_p[0]);
90 EXPECT_EQ('E', offset_p[1]); 90 EXPECT_EQ('E', offset_p[1]);
91 EXPECT_EQ('L', offset_p[2]); 91 EXPECT_EQ('L', offset_p[2]);
92 EXPECT_EQ('F', offset_p[3]); 92 EXPECT_EQ('F', offset_p[3]);
93 93
94 std::unique_ptr<AssemblyProgram> program = disassembler->Disassemble(); 94 std::unique_ptr<AssemblyProgram> program = disassembler->Disassemble(false);
95 EXPECT_TRUE(nullptr != program.get()); 95 EXPECT_TRUE(nullptr != program.get());
96 96
97 const std::vector<RVA>& abs32_list = disassembler->Abs32Locations(); 97 const std::vector<RVA>& abs32_list = disassembler->Abs32Locations();
98 98
99 // Flatten the list typed rel32 to a list of rel32 RVAs. 99 // Flatten the list typed rel32 to a list of rel32 RVAs.
100 std::vector<RVA> rel32_list; 100 std::vector<RVA> rel32_list;
101 rel32_list.reserve(disassembler->Rel32Locations().size()); 101 rel32_list.reserve(disassembler->Rel32Locations().size());
102 for (auto& typed_rel32 : disassembler->Rel32Locations()) 102 for (auto& typed_rel32 : disassembler->Rel32Locations())
103 rel32_list.push_back(typed_rel32->rva()); 103 rel32_list.push_back(typed_rel32->rva());
104 104
(...skipping 25 matching lines...) Expand all
130 } 130 }
131 131
132 } // namespace 132 } // namespace
133 133
134 TEST_F(DisassemblerElf32X86Test, All) { 134 TEST_F(DisassemblerElf32X86Test, All) {
135 TestExe("elf-32-1", 200, 3337); 135 TestExe("elf-32-1", 200, 3337);
136 TestExe("elf-32-high-bss", 0, 4); 136 TestExe("elf-32-high-bss", 0, 4);
137 } 137 }
138 138
139 } // namespace courgette 139 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/disassembler.cc ('k') | courgette/patch_generator_x86_32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698