summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api/target/TestTargetAPI.py
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-03-03 19:14:00 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-03-03 19:14:00 +0000
commited4019802d2f1bbb9db9349b9cadb3047abf99cc (patch)
treeab8f4c3d3218af980448cb515a7d5a5dbabcbc2c /lldb/test/python_api/target/TestTargetAPI.py
parentc8d0d3ae0bc515855de1e1741012e14ec1154b33 (diff)
downloadbcm5719-llvm-ed4019802d2f1bbb9db9349b9cadb3047abf99cc.tar.gz
bcm5719-llvm-ed4019802d2f1bbb9db9349b9cadb3047abf99cc.zip
Add TestDisasmAPI.py which exercises the newly added SBFunction/SBSymbol.GetStartAddress(),
among other things: // When stopped on breakppint 1, we can get the line entry using SBFrame API // SBFrame.GetLineEntry(). We'll get the start address for the the line entry // with the SBAddress type, resolve the symbol context using the SBTarget API // SBTarget.ResolveSymbolContextForAddress() in order to get the SBSymbol. // // We then stop at breakpoint 2, get the SBFrame, and the the SBFunction object. // // The address from calling GetStartAddress() on the symbol and the function // should point to the same address, and we also verify that. And add one utility function disassemble(target, function_or_symbol) to lldbutil.py: """Disassemble the function or symbol given a target. It returns the disassembly content in a string object. """ TestDisasm.py uses the disassemble() function to do disassembly on the SBSymbol, and then the SBFunction object. llvm-svn: 126955
Diffstat (limited to 'lldb/test/python_api/target/TestTargetAPI.py')
-rw-r--r--lldb/test/python_api/target/TestTargetAPI.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py
index 0c5f806bc72..7c3bd97b769 100644
--- a/lldb/test/python_api/target/TestTargetAPI.py
+++ b/lldb/test/python_api/target/TestTargetAPI.py
@@ -43,8 +43,8 @@ class TargetAPITestCase(TestBase):
# Now create the two breakpoints inside function 'a'.
breakpoint1 = target.BreakpointCreateByLocation('main.c', self.line1)
breakpoint2 = target.BreakpointCreateByLocation('main.c', self.line2)
- print "breakpoint1:", breakpoint1
- print "breakpoint2:", breakpoint2
+ #print "breakpoint1:", breakpoint1
+ #print "breakpoint2:", breakpoint2
self.assertTrue(breakpoint1.IsValid() and
breakpoint1.GetNumLocations() == 1,
VALID_BREAKPOINT)
@@ -62,7 +62,8 @@ class TargetAPITestCase(TestBase):
# Frame #0 should be on self.line1.
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
- self.runCmd("process status")
+ self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+ #self.runCmd("process status")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
self.assertTrue(lineEntry.GetLine() == self.line1)
@@ -73,30 +74,31 @@ class TargetAPITestCase(TestBase):
self.process.Continue()
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
- self.runCmd("process status")
+ self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+ #self.runCmd("process status")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
self.assertTrue(lineEntry.GetLine() == self.line2)
address2 = lineEntry.GetStartAddress()
- print "address1:", address1
- print "address2:", address2
+ #print "address1:", address1
+ #print "address2:", address2
# Now call SBTarget.ResolveSymbolContextForAddress() with the addresses from our line entry.
context1 = target.ResolveSymbolContextForAddress(address1, lldb.eSymbolContextEverything)
context2 = target.ResolveSymbolContextForAddress(address2, lldb.eSymbolContextEverything)
self.assertTrue(context1.IsValid() and context2.IsValid())
- print "context1:", context1
- print "context2:", context2
+ #print "context1:", context1
+ #print "context2:", context2
# Verify that the context point to the same function 'a'.
symbol1 = context1.GetSymbol()
symbol2 = context2.GetSymbol()
self.assertTrue(symbol1.IsValid() and symbol2.IsValid())
- print "symbol1:", symbol1
- print "symbol2:", symbol2
+ #print "symbol1:", symbol1
+ #print "symbol2:", symbol2
stream1 = lldb.SBStream()
symbol1.GetDescription(stream1)
OpenPOWER on IntegriCloud