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

Unified Diff: courgette/disassembler_win32.h

Issue 2462993003: [Courgette] Refactor: Add and use Instruction*Receptor classes; call ParseFile() in 2 passes. (Closed)
Patch Set: Fix comments. Created 4 years, 1 month 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_x86.cc ('k') | courgette/disassembler_win32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_win32.h
diff --git a/courgette/disassembler_win32.h b/courgette/disassembler_win32.h
index 31b32638d8f6842f92d0b5ffe55921ad014de752..be7635af28c9a8c7acf926003b0f60b0540ac690 100644
--- a/courgette/disassembler_win32.h
+++ b/courgette/disassembler_win32.h
@@ -21,6 +21,7 @@
namespace courgette {
class AssemblyProgram;
+class InstructionReceptor;
class DisassemblerWin32 : public Disassembler {
public:
@@ -29,8 +30,8 @@ class DisassemblerWin32 : public Disassembler {
// Disassembler interfaces.
RVA FileOffsetToRVA(FileOffset file_offset) const override;
FileOffset RVAToFileOffset(RVA rva) const override;
- virtual ExecutableType kind() const override = 0;
- virtual RVA PointerToTargetRVA(const uint8_t* p) const override = 0;
+ ExecutableType kind() const override = 0;
+ RVA PointerToTargetRVA(const uint8_t* p) const override = 0;
bool ParseHeader() override;
bool Disassemble(AssemblyProgram* target) override;
@@ -61,30 +62,34 @@ class DisassemblerWin32 : public Disassembler {
DisassemblerWin32(const uint8_t* start, size_t length);
- CheckBool ParseFile(AssemblyProgram* target) WARN_UNUSED_RESULT;
+ CheckBool ParseFile(AssemblyProgram* target,
+ InstructionReceptor* receptor) const WARN_UNUSED_RESULT;
bool ParseAbs32Relocs();
void ParseRel32RelocsFromSections();
virtual void ParseRel32RelocsFromSection(const Section* section) = 0;
CheckBool ParseNonSectionFileRegion(FileOffset start_file_offset,
FileOffset end_file_offset,
- AssemblyProgram* program)
+ InstructionReceptor* receptor) const
WARN_UNUSED_RESULT;
CheckBool ParseFileRegion(const Section* section,
FileOffset start_file_offset,
FileOffset end_file_offset,
- AssemblyProgram* program) WARN_UNUSED_RESULT;
+ AssemblyProgram* program,
+ InstructionReceptor* receptor) const
+ WARN_UNUSED_RESULT;
// Returns address width in byte count.
virtual int AbsVAWidth() const = 0;
- // Emits Abs 32/64 |label| to the |program|.
- virtual CheckBool EmitAbs(Label* label, AssemblyProgram* program) = 0;
+ // Emits Abs 32/64 |label| to the |receptor|.
+ virtual CheckBool EmitAbs(Label* label,
+ InstructionReceptor* receptor) const = 0;
// Returns true if type is recognized.
virtual bool SupportsRelTableType(int type) const = 0;
virtual uint16_t OffsetOfDataDirectories() const = 0;
#if COURGETTE_HISTOGRAM_TARGETS
- void HistogramTargets(const char* kind, const std::map<RVA, int>& map);
+ void HistogramTargets(const char* kind, const std::map<RVA, int>& map) const;
#endif
// Most addresses are represented as 32-bit RVAs. The one address we can't
« no previous file with comments | « courgette/disassembler_elf_32_x86.cc ('k') | courgette/disassembler_win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698