minidump: satisfy clang tidy

This commit is contained in:
redthing1
2025-06-10 00:47:01 -07:00
parent 3fa9fa9c15
commit 47f4589774
3 changed files with 16 additions and 6 deletions

View File

@@ -181,15 +181,20 @@ namespace
// Process memory info
const auto& memory_regions = dump_file->memory_regions();
uint64_t total_reserved = 0, total_committed = 0;
uint64_t total_reserved = 0;
uint64_t total_committed = 0;
size_t guard_pages = 0;
for (const auto& region : memory_regions)
{
total_reserved += region.region_size;
if (region.state & MEM_COMMIT)
{
total_committed += region.region_size;
}
if (region.protect & PAGE_GUARD)
{
guard_pages++;
}
}
win_emu.log.info("Memory: %zu regions, %" PRIu64 " bytes reserved, %" PRIu64
" bytes committed, %zu guard pages\n",
@@ -197,7 +202,8 @@ namespace
// Process memory content
const auto& memory_segments = dump_file->memory_segments();
uint64_t min_addr = UINT64_MAX, max_addr = 0;
uint64_t min_addr = UINT64_MAX;
uint64_t max_addr = 0;
for (const auto& segment : memory_segments)
{
min_addr = std::min(min_addr, segment.start_virtual_address);
@@ -232,7 +238,9 @@ namespace
{
std::map<std::string, size_t> handle_type_counts;
for (const auto& handle : handles)
{
handle_type_counts[handle.type_name]++;
}
win_emu.log.info("Handles: %zu total\n", handles.size());
for (const auto& [type, count] : handle_type_counts)
{
@@ -274,7 +282,9 @@ namespace
const bool is_free = (region.state & MEM_FREE) != 0;
if (is_free)
{
continue;
}
memory_permission perms = memory_permission::none;
@@ -690,9 +700,9 @@ namespace
}
}
minidump_loader::minidump_loader(windows_emulator& win_emu, const std::filesystem::path& minidump_path)
minidump_loader::minidump_loader(windows_emulator& win_emu, std::filesystem::path minidump_path)
: win_emu_(win_emu),
minidump_path_(minidump_path)
minidump_path_(std::move(minidump_path))
{
}

View File

@@ -6,7 +6,7 @@ class windows_emulator;
class minidump_loader
{
public:
minidump_loader(windows_emulator& win_emu, const std::filesystem::path& minidump_path);
minidump_loader(windows_emulator& win_emu, std::filesystem::path minidump_path);
~minidump_loader();
void load_into_emulator();

View File

@@ -287,7 +287,7 @@ mapped_module map_module_from_memory(memory_manager& memory, uint64_t base_addre
binary.entry_point = binary.image_base + optional_header.AddressOfEntryPoint;
const auto section_offset = get_first_section_offset(nt_headers, nt_headers_offset);
const auto sections = buffer.as<IMAGE_SECTION_HEADER>(section_offset);
const auto sections = buffer.as<IMAGE_SECTION_HEADER>(static_cast<size_t>(section_offset));
for (size_t i = 0; i < nt_headers.FileHeader.NumberOfSections; ++i)
{