|
|
|
#pragma once
|
|
|
|
#include <coff/image.hpp>
|
|
|
|
#include <comp/reloc.hpp>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace theo::decomp {
|
|
|
|
class symbol_t {
|
|
|
|
public:
|
|
|
|
explicit symbol_t(std::string name,
|
|
|
|
std::uintptr_t offset,
|
|
|
|
std::vector<std::uint8_t> data,
|
|
|
|
coff::section_header_t* scn,
|
|
|
|
std::vector<comp::reloc_t> relocs);
|
|
|
|
|
|
|
|
std::string name() const;
|
|
|
|
std::uintptr_t offset() const;
|
|
|
|
std::uintptr_t allocated_at() const;
|
|
|
|
std::uint32_t size() const;
|
|
|
|
std::vector<std::uint8_t> data() const;
|
|
|
|
|
|
|
|
void allocated_at(std::uintptr_t allocated_at);
|
|
|
|
|
|
|
|
std::size_t hash();
|
|
|
|
static std::size_t hash(const std::string& sym);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string m_name;
|
|
|
|
std::uintptr_t m_offset, m_allocated_at;
|
|
|
|
std::vector<std::uint8_t> m_data;
|
|
|
|
coff::section_header_t* m_scn;
|
|
|
|
std::vector<comp::reloc_t> m_relocs;
|
|
|
|
};
|
|
|
|
} // namespace theo::decomp
|