diff options
author | jimingham <jingham@apple.com> | 2024-05-31 10:43:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 10:43:05 -0700 |
commit | 1e81b67925fdd77a3d65ba2a7f652d1e840512f4 (patch) | |
tree | ae6bc91a2794c694002c92a2290d029155255cdb /lldb/source/DataFormatters/FormatManager.cpp | |
parent | 7caa812f2707fa3649c01000de6550dac226ce87 (diff) | |
download | llvm-1e81b67925fdd77a3d65ba2a7f652d1e840512f4.zip llvm-1e81b67925fdd77a3d65ba2a7f652d1e840512f4.tar.gz llvm-1e81b67925fdd77a3d65ba2a7f652d1e840512f4.tar.bz2 |
[lldb] FormatManager::GetPossibleMatches assumes all ValueObjects have targets. (#93880)
But one made in a situation where that's impossible might only have an
error, and no symbol context, so that's not necessarily true. Check for
the target's validity before using it.
Fixes issue #93313
Diffstat (limited to 'lldb/source/DataFormatters/FormatManager.cpp')
-rw-r--r-- | lldb/source/DataFormatters/FormatManager.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index d7ba5b4..6076595 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -176,8 +176,14 @@ void FormatManager::GetPossibleMatches( FormattersMatchCandidate::Flags current_flags, bool root_level) { compiler_type = compiler_type.GetTypeForFormatters(); ConstString type_name(compiler_type.GetTypeName()); + // A ValueObject that couldn't be made correctly won't necessarily have a + // target. We aren't going to find a formatter in this case anyway, so we + // should just exit. + TargetSP target_sp = valobj.GetTargetSP(); + if (!target_sp) + return; ScriptInterpreter *script_interpreter = - valobj.GetTargetSP()->GetDebugger().GetScriptInterpreter(); + target_sp->GetDebugger().GetScriptInterpreter(); if (valobj.GetBitfieldBitSize() > 0) { StreamString sstring; sstring.Printf("%s:%d", type_name.AsCString(), valobj.GetBitfieldBitSize()); |