[Lldb-commits] [lldb] r135230 - in /lldb/trunk: examples/python/disasm.py include/lldb/API/SBValue.h include/lldb/API/SBValueList.h

Johnny Chen johnny.chen at apple.com
Thu Jul 14 17:27:47 PDT 2011


Author: johnny
Date: Thu Jul 14 19:27:47 2011
New Revision: 135230

URL: http://llvm.org/viewvc/llvm-project?rev=135230&view=rev
Log:
Add usage docstring to SBValue.h, and minor update of docstrings for SBValueList.h.

Modified:
    lldb/trunk/examples/python/disasm.py
    lldb/trunk/include/lldb/API/SBValue.h
    lldb/trunk/include/lldb/API/SBValueList.h

Modified: lldb/trunk/examples/python/disasm.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/disasm.py?rev=135230&r1=135229&r2=135230&view=diff
==============================================================================
--- lldb/trunk/examples/python/disasm.py (original)
+++ lldb/trunk/examples/python/disasm.py Thu Jul 14 19:27:47 2011
@@ -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()

Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=135230&r1=135229&r2=135230&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Thu Jul 14 19:27:47 2011
@@ -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

Modified: lldb/trunk/include/lldb/API/SBValueList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValueList.h?rev=135230&r1=135229&r2=135230&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValueList.h (original)
+++ lldb/trunk/include/lldb/API/SBValueList.h Thu Jul 14 19:27:47 2011
@@ -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.





More information about the lldb-commits mailing list