Skip to content

Commit

Permalink
Use a slightly clearer name
Browse files Browse the repository at this point in the history
Co-authored-by: 9291Sam <[email protected]>
  • Loading branch information
jeremy-rifkin and 9291Sam committed Feb 20, 2025
1 parent d6fff90 commit 2bb29f7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/platform/dbghelp_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,25 @@ namespace detail {
// SymInitialize being called twice.
// DuplicateHandle requires the PROCESS_DUP_HANDLE access right. If for some reason DuplicateHandle we fall back
// to calling SymInitialize on the process handle.
optional<DWORD> duplicate_handle_errored;
optional<DWORD> maybe_duplicate_handle_error_code;
if(!DuplicateHandle(proc, proc, proc, &duplicated_handle.get(), 0, FALSE, DUPLICATE_SAME_ACCESS)) {
duplicate_handle_errored = GetLastError();
maybe_duplicate_handle_error_code = GetLastError();
}
if(!SymInitialize(duplicate_handle_errored ? proc : duplicated_handle.get(), NULL, TRUE)) {
if(duplicate_handle_errored) {
if(!SymInitialize(maybe_duplicate_handle_error_code ? proc : duplicated_handle.get(), NULL, TRUE)) {
if(maybe_duplicate_handle_error_code) {
throw internal_error(
"SymInitialize failed with error code {} after DuplicateHandle failed with error code {}",
GetLastError(),
duplicate_handle_errored.unwrap()
maybe_duplicate_handle_error_code.unwrap()
);
} else {
throw internal_error("SymInitialize failed with error code {}", GetLastError());
}
}

auto info = dbghelp_syminit_info::make_owned(
duplicate_handle_errored ? proc : exchange(duplicated_handle.get(), nullptr),
duplicate_handle_errored ? false : true // looks funny but I think it's a little more expressive
maybe_duplicate_handle_error_code ? proc : exchange(duplicated_handle.get(), nullptr),
!maybe_duplicate_handle_error_code
);
// either cache and return a view or return the owning wrapper
if(get_cache_mode() == cache_mode::prioritize_speed) {
Expand Down

0 comments on commit 2bb29f7

Please sign in to comment.