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

Unified Diff: courgette/disassembler_elf_32.h

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.cc ('k') | courgette/disassembler_elf_32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_elf_32.h
diff --git a/courgette/disassembler_elf_32.h b/courgette/disassembler_elf_32.h
index fbd8a59ccc642b8d5c5e212bcf1bc070340ba089..a75773d78b0579f7dc64b58f1ed05c34fab17126 100644
--- a/courgette/disassembler_elf_32.h
+++ b/courgette/disassembler_elf_32.h
@@ -15,13 +15,13 @@
#include "base/macros.h"
#include "courgette/disassembler.h"
#include "courgette/image_utils.h"
+#include "courgette/instruction_utils.h"
#include "courgette/memory_allocator.h"
#include "courgette/types_elf.h"
namespace courgette {
class AssemblyProgram;
-class InstructionReceptor;
// A Courgette disassembler for 32-bit ELF files. This is only a partial
// implementation that admits subclasses for the architecture-specific parts of
@@ -106,7 +106,6 @@ class DisassemblerElf32 : public Disassembler {
ExecutableType kind() const override = 0;
uint64_t image_base() const override { return 0; }
bool ParseHeader() override;
- bool Disassemble(AssemblyProgram* program) override;
virtual e_machine_values ElfEM() const = 0;
@@ -170,7 +169,7 @@ class DisassemblerElf32 : public Disassembler {
CheckBool RVAsToFileOffsets(
std::vector<std::unique_ptr<TypedRVA>>* typed_rvas) const;
- // Parsing code for Disassemble().
+ // Helpers for ParseFile().
virtual CheckBool ParseRelocationSection(const Elf32_Shdr* section_header,
InstructionReceptor* receptor) const
@@ -185,9 +184,13 @@ class DisassemblerElf32 : public Disassembler {
CheckBool ParseRel32RelocsFromSections() WARN_UNUSED_RESULT;
// Disassembler interfaces.
+ bool ExtractAbs32Locations() override;
+ bool ExtractRel32Locations() override;
RvaVisitor* CreateAbs32TargetRvaVisitor() override;
RvaVisitor* CreateRel32TargetRvaVisitor() override;
void RemoveUnusedRel32Locations(AssemblyProgram* program) override;
+ InstructionGenerator GetInstructionGenerator(
+ AssemblyProgram* program) override;
CheckBool ParseFile(AssemblyProgram* target,
InstructionReceptor* receptor) const WARN_UNUSED_RESULT;
@@ -225,9 +228,10 @@ class DisassemblerElf32 : public Disassembler {
const char* default_string_section_;
size_t default_string_section_size_;
- // Sorted abs32 and reel32 RVAs. These are mutable because ParseFile() needs
- // to sort these by file offsets.
- mutable std::vector<RVA> abs32_locations_;
+ // Sorted abs32 RVAs.
+ std::vector<RVA> abs32_locations_;
+ // Sorted rel32 RVAs. This is mutable because ParseFile() temporarily sorts
+ // these by file offsets.
mutable std::vector<std::unique_ptr<TypedRVA>> rel32_locations_;
private:
« no previous file with comments | « courgette/disassembler.cc ('k') | courgette/disassembler_elf_32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698