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

Unified Diff: courgette/disassembler_elf_32.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/disassembler_elf_32.h ('k') | courgette/disassembler_elf_32_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_elf_32.cc
diff --git a/courgette/disassembler_elf_32.cc b/courgette/disassembler_elf_32.cc
index e35a3af1851f8983268a105662561cca54cdde64..14f0383bd6e4e3595dac0fc2482a230105e36d97 100644
--- a/courgette/disassembler_elf_32.cc
+++ b/courgette/disassembler_elf_32.cc
@@ -163,28 +163,6 @@ bool DisassemblerElf32::ParseHeader() {
return Good();
}
-bool DisassemblerElf32::Disassemble(AssemblyProgram* program) {
- if (!ok())
- return false;
-
- if (!ParseAbs32Relocs())
- return false;
-
- if (!ParseRel32RelocsFromSections()) // Does not sort rel32 locations.
- return false;
-
- PrecomputeLabels(program);
- RemoveUnusedRel32Locations(program);
-
- if (!program->GenerateInstructions(
- base::Bind(&DisassemblerElf32::ParseFile, base::Unretained(this)))) {
- return false;
- }
-
- program->DefaultAssignIndexes();
- return true;
-}
-
CheckBool DisassemblerElf32::IsValidTargetRVA(RVA rva) const {
if (rva == kUnassignedRVA)
return false;
@@ -316,7 +294,7 @@ CheckBool DisassemblerElf32::RVAsToFileOffsets(
return true;
}
-CheckBool DisassemblerElf32::ParseAbs32Relocs() {
+bool DisassemblerElf32::ExtractAbs32Locations() {
abs32_locations_.clear();
// Loop through sections for relocation sections
@@ -350,7 +328,7 @@ CheckBool DisassemblerElf32::ParseAbs32Relocs() {
return true;
}
-CheckBool DisassemblerElf32::ParseRel32RelocsFromSections() {
+bool DisassemblerElf32::ExtractRel32Locations() {
rel32_locations_.clear();
bool found_rel32 = false;
@@ -411,6 +389,12 @@ void DisassemblerElf32::RemoveUnusedRel32Locations(AssemblyProgram* program) {
rel32_locations_.resize(std::distance(rel32_locations_.begin(), tail_it));
}
+InstructionGenerator DisassemblerElf32::GetInstructionGenerator(
+ AssemblyProgram* program) {
+ return base::Bind(&DisassemblerElf32::ParseFile, base::Unretained(this),
+ program);
+}
+
CheckBool DisassemblerElf32::ParseFile(AssemblyProgram* program,
InstructionReceptor* receptor) const {
// Walk all the bytes in the file, whether or not in a section.
« no previous file with comments | « courgette/disassembler_elf_32.h ('k') | courgette/disassembler_elf_32_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698