[Lldb-commits] [lldb] Add doc strings for SBValue::IsValid and SBValue::GetError. (PR #94007)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Fri May 31 16:28:11 PDT 2024


================
@@ -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
----------------
bulbazord wrote:

I don't think the update addressed my comment. `GetError` will certainly tell you why something is invalid, but it doesn't specify the consequences of doing the unsafe action of asking the invalid SBValue questions. I guess what I'm asking is, does "not safe" refer to "safety against crashes" or "safety against invalid data"? I assume it's the latter, so I would suggest saying something like "It's not safe to ask them questions, the returned values may look valid even when they are not".

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


More information about the lldb-commits mailing list