1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibDebug+HackStudio: Fix crashes relating to debugger variable preview

For one, viewing a variable who's type contained a subprogram will
no longer crash HackStudio. Additionally, the variable view will
handle invalid enum values gracefully now, fixing another crash.
Finally, deeply nested (nest count > 1) structures will have their
memory addresses properly set, fixing the final crash I found.
This commit is contained in:
FalseHonesty 2021-04-12 01:30:57 -04:00 committed by Andreas Kling
parent c778164f64
commit d295095993
3 changed files with 10 additions and 9 deletions

View file

@ -83,7 +83,8 @@ static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& var
auto it = variable.type->members.find_if([&enumerator_value = value.value()](const auto& enumerator) {
return enumerator->constant_data.as_u32 == enumerator_value;
});
VERIFY(!it.is_end());
if (it.is_end())
return String::formatted("Unknown ({})", value.value());
return String::formatted("{}::{}", variable.type_name, (*it)->name);
}