summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio
diff options
context:
space:
mode:
authorFalseHonesty <thefalsehonesty@gmail.com>2021-04-12 01:30:57 -0400
committerAndreas Kling <kling@serenityos.org>2021-04-12 22:43:33 +0200
commitd295095993f5896674995d62319b11dcf2785597 (patch)
tree950b990cecd9eb8e3014928242b0e805de5135b4 /Userland/DevTools/HackStudio
parentc778164f6457ef7a14f0331b80d33b0b6908f170 (diff)
downloadserenity-d295095993f5896674995d62319b11dcf2785597.zip
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.
Diffstat (limited to 'Userland/DevTools/HackStudio')
-rw-r--r--Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
index e010fa997c..973a2e91a3 100644
--- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
@@ -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);
}