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

Unified Diff: courgette/disassembler_elf_32_x86.h

Issue 1792603006: Revert of [Courgette] Clean up Disassembler; fix ELF Memory leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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_arm.cc ('k') | courgette/disassembler_elf_32_x86.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_elf_32_x86.h
diff --git a/courgette/disassembler_elf_32_x86.h b/courgette/disassembler_elf_32_x86.h
index 63be75544f3a5b203171dd103c1978890c102b8f..5c87d4c889e8ad8a42c8b62e64e2cf787ab424c8 100644
--- a/courgette/disassembler_elf_32_x86.h
+++ b/courgette/disassembler_elf_32_x86.h
@@ -8,10 +8,9 @@
#include <stddef.h>
#include <stdint.h>
-#include <map>
-
#include "base/macros.h"
#include "courgette/disassembler_elf_32.h"
+#include "courgette/memory_allocator.h"
#include "courgette/types_elf.h"
namespace courgette {
@@ -22,33 +21,38 @@
public:
class TypedRVAX86 : public TypedRVA {
public:
- explicit TypedRVAX86(RVA rva) : TypedRVA(rva) { }
- ~TypedRVAX86() override { }
+ explicit TypedRVAX86(RVA rva) : TypedRVA(rva) {
+ }
- // TypedRVA interfaces.
- CheckBool ComputeRelativeTarget(const uint8_t* op_pointer) override;
+ CheckBool ComputeRelativeTarget(const uint8_t* op_pointer) override {
+ set_relative_target(Read32LittleEndian(op_pointer) + 4);
+ return true;
+ }
+
CheckBool EmitInstruction(AssemblyProgram* program,
- RVA target_rva) override;
- uint16_t op_size() const override;
+ RVA target_rva) override {
+ return program->EmitRel32(program->FindOrMakeRel32Label(target_rva));
+ }
+
+ uint16_t op_size() const override { return 4; }
};
- DisassemblerElf32X86(const void* start, size_t length);
+ explicit DisassemblerElf32X86(const void* start, size_t length);
- ~DisassemblerElf32X86() override { }
+ virtual ExecutableType kind() { return EXE_ELF_32_X86; }
- // DisassemblerElf32 interfaces.
- ExecutableType kind() const override { return EXE_ELF_32_X86; }
- e_machine_values ElfEM() const override { return EM_386; }
+ virtual e_machine_values ElfEM() { return EM_386; }
protected:
- // DisassemblerElf32 interfaces.
- CheckBool RelToRVA(Elf32_Rel rel,
- RVA* result) const override WARN_UNUSED_RESULT;
- CheckBool ParseRelocationSection(const Elf32_Shdr* section_header,
- AssemblyProgram* program)
- override WARN_UNUSED_RESULT;
- CheckBool ParseRel32RelocsFromSection(const Elf32_Shdr* section)
- override WARN_UNUSED_RESULT;
+ virtual CheckBool RelToRVA(Elf32_Rel rel, RVA* result)
+ const WARN_UNUSED_RESULT;
+
+ virtual CheckBool ParseRelocationSection(
+ const Elf32_Shdr *section_header,
+ AssemblyProgram* program) WARN_UNUSED_RESULT;
+
+ virtual CheckBool ParseRel32RelocsFromSection(
+ const Elf32_Shdr* section) WARN_UNUSED_RESULT;
#if COURGETTE_HISTOGRAM_TARGETS
std::map<RVA, int> rel32_target_rvas_;
« no previous file with comments | « courgette/disassembler_elf_32_arm.cc ('k') | courgette/disassembler_elf_32_x86.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698