Add usage docstring to SBValue.h, and minor update of docstrings for SBValueList.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135230 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/examples/python/disasm.py b/examples/python/disasm.py
index 67a7c6d..732cf10 100755
--- a/examples/python/disasm.py
+++ b/examples/python/disasm.py
@@ -95,7 +95,7 @@
#print value
print "%s (number of children = %d):" % (value.GetName(), value.GetNumChildren())
for child in value:
- print "Name: ", child.GetName(), " Value: ", child.GetValue(frame)
+ print "Name: ", child.GetName(), " Value: ", child.GetValue()
print "Hit the breakpoint at main, enter to continue and wait for program to exit or 'Ctrl-D'/'quit' to terminate the program"
next = sys.stdin.readline()
diff --git a/include/lldb/API/SBValue.h b/include/lldb/API/SBValue.h
index e4d4f50..40a4612 100644
--- a/include/lldb/API/SBValue.h
+++ b/include/lldb/API/SBValue.h
@@ -18,7 +18,47 @@
#ifdef SWIG
%feature("docstring",
- "Represents the value of a variable, a register, or an expression."
+"Represents the value of a variable, a register, or an expression.
+
+SBValue supports iteration through its child, which in turn is represented
+as an SBValue. For example, we can get the general purpose registers of a
+frame as an SBValue, and iterate through all the registers,
+
+ registerSet = frame.GetRegisters() # Returns an SBValueList.
+ for regs in registerSet:
+ if 'general purpose registers' in regs.getName().lower():
+ GPRs = regs
+ break
+
+ print '%s (number of children = %d):' % (GPRs.GetName(), GPRs.GetNumChildren())
+ for reg in GPRs:
+ print 'Name: ', reg.GetName(), ' Value: ', reg.GetValue()
+
+produces the output:
+
+General Purpose Registers (number of children = 21):
+Name: rax Value: 0x0000000100000c5c
+Name: rbx Value: 0x0000000000000000
+Name: rcx Value: 0x00007fff5fbffec0
+Name: rdx Value: 0x00007fff5fbffeb8
+Name: rdi Value: 0x0000000000000001
+Name: rsi Value: 0x00007fff5fbffea8
+Name: rbp Value: 0x00007fff5fbffe80
+Name: rsp Value: 0x00007fff5fbffe60
+Name: r8 Value: 0x0000000008668682
+Name: r9 Value: 0x0000000000000000
+Name: r10 Value: 0x0000000000001200
+Name: r11 Value: 0x0000000000000206
+Name: r12 Value: 0x0000000000000000
+Name: r13 Value: 0x0000000000000000
+Name: r14 Value: 0x0000000000000000
+Name: r15 Value: 0x0000000000000000
+Name: rip Value: 0x0000000100000dae
+Name: rflags Value: 0x0000000000000206
+Name: cs Value: 0x0000000000000027
+Name: fs Value: 0x0000000000000010
+Name: gs Value: 0x0000000000000048
+"
) SBValue;
#endif
class SBValue
diff --git a/include/lldb/API/SBValueList.h b/include/lldb/API/SBValueList.h
index 364ed91..2cff8a7 100644
--- a/include/lldb/API/SBValueList.h
+++ b/include/lldb/API/SBValueList.h
@@ -19,7 +19,7 @@
"Represents a collection of SBValues. Both SBFrame's GetVariables() and
GetRegisters() return a SBValueList.
-For example (from test/lldbutil.py),
+SBValueList supports SBValue iteration. For example (from test/lldbutil.py),
def get_registers(frame, kind):
'''Returns the registers given the frame and the kind of registers desired.