[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:33 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: None (jimingham)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/94007.diff
1 Files Affected:
- (modified) lldb/bindings/interface/SBValueDocstrings.i (+30)
``````````diff
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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/94007
More information about the lldb-commits
mailing list