[Lldb-commits] [lldb] Add doc strings for SBValue::IsValid and SBValue::GetError. (PR #94007)
via lldb-commits
lldb-commits at lists.llvm.org
Fri May 31 11:45:05 PDT 2024
https://github.com/jimingham created https://github.com/llvm/llvm-project/pull/94007
The IsValid API is actually quite weak - it means "this value can't answer any questions meaningfully." But I've run into a couple cases where people thought it meant "was able to reconstruct the value on this stop" which it does not mean.
These additions should clear that up.
>From e024ea45c052411f2e7284c0ef5a6d048681cad7 Mon Sep 17 00:00:00 2001
From: Jim Ingham <jingham at apple.com>
Date: Fri, 31 May 2024 11:29:27 -0700
Subject: [PATCH] Add doc strings for SBValue::IsValid and SBValue::GetError.
The IsValid API is actually quite weak - it means "this value can't
answer any questions meaningfully." But I've run into a couple cases
where people thought it meant "was able to reconstruct the value on
this stop" which it does not mean.
These additions should clear that up.
---
lldb/bindings/interface/SBValueDocstrings.i | 30 +++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/lldb/bindings/interface/SBValueDocstrings.i b/lldb/bindings/interface/SBValueDocstrings.i
index 59fa807f5ec95..7abbfe58dc5ea 100644
--- a/lldb/bindings/interface/SBValueDocstrings.i
+++ b/lldb/bindings/interface/SBValueDocstrings.i
@@ -45,6 +45,36 @@ SBValue instance which interprets the value object as representing the head of a
linked list."
) lldb::SBValue;
+%feature("docstring", "
+Returns true if the SBValue holds any useful state
+and false otherwise.
+IsValid is a very weak API, lldb will only return
+invalid SBValues if it has no useful information
+about the SBValue.
+The two main ways you will end up with an invalid
+SBValue are:
+1) default constructed SBValues are not valid.
+2) SBValues that have outlived their SBTarget are
+no longer valid since its not safe to ask them
+questions.
+"
+) lldb::SBValue::IsValid
+
+%feature("docstring", "
+SBValues use the lldb::SBError object returned by
+this API to report construction errors when the SBValue
+is made; and on each stop, the SBError will tell you
+whether lldb could successfully determine the value for
+this program entity represented by this SBValue.
+
+For instance, if you made an SBValue to
+represent a local variable, and then stepped to a PC where
+the variable was unavailable due to optimization, then
+GetError().Success() will be false for this stop, and the
+error string will have more information about the failure.
+"
+) lldb::SBValue::GetError
+
%feature("docstring", "
Get a child value by index from a value.
More information about the lldb-commits
mailing list