[Lldb-commits] [PATCH] D96307: [lldb] Fix crash in FormatEntity for mangled-name

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 8 17:40:35 PST 2021


kastiglione created this revision.
kastiglione added a reviewer: mib.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96307

Files:
  lldb/source/Core/FormatEntity.cpp


Index: lldb/source/Core/FormatEntity.cpp
===================================================================
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -1769,7 +1769,7 @@
       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] ");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96307.322252.patch
Type: text/x-patch
Size: 513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210209/2ad17cef/attachment.bin>


More information about the lldb-commits mailing list