aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/pdb/dbghelp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/pdb/dbghelp.hpp')
-rw-r--r--include/pdb/dbghelp.hpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/include/pdb/dbghelp.hpp b/include/pdb/dbghelp.hpp
index af10789..328df2d 100644
--- a/include/pdb/dbghelp.hpp
+++ b/include/pdb/dbghelp.hpp
@@ -18,10 +18,14 @@ namespace pdb {
class DbgHelp {
public:
- DbgHelp(bool invade_current_process = false);
- ~DbgHelp();
+ static DbgHelp current_process() { return DbgHelp{true}; }
+ static DbgHelp post_mortem() { return DbgHelp{false}; }
- void close();
+ void swap(DbgHelp& other) noexcept;
+
+ DbgHelp(DbgHelp&& other) noexcept;
+ DbgHelp& operator=(DbgHelp) noexcept;
+ ~DbgHelp();
ModuleInfo load_pdb(const std::string& path) const;
@@ -43,11 +47,26 @@ public:
LineInfo resolve_line(Address) const;
private:
- const HANDLE id = GetCurrentProcess();
- bool closed = false;
+ explicit DbgHelp(bool invade_current_process);
+
+ void close();
+
+ HANDLE id = GetCurrentProcess();
DbgHelp(const DbgHelp&) = delete;
- DbgHelp& operator=(const DbgHelp&) = delete;
};
+inline void swap(DbgHelp& a, DbgHelp& b) noexcept {
+ a.swap(b);
+}
+
} // namespace pdb
+
+namespace std {
+
+template <>
+inline void swap(pdb::DbgHelp& a, pdb::DbgHelp& b) noexcept {
+ a.swap(b);
+}
+
+} // namespace std