aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/pdb
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
parentaddr2name: include module names (diff)
downloadwinapi-debug-b6919562ab09fc18dfa90c4588636b4f6ffcd76c.tar.gz
winapi-debug-b6919562ab09fc18dfa90c4588636b4f6ffcd76c.zip
add line numbers to symbols
Diffstat (limited to 'include/pdb')
-rw-r--r--include/pdb/dbghelp.hpp2
-rw-r--r--include/pdb/repo.hpp2
-rw-r--r--include/pdb/symbol.hpp25
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;
+ }
+ };
}