[lldb] Fix crash in FormatEntity for mangled-name

Check a `Block` pointer before dereferencing.

Using `function.mangled-name` led to a crash for a frame where the symbol
context had no block info. In my case, the frame's function was a system frame.

Differential Revision: https://reviews.llvm.org/D96307
This commit is contained in:
Dave Lee 2021-02-08 17:33:53 -08:00
parent 9202806241
commit 7dc324aafa
1 changed files with 1 additions and 1 deletions

View File

@ -1769,7 +1769,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
return false;
s.PutCString(name);
if (sc->block->GetContainingInlinedBlock()) {
if (sc->block && sc->block->GetContainingInlinedBlock()) {
if (const InlineFunctionInfo *inline_info =
sc->block->GetInlinedFunctionInfo()) {
s.PutCString(" [inlined] ");