-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve compilation times on Windows #172
Changes from 2 commits
e76cc5a
37f40c4
3890a70
06eb15b
f7ff906
26c981f
dee7ed5
ad24469
b972d2d
167ea34
85841cb
761e8d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
#include <dbghelp.h> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
#ifndef OBJECT_HPP | ||
#define OBJECT_HPP | ||
|
||
#include "utils/common.hpp" | ||
#include "utils/utils.hpp" | ||
#include "binary/module_base.hpp" | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <cstdint> | ||
|
||
namespace cpptrace { | ||
|
||
struct object_frame; | ||
struct safe_object_frame; | ||
|
||
using frame_ptr = std::uintptr_t; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I measured this change making a noticeable difference via Given that, would you reconsider? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that’s reasonable, I appreciate you measuring. I had also been thinking of splitting ip the cpptrace.hpp file so one option in the future might be to have a more minimal header providing the type. |
||
|
||
namespace detail { | ||
object_frame get_frame_object_info(frame_ptr address); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
#include <string> | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
#include <dbghelp.h> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
#include "platform/dbghelp_syminit_manager.hpp" | ||
|
||
#include "utils/error.hpp" | ||
#include "utils/microfmt.hpp" | ||
|
||
#include <unordered_set> | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
#include <dbghelp.h> | ||
|
||
namespace cpptrace { | ||
namespace detail { | ||
|
||
dbghelp_syminit_manager::~dbghelp_syminit_manager() { | ||
for(auto handle : set) { | ||
if(!SymCleanup(handle)) { | ||
ASSERT(false, microfmt::format("Cpptrace SymCleanup failed with code {}\n", GetLastError()).c_str()); | ||
} | ||
} | ||
} | ||
|
||
void dbghelp_syminit_manager::init(HANDLE proc) { | ||
if(set.count(proc) == 0) { | ||
if(!SymInitialize(proc, NULL, TRUE)) { | ||
throw internal_error("SymInitialize failed {}", GetLastError()); | ||
} | ||
set.insert(proc); | ||
} | ||
} | ||
|
||
// Thread-safety: Must only be called from symbols_with_dbghelp while the dbghelp_lock lock is held | ||
dbghelp_syminit_manager& get_syminit_manager() { | ||
static dbghelp_syminit_manager syminit_manager; | ||
return syminit_manager; | ||
} | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it'd be worthwhile to just do
target_compile_definitions(... PRIVATE WIN32_LEAN_AND_MEAN)
?