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

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: Sync. Created 4 years, 10 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
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..6f709ba4ba330a6ce5f2c9cc6cd53354e86e892a 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,34 @@ class DisassemblerElf32X86 : public DisassemblerElf32 {
public:
class TypedRVAX86 : public TypedRVA {
public:
- explicit TypedRVAX86(RVA rva) : TypedRVA(rva) {
- }
+ explicit TypedRVAX86(RVA rva) : TypedRVA(rva) { }
- CheckBool ComputeRelativeTarget(const uint8_t* op_pointer) override {
- set_relative_target(Read32LittleEndian(op_pointer) + 4);
- return true;
- }
+ ~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 WARN_UNUSED_RESULT override;
+ CheckBool ParseRelocationSection(
+ const Elf32_Shdr* section_header,
+ AssemblyProgram* program) WARN_UNUSED_RESULT override;
+ CheckBool ParseRel32RelocsFromSection(
+ const Elf32_Shdr* section) WARN_UNUSED_RESULT override;
#if COURGETTE_HISTOGRAM_TARGETS
std::map<RVA, int> rel32_target_rvas_;

Powered by Google App Engine
This is Rietveld 408576698