aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/pdb/symbol.hpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-05-22 02:10:22 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-05-22 02:10:22 +0300
commitb6919562ab09fc18dfa90c4588636b4f6ffcd76c (patch)
treeecfba51bb575e02a28d2224f557eca34eca7c8fc /include/pdb/symbol.hpp
parentaddr2name: include module names (diff)
downloadwinapi-debug-b6919562ab09fc18dfa90c4588636b4f6ffcd76c.tar.gz
winapi-debug-b6919562ab09fc18dfa90c4588636b4f6ffcd76c.zip
add line numbers to symbols
Diffstat (limited to 'include/pdb/symbol.hpp')
-rw-r--r--include/pdb/symbol.hpp25
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;
+ }
+ };
}