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

Unified Diff: courgette/disassembler_elf_32_x86.h

Issue 1676683002: [Courgette] Clean up Disassembler; fix ELF Memory leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wrap #include <iostream> under #if COURGETTE_HISTOGRAM_TARGETS. 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 5c87d4c889e8ad8a42c8b62e64e2cf787ab424c8..63be75544f3a5b203171dd103c1978890c102b8f 100644
--- a/courgette/disassembler_elf_32_x86.h
+++ b/courgette/disassembler_elf_32_x86.h
@@ -8,9 +8,10 @@
#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 {
@@ -21,38 +22,33 @@ class DisassemblerElf32X86 : public DisassemblerElf32 {
public:
class TypedRVAX86 : public TypedRVA {
public:
- explicit TypedRVAX86(RVA rva) : TypedRVA(rva) {
- }
-
- CheckBool ComputeRelativeTarget(const uint8_t* op_pointer) override {
- set_relative_target(Read32LittleEndian(op_pointer) + 4);
- return true;
- }
+ explicit TypedRVAX86(RVA rva) : TypedRVA(rva) { }
+ ~TypedRVAX86() override { }
+ // TypedRVA interfaces.
+ CheckBool ComputeRelativeTarget(const uint8_t* op_pointer) override;
CheckBool EmitInstruction(AssemblyProgram* program,
- RVA target_rva) override {
- return program->EmitRel32(program->FindOrMakeRel32Label(target_rva));
- }
-
- uint16_t op_size() const override { return 4; }
+ RVA target_rva) override;
+ uint16_t op_size() const override;
};
- explicit DisassemblerElf32X86(const void* start, size_t length);
+ DisassemblerElf32X86(const void* start, size_t length);
- virtual ExecutableType kind() { return EXE_ELF_32_X86; }
+ ~DisassemblerElf32X86() override { }
- virtual e_machine_values ElfEM() { return EM_386; }
+ // DisassemblerElf32 interfaces.
+ ExecutableType kind() const override { return EXE_ELF_32_X86; }
+ e_machine_values ElfEM() const override { return EM_386; }
protected:
- 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;
+ // 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;
#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