From acbb119b27c9d7c9bccc7da093c3d1ce069315a8 Mon Sep 17 00:00:00 2001 From: FalseHonesty Date: Tue, 13 Apr 2021 21:29:01 -0400 Subject: [PATCH] LibDebug: Support unnamed variables and types We were supposed to already support unnamed types, but due to a little typo, we were actually causing more problems :^) --- Userland/Libraries/LibDebug/DebugInfo.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibDebug/DebugInfo.cpp b/Userland/Libraries/LibDebug/DebugInfo.cpp index 853cda962c..5b1c77aa81 100644 --- a/Userland/Libraries/LibDebug/DebugInfo.cpp +++ b/Userland/Libraries/LibDebug/DebugInfo.cpp @@ -215,7 +215,7 @@ static Optional parse_variable_type_die(const Dwarf::DIE& variable_d variable_info.type_name = type_name.value().data.as_string; } else { dbgln("Unnamed DWARF type at offset: {}", type_die.offset()); - variable_info.name = "[Unnamed Type]"; + variable_info.type_name = "[Unnamed Type]"; } return type_die; @@ -263,7 +263,9 @@ OwnPtr DebugInfo::create_variable_info(const Dwarf::DIE } NonnullOwnPtr variable_info = make(); - variable_info->name = variable_die.get_attribute(Dwarf::Attribute::Name).value().data.as_string; + auto name_attribute = variable_die.get_attribute(Dwarf::Attribute::Name); + if (name_attribute.has_value()) + variable_info->name = name_attribute.value().data.as_string; auto type_die = parse_variable_type_die(variable_die, *variable_info);