diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-05-22 02:10:22 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-05-22 02:10:22 +0300 |
commit | b6919562ab09fc18dfa90c4588636b4f6ffcd76c (patch) | |
tree | ecfba51bb575e02a28d2224f557eca34eca7c8fc /include/pdb/symbol.hpp | |
parent | addr2name: include module names (diff) | |
download | winapi-debug-b6919562ab09fc18dfa90c4588636b4f6ffcd76c.tar.gz winapi-debug-b6919562ab09fc18dfa90c4588636b4f6ffcd76c.zip |
add line numbers to symbols
Diffstat (limited to '')
-rw-r--r-- | include/pdb/symbol.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
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; + } + }; } |