[Lldb-commits] [lldb] [lldb] Make sure Status is updated in GetFrameBaseValue (PR #111882)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 10 11:16:56 PDT 2024


https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/111882

This fixes the following assertion: "Cannot create Expected<T> from Error success value." The problem was that GetFrameBaseValue return false without updating the Status argument. This patch makes sure that every return path updates the Status if the pointer is valid.

>From e00c696685b41ce0bbe215bac5ba618641ddef7e Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Thu, 10 Oct 2024 11:15:13 -0700
Subject: [PATCH] [lldb] Make sure Status is updated in GetFrameBaseValue

This fixes the following assertion: "Cannot create Expected<T> from
Error success value." The problem was that GetFrameBaseValue return
false without updating the Status argument. This patch makes sure that
every return path updates the Status if the pointer is valid.
---
 lldb/source/Target/StackFrame.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index fe0d4c93c50627..730ec0387917f8 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1084,7 +1084,9 @@ bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Status *error_ptr) {
   if (!m_cfa_is_valid) {
     m_frame_base_error = Status::FromErrorString(
         "No frame base available for this historical stack frame.");
-    return false;
+    if (error_ptr)
+      *error_ptr = m_frame_base_error.Clone();
+    return m_frame_base_error.Success();
   }
 
   if (m_flags.IsClear(GOT_FRAME_BASE)) {



More information about the lldb-commits mailing list