You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Theodosius/include/decomp/symbol.hpp

46 lines
1.3 KiB

#pragma once
#include <coff/image.hpp>
#include <comp/reloc.hpp>
#include <cstdint>
#include <string>
#include <vector>
namespace theo::decomp {
enum decomp_type_t { none, instr_split };
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,
coff::symbol_t* sym,
std::vector<comp::reloc_t> relocs,
decomp_type_t dcmp_type);
std::string name() const;
std::uintptr_t offset() const;
std::uintptr_t allocated_at() const;
std::uint32_t size() const;
coff::section_header_t* scn() const;
std::vector<std::uint8_t> data() const;
coff::symbol_t* sym() const;
decomp_type_t dcmp_type() const;
std::vector<comp::reloc_t>& relocs();
void allocated_at(std::uintptr_t allocated_at);
std::size_t hash();
static std::size_t hash(const std::string& sym);
static std::size_t scn_hash(coff::symbol_t* sym, coff::section_header_t* scn,
coff::image_t* img);
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;
decomp_type_t m_dcmp_type;
coff::symbol_t* m_sym;
};
} // namespace theo::decomp