aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-16 01:04:38 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-16 01:21:32 +0300
commit821783d809b1ef5a6aac0353cf1f283c42eb3f1a (patch)
treeceed12671c959befca81e1efb0911a74204ec7ab /include
parentadd call stack collection support (diff)
downloadwinapi-debug-821783d809b1ef5a6aac0353cf1f283c42eb3f1a.tar.gz
winapi-debug-821783d809b1ef5a6aac0353cf1f283c42eb3f1a.zip
SymbolInfo: get rid of a dangerous hack
Diffstat (limited to 'include')
-rw-r--r--include/pdb/symbol.hpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/pdb/symbol.hpp b/include/pdb/symbol.hpp
index 2e24a5a..3e0ab17 100644
--- a/include/pdb/symbol.hpp
+++ b/include/pdb/symbol.hpp
@@ -40,18 +40,18 @@ public:
SymbolInfo();
explicit SymbolInfo(const Impl& impl);
- explicit operator Impl&() { return impl; }
- explicit operator const Impl&() const { return impl; }
+ explicit operator Impl&() { return get_impl(); }
+ explicit operator const Impl&() const { return get_impl(); }
Address get_displacement() const { return displacement; }
void set_displacement(Address new_value) { displacement = new_value; }
- std::string get_name() const { return {impl.Name, impl.NameLen}; }
+ std::string get_name() const { return {get_impl().Name, get_impl().NameLen}; }
- Address get_offline_base() const { return impl.ModBase; }
- Address get_offline_address() const { return impl.Address; }
+ Address get_offline_base() const { return get_impl().ModBase; }
+ Address get_offline_address() const { return get_impl().Address; }
- symbol::Tag get_tag() const { return impl.Tag; }
+ symbol::Tag get_tag() const { return get_impl().Tag; }
enum class Type : symbol::Tag {
Function = symbol::SYM_TAG_FUNCTION,
@@ -68,8 +68,8 @@ private:
std::array<unsigned char, max_buffer_size> buffer;
Address displacement = 0;
-protected:
- Impl& impl;
+ const Impl& get_impl() const { return *reinterpret_cast<const Impl*>(buffer.data()); }
+ Impl& get_impl() { return *reinterpret_cast<Impl*>(buffer.data()); }
};
class Symbol : public SymbolInfo {