From f172181aaae5ba1377d5354c9df0452417cf3bae Mon Sep 17 00:00:00 2001 From: Phireh Date: Sun, 24 Sep 2023 17:15:38 +0200 Subject: [PATCH] fix: deal with null entries in DIE --- main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 6dd1732..5628667 100644 --- a/main.cpp +++ b/main.cpp @@ -175,7 +175,7 @@ void parse_debuginfo_section(const void *file) attr_specs.push_back({attrib_name, attrib_form, implicit_const}); } } while (attrib_name && attrib_form); - abbrev_table.specs.push_back(attr_specs); + abbrev_table.specs.push_back(attr_specs); } while (true); p += sizeof(compilation_unit_header_t); @@ -189,6 +189,9 @@ void parse_debuginfo_section(const void *file) { p += decode_leb128((uint8_t*)p, &code); + if (!code) // null entry, skip and continue as normal + continue; + fprintf(stdout, "%d (%s)\n", code, dwarf_get_TAG_name(abbrev_table.entries[code-1].abbrev_tag)); for (size_t i = 0; i < abbrev_table.specs[code-1].size(); ++i) {