diff options
Diffstat (limited to '')
-rw-r--r-- | include/pdb/dbghelp.hpp | 2 | ||||
-rw-r--r-- | include/pdb/repo.hpp | 2 | ||||
-rw-r--r-- | include/pdb/symbol.hpp | 25 |
3 files changed, 29 insertions, 0 deletions
diff --git a/include/pdb/dbghelp.hpp b/include/pdb/dbghelp.hpp index d6b6899..2555de1 100644 --- a/include/pdb/dbghelp.hpp +++ b/include/pdb/dbghelp.hpp @@ -32,6 +32,8 @@ namespace pdb SymbolInfo resolve_symbol(Address) const; SymbolInfo resolve_symbol(const std::string&) const; + LineInfo resolve_line(Address) const; + private: ModuleInfo get_module_info(Address offline_base) const; diff --git a/include/pdb/repo.hpp b/include/pdb/repo.hpp index dd41b17..c8a2964 100644 --- a/include/pdb/repo.hpp +++ b/include/pdb/repo.hpp @@ -33,6 +33,8 @@ namespace pdb Symbol resolve_symbol(Address) const; Symbol resolve_symbol(const std::string&) const; + LineInfo resolve_line(Address) const; + const Module& module_with_online_base(Address) const; const Module& module_with_offline_base(Address) const; diff --git a/include/pdb/symbol.hpp b/include/pdb/symbol.hpp index fc200c7..81a40e3 100644 --- a/include/pdb/symbol.hpp +++ b/include/pdb/symbol.hpp @@ -111,4 +111,29 @@ namespace pdb private: const Address online_address; }; + + class LineInfo + { + public: + typedef IMAGEHLP_LINE64 Raw; + + explicit LineInfo(const Raw& raw) + : file_path{raw.FileName} + , line_number{cast_line_number(raw.LineNumber)} + { } + + const std::string file_path; + const unsigned long line_number; + + private: + static unsigned long cast_line_number(DWORD raw) + { + unsigned long dest = 0; + + if (!msl::utilities::SafeCast(raw, dest)) + throw std::runtime_error{"invalid line number"}; + + return dest; + } + }; } |