printer for S_LABEL

This commit is contained in:
Nikita Smith
2025-01-23 20:38:43 -08:00
parent 53db7ee712
commit b007e4c0e5
3 changed files with 29 additions and 3 deletions
+16
View File
@@ -1,6 +1,12 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
internal String8
cv_string_from_unknown_value(Arena *arena, U32 x)
{
return push_str8f(arena, "%#x", x);
}
internal String8
cv_string_from_type_index_source(CV_TypeIndexSource ti_source)
{
@@ -307,6 +313,16 @@ cv_string_from_c13_checksum_kind(CV_C13ChecksumKind x)
return str8_zero();
}
internal String8
cv_string_from_label_kind(Arena *arena, CV_LabelKind x)
{
switch (x) {
case CV_LabelKind_Near: return str8_lit("Near");
case CV_LabelKind_Far: return str8_lit("Far");
}
return cv_string_from_unknown_value(arena, x);
}
internal String8
cv_string_from_c13_subsection_kind(CV_C13SubSectionKind x)
{
+1
View File
@@ -23,6 +23,7 @@ internal String8 cv_string_from_member_pointer_kind(CV_MemberPointerKind x);
internal String8 cv_string_from_pointer_kind(CV_PointerKind x);
internal String8 cv_string_from_pointer_mode(CV_PointerMode x);
internal String8 cv_string_from_c13_checksum_kind(CV_C13ChecksumKind x);
internal String8 cv_string_from_label_kind(Arena *arena, CV_LabelKind x);
internal String8 cv_string_from_c13_subsection_kind(CV_C13SubSectionKind x);
internal String8 cv_string_from_modifier_flags(Arena *arena, CV_ModifierFlags x);
internal String8 cv_string_from_pointer_attribs(Arena *arena, CV_PointerAttribs x);
+12 -3
View File
@@ -4084,7 +4084,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
} break;
case CV_LeafKind_MEMBER_ST:
case CV_LeafKind_MEMBER: {
CV_LeafMember lf = {0};
CV_LeafMember lf = {0};
CV_NumericParsed num = {0};
String8 name = {0};
cursor += str8_deserial_read_struct(raw_leaf, cursor, &lf);
@@ -4096,6 +4096,17 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
rd_printf("Type: %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype));
rd_printf("Offset: %S", cv_string_from_numeric(scratch.arena, num));
} break;
case CV_LeafKind_LABEL: {
CV_LeafLabel lf = {0};
cursor += str8_deserial_read_struct(raw_leaf, cursor, &lf);
rd_printf("Kind: %S", cv_string_from_label_kind(scratch.arena, lf.kind));
} break;
case CV_LeafKind_ENDPRECOMP: {
CV_LeafEndPreComp lf = {0};
cursor += str8_deserial_read_struct(raw_leaf, cursor, &lf);
rd_printf("Sig: %#x", lf.sig);
} break;
// 16bit
case CV_LeafKind_OEM_16t:
case CV_LeafKind_MODIFIER_16t:
@@ -4145,8 +4156,6 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
// Manged
case CV_LeafKind_MANAGED_ST:
// undefined
case CV_LeafKind_LABEL:
case CV_LeafKind_ENDPRECOMP:
case CV_LeafKind_LIST:
case CV_LeafKind_REFSYM:
case CV_LeafKind_BARRAY: