[Lldb-commits] [lldb] r132807 - in /lldb/trunk: scripts/Python/modify-python-lldb.py test/python_api/function_symbol/TestDisasmAPI.py

Johnny Chen johnny.chen at apple.com
Thu Jun 9 15:04:56 PDT 2011


Author: johnny
Date: Thu Jun  9 17:04:56 2011
New Revision: 132807

URL: http://llvm.org/viewvc/llvm-project?rev=132807&view=rev
Log:
Add rich comparison methods for the SBAddress object.
If two SBAddress's have the same module and file address, they are considered equal.

Add a test snippet 'sa1 == sa2' to exercise the rich comparison methods for SBAddress.

Modified:
    lldb/trunk/scripts/Python/modify-python-lldb.py
    lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py

Modified: lldb/trunk/scripts/Python/modify-python-lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=132807&r1=132806&r2=132807&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Thu Jun  9 17:04:56 2011
@@ -88,7 +88,8 @@
 #
 # This dictionary defines a mapping from classname to equality method name(s).
 #
-e = { 'SBBreakpoint': ['GetID'],
+e = { 'SBAddress':    ['GetFileAddress', 'GetModule'],
+      'SBBreakpoint': ['GetID'],
       'SBFileSpec':   ['GetFilename', 'GetDirectory'],
       'SBModule':     ['GetFileSpec', 'GetUUIDString']
       }

Modified: lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py?rev=132807&r1=132806&r2=132807&view=diff
==============================================================================
--- lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py (original)
+++ lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py Thu Jun  9 17:04:56 2011
@@ -102,18 +102,23 @@
 
         sa1 = symbol.GetStartAddress()
         #print "sa1:", sa1
+        print "sa1.GetFileAddress():", sa1.GetFileAddress()
         #ea1 = symbol.GetEndAddress()
         #print "ea1:", ea1
+        print "ea1.GetFileAddress():", sa1.GetFileAddress()
         sa2 = function.GetStartAddress()
         #print "sa2:", sa2
+        print "sa2.GetFileAddress():", sa2.GetFileAddress()
         #ea2 = function.GetEndAddress()
         #print "ea2:", ea2
+        self.assertTrue(sa1 and sa2 and sa1 == sa2,
+                        "The two starting addresses should be the same")
 
         from lldbutil import get_description
         desc1 = get_description(sa1)
         desc2 = get_description(sa2)
         self.assertTrue(desc1 and desc2 and desc1 == desc2,
-                        "The two starting addresses should be the same")
+                        "SBAddress.GetDescription() API of sa1 and sa2 should return the same string")
 
         
 if __name__ == '__main__':





More information about the lldb-commits mailing list