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

Unified Diff: courgette/disassembler_win32.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_win32.h ('k') | courgette/instruction_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_win32.cc
diff --git a/courgette/disassembler_win32.cc b/courgette/disassembler_win32.cc
index f677a0692417134c1dd237a75e6259ca2c30b264..ec3648520b5a0e9ae31767559d783d3301671ed3 100644
--- a/courgette/disassembler_win32.cc
+++ b/courgette/disassembler_win32.cc
@@ -221,27 +221,6 @@ bool DisassemblerWin32::ParseHeader() {
return Good();
}
-bool DisassemblerWin32::Disassemble(AssemblyProgram* program) {
- if (!ok())
- return false;
-
- if (!ParseAbs32Relocs())
- return false;
-
- ParseRel32RelocsFromSections();
-
- PrecomputeLabels(program);
- RemoveUnusedRel32Locations(program);
-
- if (!program->GenerateInstructions(
- base::Bind(&DisassemblerWin32::ParseFile, base::Unretained(this)))) {
- return false;
- }
-
- program->DefaultAssignIndexes();
- return true;
-}
-
////////////////////////////////////////////////////////////////////////////////
bool DisassemblerWin32::ParseRelocs(std::vector<RVA>* relocs) {
@@ -365,7 +344,7 @@ bool DisassemblerWin32::QuickDetect(const uint8_t* start,
return true;
}
-bool DisassemblerWin32::ParseAbs32Relocs() {
+bool DisassemblerWin32::ExtractAbs32Locations() {
abs32_locations_.clear();
if (!ParseRelocs(&abs32_locations_))
return false;
@@ -380,7 +359,7 @@ bool DisassemblerWin32::ParseAbs32Relocs() {
return true;
}
-void DisassemblerWin32::ParseRel32RelocsFromSections() {
+bool DisassemblerWin32::ExtractRel32Locations() {
FileOffset file_offset = 0;
while (file_offset < length()) {
const Section* section = FindNextSection(file_offset);
@@ -417,6 +396,7 @@ void DisassemblerWin32::ParseRel32RelocsFromSections() {
}
VLOG(1) << "common " << common;
#endif
+ return true;
}
RvaVisitor* DisassemblerWin32::CreateAbs32TargetRvaVisitor() {
@@ -439,6 +419,12 @@ void DisassemblerWin32::RemoveUnusedRel32Locations(
rel32_locations_.end());
}
+InstructionGenerator DisassemblerWin32::GetInstructionGenerator(
+ AssemblyProgram* program) {
+ return base::Bind(&DisassemblerWin32::ParseFile, base::Unretained(this),
+ program);
+}
+
CheckBool DisassemblerWin32::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_win32.h ('k') | courgette/instruction_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698