[Lldb-commits] [lldb] 7dc324a - [lldb] Fix crash in FormatEntity for mangled-name

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 8 18:38:26 PST 2021


Author: Dave Lee
Date: 2021-02-08T18:38:08-08:00
New Revision: 7dc324aafa2b17a4f9a992b9727a3642505053a6

URL: https://github.com/llvm/llvm-project/commit/7dc324aafa2b17a4f9a992b9727a3642505053a6
DIFF: https://github.com/llvm/llvm-project/commit/7dc324aafa2b17a4f9a992b9727a3642505053a6.diff

LOG: [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

Added: 
    

Modified: 
    lldb/source/Core/FormatEntity.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index d491ac14bec8..0ffd59938897 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -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] ");


        


More information about the lldb-commits mailing list