[Lldb-commits] [lldb] [lldb/Target] Add null-check before dereferencing inlined_info (NFC) (PR #116300)

via lldb-commits lldb-commits at lists.llvm.org
Sat Nov 16 06:15:36 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

<details>
<summary>Changes</summary>

This patch is a follow-up to 9c7701fa78037af03be10ed168fd3c75a2ed1aef and adds extra-null checks before dereferencing the inlined_info pointer.

---
Full diff: https://github.com/llvm/llvm-project/pull/116300.diff


1 Files Affected:

- (modified) lldb/source/Target/StackFrame.cpp (+4-2) 


``````````diff
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 77179fec3ed438..1bca9786fb7c70 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1239,7 +1239,8 @@ const char *StackFrame::GetFunctionName() {
     if (inlined_block) {
       const InlineFunctionInfo *inlined_info =
           inlined_block->GetInlinedFunctionInfo();
-      name = inlined_info->GetName().AsCString();
+      if (inlined_info)
+        name = inlined_info->GetName().AsCString();
     }
   }
 
@@ -1265,7 +1266,8 @@ const char *StackFrame::GetDisplayFunctionName() {
     if (inlined_block) {
       const InlineFunctionInfo *inlined_info =
           inlined_block->GetInlinedFunctionInfo();
-      name = inlined_info->GetDisplayName().AsCString();
+      if (inlined_info)
+        name = inlined_info->GetDisplayName().AsCString();
     }
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/116300


More information about the lldb-commits mailing list