-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve locking surrounding dbghelp and lock in the dbghelp demangler
- Loading branch information
1 parent
74b5ac6
commit 6d62d01
Showing
6 changed files
with
36 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 12 additions & 4 deletions
16
src/platform/dbghelp_syminit_manager.hpp → src/platform/dbghelp_utils.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
#ifndef DBGHELP_SYMINIT_MANAGER_HPP | ||
#define DBGHELP_SYMINIT_MANAGER_HPP | ||
#ifndef DBGHELP_UTILS_HPP | ||
#define DBGHELP_UTILS_HPP | ||
|
||
#if defined(CPPTRACE_UNWIND_WITH_DBGHELP) \ | ||
|| defined(CPPTRACE_GET_SYMBOLS_WITH_DBGHELP) \ | ||
|| defined(CPPTRACE_DEMANGLE_WITH_WINAPI) | ||
|
||
#include <unordered_map> | ||
#include <mutex> | ||
|
||
namespace cpptrace { | ||
namespace detail { | ||
struct dbghelp_syminit_manager { | ||
// The set below contains Windows `HANDLE` objects, `void*` is used to avoid | ||
// The set below contains Windows `HANDLE` objects, `void*` is used to avoid | ||
// including the (expensive) Windows header here | ||
std::unordered_map<void*, void*> cache; | ||
|
||
~dbghelp_syminit_manager(); | ||
void* init(void* proc); | ||
}; | ||
|
||
// Thread-safety: Must only be called from symbols_with_dbghelp while the dbghelp_lock lock is held | ||
dbghelp_syminit_manager& get_syminit_manager(); | ||
|
||
std::unique_lock<std::recursive_mutex> get_dbghelp_lock(); | ||
} | ||
} | ||
|
||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters