Add usage docstring to SBValue.h, and minor update of docstrings for SBValueList.h.

llvm-svn: 135230
This commit is contained in:
Johnny Chen 2011-07-15 00:27:47 +00:00
parent 56498d167a
commit 3d3a7cf563
3 changed files with 43 additions and 3 deletions

View File

@ -95,7 +95,7 @@ if target:
#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()

View File

@ -18,7 +18,47 @@ namespace lldb {
#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

View File

@ -19,7 +19,7 @@ namespace lldb {
"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.