Skip to content

Commit acbb119

Browse files
FalseHonestyawesomekling
authored andcommitted
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 :^)
1 parent 1942c10 commit acbb119

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Userland/Libraries/LibDebug/DebugInfo.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static Optional<Dwarf::DIE> parse_variable_type_die(const Dwarf::DIE& variable_d
215215
variable_info.type_name = type_name.value().data.as_string;
216216
} else {
217217
dbgln("Unnamed DWARF type at offset: {}", type_die.offset());
218-
variable_info.name = "[Unnamed Type]";
218+
variable_info.type_name = "[Unnamed Type]";
219219
}
220220

221221
return type_die;
@@ -263,7 +263,9 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE
263263
}
264264

265265
NonnullOwnPtr<VariableInfo> variable_info = make<VariableInfo>();
266-
variable_info->name = variable_die.get_attribute(Dwarf::Attribute::Name).value().data.as_string;
266+
auto name_attribute = variable_die.get_attribute(Dwarf::Attribute::Name);
267+
if (name_attribute.has_value())
268+
variable_info->name = name_attribute.value().data.as_string;
267269

268270
auto type_die = parse_variable_type_die(variable_die, *variable_info);
269271

0 commit comments

Comments
 (0)