Commit 2d967c2f authored by Chu's avatar Chu

使用 memory_ 取代 loaded_

parent 1954c0c6
......@@ -10,7 +10,7 @@
Elf::~Elf()
{
if (loaded_)
if (memory_)
munmap(memory_, memory_length_);
}
......@@ -21,7 +21,7 @@ void Elf::set_base(unsigned long base)
std::size_t Elf::find_symbol_address_by_name(std::string_view name)
{
if (!loaded_)
if (!memory_)
load_to_memory();
for (auto i = 0; i != ehdr_->e_shnum; ++i)
......@@ -66,5 +66,4 @@ void Elf::load_to_memory()
close(fd);
ehdr_ = reinterpret_cast<Elf64_Ehdr *>(memory_);
shdr_ = reinterpret_cast<Elf64_Shdr *>(memory_ + ehdr_->e_shoff);
loaded_ = true;
}
......@@ -17,7 +17,6 @@ public:
private:
std::string path_;
unsigned long base_ = 0;
bool loaded_ = false;
std::size_t memory_length_ = 0;
unsigned char *memory_ = nullptr;
Elf64_Ehdr *ehdr_ = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment