#pragma once #include #include #include class DwarfInterpret { /** Singleton class holding a Dwarf interpret. * Must be first instanciated with the path to the binary being run, with a * call to `instanciate`, and can afterwards be accessed with calls to * `acquire`. */ public: class NotInstanciated: public std::exception {}; class AlreadyInstanciated: public std::exception {}; DwarfInterpret(DwarfInterpret const&) = delete; void operator=(DwarfInterpret const&) = delete; static DwarfInterpret& acquire(); static DwarfInterpret& instanciate(const std::string& elf_path); private: DwarfInterpret(const std::string& elf_path); private: // members static std::unique_ptr instance; dwarf::core::root_die root_die; int elf_machine; friend class std::unique_ptr; };