[Lldb-commits] [lldb] r133277 - in /lldb/trunk/test/hello_world: Makefile TestHelloWorld.py

Johnny Chen johnny.chen at apple.com
Fri Jun 17 11:47:58 PDT 2011


Author: johnny
Date: Fri Jun 17 13:47:58 2011
New Revision: 133277

URL: http://llvm.org/viewvc/llvm-project?rev=133277&view=rev
Log:
Localize the finding of our to-be-debugged executable in one spot during the setUp() phase.
Change the executable name to be "hello_world".

Modified:
    lldb/trunk/test/hello_world/Makefile
    lldb/trunk/test/hello_world/TestHelloWorld.py

Modified: lldb/trunk/test/hello_world/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/hello_world/Makefile?rev=133277&r1=133276&r2=133277&view=diff
==============================================================================
--- lldb/trunk/test/hello_world/Makefile (original)
+++ lldb/trunk/test/hello_world/Makefile Fri Jun 17 13:47:58 2011
@@ -1,5 +1,6 @@
 LEVEL = ../make
 
 C_SOURCES := main.c
+EXE := hello_world
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/trunk/test/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/hello_world/TestHelloWorld.py?rev=133277&r1=133276&r2=133277&view=diff
==============================================================================
--- lldb/trunk/test/hello_world/TestHelloWorld.py (original)
+++ lldb/trunk/test/hello_world/TestHelloWorld.py Fri Jun 17 13:47:58 2011
@@ -39,6 +39,8 @@
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
+        # Get the full path to our executable to be debugged.
+        self.exe = os.path.join(os.getcwd(), "hello_world")
         # Find a couple of the line numbers within main.c.
         self.line1 = line_number('main.c', '// Set break point at this line.')
         self.line2 = line_number('main.c', '// Waiting to be attached...')
@@ -46,9 +48,7 @@
     def hello_world_python(self, useLaunchAPI):
         """Create target, breakpoint, launch a process, and then kill it."""
 
-        exe = os.path.join(os.getcwd(), "a.out")
-
-        target = self.dbg.CreateTarget(exe)
+        target = self.dbg.CreateTarget(self.exe)
 
         breakpoint = target.BreakpointCreateByLocation("main.c", self.line1)
 
@@ -93,13 +93,11 @@
     def hello_world_attach_api(self):
         """Create target, breakpoint, spawn a process, and attach to it."""
 
-        exe = os.path.join(os.getcwd(), "a.out")
-
-        target = self.dbg.CreateTarget(exe)
+        target = self.dbg.CreateTarget(self.exe)
 
         # Spawn a new process.
         import subprocess
-        popen = subprocess.Popen([exe, "abc", "xyz"])
+        popen = subprocess.Popen([self.exe, "abc", "xyz"])
         #print "pid of spawned process: %d" % popen.pid
 
         listener = lldb.SBListener("my.attach.listener")





More information about the lldb-commits mailing list