[Lldb-commits] [lldb] r129797 - /lldb/trunk/test/python_api/thread/TestThreadAPI.py

Johnny Chen johnny.chen at apple.com
Tue Apr 19 13:11:58 PDT 2011


Author: johnny
Date: Tue Apr 19 15:11:58 2011
New Revision: 129797

URL: http://llvm.org/viewvc/llvm-project?rev=129797&view=rev
Log:
Converted to use SBProcess.LaunchSimple().
And use self.TraceOn() API.

Modified:
    lldb/trunk/test/python_api/thread/TestThreadAPI.py

Modified: lldb/trunk/test/python_api/thread/TestThreadAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/TestThreadAPI.py?rev=129797&r1=129796&r2=129797&view=diff
==============================================================================
--- lldb/trunk/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/trunk/test/python_api/thread/TestThreadAPI.py Tue Apr 19 15:11:58 2011
@@ -107,7 +107,6 @@
     def get_process(self):
         """Test Python SBThread.GetProcess() API."""
         exe = os.path.join(os.getcwd(), "a.out")
-        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target.IsValid(), VALID_TARGET)
@@ -117,8 +116,7 @@
         self.runCmd("breakpoint list")
 
         # Launch the process, and do not stop at the entry point.
-        error = lldb.SBError()
-        self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
+        self.process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
         self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
@@ -131,7 +129,6 @@
     def get_stop_description(self):
         """Test Python SBThread.GetStopDescription() API."""
         exe = os.path.join(os.getcwd(), "a.out")
-        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target.IsValid(), VALID_TARGET)
@@ -141,8 +138,7 @@
         #self.runCmd("breakpoint list")
 
         # Launch the process, and do not stop at the entry point.
-        error = lldb.SBError()
-        self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
+        self.process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
         self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
@@ -158,7 +154,6 @@
     def step_out_of_malloc_into_function_b(self):
         """Test Python SBThread.StepOut() API to step out of a malloc call where the call site is at function b()."""
         exe = os.path.join(os.getcwd(), "a.out")
-        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target.IsValid(), VALID_TARGET)
@@ -168,8 +163,7 @@
         self.runCmd("breakpoint list")
 
         # Launch the process, and do not stop at the entry point.
-        error = lldb.SBError()
-        self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
+        self.process = target.LaunchSimple(None, None, os.getcwd())
 
         while True:
             thread = get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
@@ -193,7 +187,6 @@
     def step_over_3_times(self):
         """Test Python SBThread.StepOver() API."""
         exe = os.path.join(os.getcwd(), "a.out")
-        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target.IsValid(), VALID_TARGET)
@@ -203,8 +196,7 @@
         self.runCmd("breakpoint list")
 
         # Launch the process, and do not stop at the entry point.
-        error = lldb.SBError()
-        self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
+        self.process = target.LaunchSimple(None, None, os.getcwd())
 
         self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
 
@@ -236,7 +228,6 @@
         self.setTearDownCleanup(dictionary=d)
 
         exe = os.path.join(os.getcwd(), "a.out")
-        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target.IsValid(), VALID_TARGET)
@@ -246,8 +237,7 @@
         self.runCmd("breakpoint list")
 
         # Launch the process, and do not stop at the entry point.
-        error = lldb.SBError()
-        self.process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
+        self.process = target.LaunchSimple(None, None, os.getcwd())
 
         self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
 
@@ -262,9 +252,10 @@
 
         # Get the start/end addresses for this line entry.
         start_addr = lineEntry.GetStartAddress().GetLoadAddress(target)
-        print "start addr:", hex(start_addr)
         end_addr = lineEntry.GetEndAddress().GetLoadAddress(target)
-        print "end addr:", hex(end_addr)
+        if self.TraceOn():
+            print "start addr:", hex(start_addr)
+            print "end addr:", hex(end_addr)
 
         # Disable the breakpoint.
         self.assertTrue(target.DisableAllBreakpoints())





More information about the lldb-commits mailing list