From ee8562ed97ef49d460d1e645c4d34c018bc0c795 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Tue, 10 Feb 2026 23:58:45 -0800 Subject: [PATCH] fix type for the implicit const --- src/dwarf/dwarf.h | 2 +- src/dwarf/dwarf_parse.c | 12 ++++++------ src/dwarf/dwarf_parse.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dwarf/dwarf.h b/src/dwarf/dwarf.h index 587bedf1..960202a3 100644 --- a/src/dwarf/dwarf.h +++ b/src/dwarf/dwarf.h @@ -514,7 +514,7 @@ typedef struct DW_Form U64 strx; U64 rnglistx; U64 ptr; - U64 implicit_const; + S64 implicit_const; }; } DW_Form; diff --git a/src/dwarf/dwarf_parse.c b/src/dwarf/dwarf_parse.c index 1168d705..80d9b055 100644 --- a/src/dwarf/dwarf_parse.c +++ b/src/dwarf/dwarf_parse.c @@ -487,16 +487,16 @@ dw_read_abbrev_attrib(String8 data, U64 offset, DW_Abbrev *out_abbrev) TryRead(str8_deserial_read_uleb128(data, cursor, &kind), cursor, exit); // read implicit const - U64 implicit_const = 0; + S64 implicit_const = 0; if (kind == DW_Form_ImplicitConst) { - TryRead(str8_deserial_read_uleb128(data, cursor, &implicit_const), cursor, exit); + TryRead(str8_deserial_read_sleb128(data, cursor, &implicit_const), cursor, exit); } if (out_abbrev != 0) { DW_Abbrev abbrev = { .kind = DW_Abbrev_Attrib, .sub_kind = kind, .id = id }; if (kind == DW_Form_ImplicitConst) { - abbrev.flags |= DW_AbbrevFlag_HasImplicitConst; - abbrev.const_value = implicit_const; + abbrev.flags |= DW_AbbrevFlag_HasImplicitConst; + abbrev.implicit_const = implicit_const; } *out_abbrev = abbrev; } @@ -585,7 +585,7 @@ dw_read_form(String8 data, DW_Format unit_format, U64 address_size, DW_FormKind form_kind, - U64 implicit_const, + S64 implicit_const, DW_Form *form_out, U64 *bytes_read_out) { @@ -815,7 +815,7 @@ dw_read_tag(Arena *arena, // read form value DW_Form form = {0}; U64 form_size = 0; - if (!dw_read_form(str8_skip(tag_data, tag_cursor), version, format, address_size, form_kind, attrib_abbrev.const_value, &form, &form_size)) { + if (!dw_read_form(str8_skip(tag_data, tag_cursor), version, format, address_size, form_kind, attrib_abbrev.implicit_const, &form, &form_size)) { goto exit; } tag_cursor += form_size; diff --git a/src/dwarf/dwarf_parse.h b/src/dwarf/dwarf_parse.h index 243e155c..be823410 100644 --- a/src/dwarf/dwarf_parse.h +++ b/src/dwarf/dwarf_parse.h @@ -77,7 +77,7 @@ typedef struct DW_Abbrev DW_AbbrevKind kind; U64 sub_kind; U64 id; - U64 const_value; + S64 implicit_const; DW_AbbrevFlags flags; } DW_Abbrev; @@ -447,7 +447,7 @@ internal U64 dw_abbrev_offset_from_abbrev_id(DW_AbbrevTable table, U6 // form and tag -internal B32 dw_read_form (String8 data, DW_Version version, DW_Format unit_format, U64 address_size, DW_FormKind form_kind, U64 implicit_const, DW_Form *form_out, U64 *bytes_read_out); +internal B32 dw_read_form (String8 data, DW_Version version, DW_Format unit_format, U64 address_size, DW_FormKind form_kind, S64 implicit_const, DW_Form *form_out, U64 *bytes_read_out); internal U64 dw_read_tag (Arena *arena, DW_Input *input, DW_AbbrevTable abbrev_table, DW_Version version, DW_Format format, U64 address_size, Rng1U64 cu_info_range, U64 tag_info_off, DW_Tag *tag_out); internal U64 dw_read_tag_cu(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 info_off, DW_Tag *tag_out);