mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-02 20:18:12 +00:00
checksum baking & rdi changes; checksum dumping
This commit is contained in:
+23
-5
@@ -74,7 +74,7 @@
|
||||
"";
|
||||
"// \"raddbg\\0\\0\"";
|
||||
"#define RDI_MAGIC_CONSTANT 0x0000676264646172";
|
||||
"#define RDI_ENCODING_VERSION 15";
|
||||
"#define RDI_ENCODING_VERSION 16";
|
||||
"";
|
||||
"////////////////////////////////////////////////////////////////";
|
||||
"//~ Format Types & Functions";
|
||||
@@ -564,7 +564,7 @@ RDI_ChecksumKindTable:
|
||||
{COUNT 5 NULL }
|
||||
}
|
||||
|
||||
@enum(RDI_U16) RDI_ChecksumKind:
|
||||
@enum(RDI_U32) RDI_ChecksumKind:
|
||||
{
|
||||
@expand(RDI_ChecksumKindTable a) `$(a.name .. =>10) = $(a.value)`
|
||||
}
|
||||
@@ -590,13 +590,15 @@ RDI_FilePathNodeMemberTable:
|
||||
@table(name type desc)
|
||||
RDI_SourceFileMemberTable:
|
||||
{
|
||||
{file_path_node_idx RDI_U32 ""}
|
||||
{normal_full_path_string_idx RDI_U32 ""}
|
||||
{file_path_node_idx RDI_U32 ""}
|
||||
{normal_full_path_string_idx RDI_U32 ""}
|
||||
// usage of line map to go from a line number to an array of voffs
|
||||
// (line_map_nums * line_number) -> (nil | index)
|
||||
// (line_map_data * index) -> (range)
|
||||
// (line_map_voff_data * range) -> (array(voff))
|
||||
{source_line_map_idx RDI_U32 ""}
|
||||
{source_line_map_idx RDI_U32 ""}
|
||||
{checksum_kind RDI_ChecksumKind ""}
|
||||
{checksum_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@xlist RDI_FilePathNode_XList:
|
||||
@@ -1648,3 +1650,19 @@ rdi_explanation_string_from_eval_conversion_kind(RDI_EvalConversionKind kind, RD
|
||||
return rdi_eval_conversion_kind_message_string_table[kind].str;
|
||||
}
|
||||
```
|
||||
|
||||
@gen(functions) @c_file
|
||||
{
|
||||
`RDI_PROC RDI_SectionKind`;
|
||||
`rdi_section_kind_from_checksum_kind(RDI_ChecksumKind kind)`;
|
||||
`{`;
|
||||
`RDI_SectionKind result = 0;`;
|
||||
`switch(kind)`;
|
||||
`{`;
|
||||
`default:{}break;`;
|
||||
@expand(RDI_ChecksumKindTable a) `case RDI_ChecksumKind_$(a.name):{result = RDI_SectionKind_$(a.section);}break;`,
|
||||
`}`;
|
||||
`return result;`;
|
||||
`}`;
|
||||
``;
|
||||
}
|
||||
|
||||
+27
-1
@@ -671,13 +671,39 @@ lane_sync(); if(flags & RDI_DumpSubsetFlag_##name) ProfScope(#name)
|
||||
{
|
||||
U64 count = 0;
|
||||
RDI_SourceFile *v = rdi_table_from_name(rdi, SourceFiles, &count);
|
||||
U64 checksums_count[RDI_ChecksumKind_COUNT] = {0};
|
||||
RDI_U8 *checksums_data[RDI_ChecksumKind_COUNT] = {0};
|
||||
RDI_U64 checksums_element_sizes[RDI_ChecksumKind_COUNT] = {0};
|
||||
for EachEnumVal(RDI_ChecksumKind, k)
|
||||
{
|
||||
RDI_SectionKind section_kind = rdi_section_kind_from_checksum_kind(k);
|
||||
checksums_data[k] = rdi_section_raw_table_from_kind(rdi, section_kind, &checksums_count[k]);
|
||||
checksums_element_sizes[k] = rdi_section_element_size_table[section_kind];
|
||||
}
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_SourceFile *source_file = &v[idx];
|
||||
dumpf("\n { file_path_node_idx: %4u, source_line_map: %4u, path: %-192S } // source_file[%I64u]",
|
||||
RDI_ChecksumKind checksum_kind = source_file->checksum_kind;
|
||||
RDI_U32 checksum_idx = source_file->checksum_idx;
|
||||
String8 checksum_kind_name = {0};
|
||||
switch(checksum_kind)
|
||||
{
|
||||
default:{checksum_kind_name = str8_lit("Null");}break;
|
||||
#define X(name, s) case RDI_ChecksumKind_##name:{checksum_kind_name = str8_lit(#name);}break;
|
||||
RDI_ChecksumKind_XList
|
||||
#undef X
|
||||
}
|
||||
String8 checksum_value = str8(checksums_data[checksum_kind] + checksums_element_sizes[checksum_kind]*checksum_idx, checksums_element_sizes[checksum_kind]);
|
||||
String8List checksum_vals = numeric_str8_list_from_data(arena, 16, checksum_value, 1);
|
||||
StringJoin join = {0};
|
||||
join.sep = str8_lit(", ");
|
||||
String8 checksum_val_string = str8_list_join(arena, &checksum_vals, &join);
|
||||
dumpf("\n { file_path_node_idx: %4u, source_line_map: %4u, checksum_kind: %10S, checksum_value: %192S, path: %-192S } // source_file[%I64u]",
|
||||
source_file->file_path_node_idx,
|
||||
source_file->source_line_map_idx,
|
||||
checksum_kind_name,
|
||||
checksum_val_string,
|
||||
push_str8f(arena, "'%S'", str8_from_rdi_string_idx(rdi, source_file->normal_full_path_string_idx)),
|
||||
idx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user