diff --git a/lldb/test/array_types/TestArrayTypes.py b/lldb/test/array_types/TestArrayTypes.py index 9f679e32eff1..abdf05b7f772 100644 --- a/lldb/test/array_types/TestArrayTypes.py +++ b/lldb/test/array_types/TestArrayTypes.py @@ -18,7 +18,7 @@ class TestArrayTypes(TestBase): self.expect("breakpoint set -f main.c -l 42", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.c', line = 42, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, @@ -62,7 +62,7 @@ class TestArrayTypes(TestBase): breakpoint = target.BreakpointCreateByLocation("main.c", 42) self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT) - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # This does not work, and results in the process stopped at dyld_start? #process = target.LaunchProcess([''], [''], os.ctermid(), False) diff --git a/lldb/test/bitfields/TestBitfields.py b/lldb/test/bitfields/TestBitfields.py index 886f5e8f1b35..c3428449e5be 100644 --- a/lldb/test/bitfields/TestBitfields.py +++ b/lldb/test/bitfields/TestBitfields.py @@ -19,7 +19,7 @@ class TestBitfields(TestBase): self.expect("breakpoint set -f main.c -l 42", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.c', line = 42, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, @@ -63,7 +63,7 @@ class TestBitfields(TestBase): breakpoint = target.BreakpointCreateByLocation("main.c", 42) self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT) - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # This does not work, and results in the process stopped at dyld_start? #process = target.LaunchProcess([''], [''], os.ctermid(), False) diff --git a/lldb/test/class_types/TestClassTypes.py b/lldb/test/class_types/TestClassTypes.py index a9b664206531..6f9c81d5926b 100644 --- a/lldb/test/class_types/TestClassTypes.py +++ b/lldb/test/class_types/TestClassTypes.py @@ -18,7 +18,7 @@ class TestClassTypes(TestBase): self.expect("breakpoint set -f main.cpp -l 73", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.cpp', line = 73, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, @@ -33,6 +33,25 @@ class TestClassTypes(TestBase): self.expect("variable list this", VARIABLES_DISPLAYED_CORRECTLY, startstr = '(class C *const) this = ') + def test_breakpoint_creation_by_filespec_python(self): + """Use Python APIs to create a breakpoint by (filespec, line).""" + exe = os.path.join(os.getcwd(), "a.out") + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target.IsValid(), VALID_TARGET) + + filespec = target.GetExecutable() + self.assertTrue(filespec.IsValid(), VALID_FILESPEC) + + breakpoint = target.BreakpointCreateByLocation(filespec, 73) + self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT) + + fsDir = filespec.GetDirectory() + fsFile = filespec.GetFilename() + + self.assertTrue(fsDir == os.getcwd() and fsFile == "a.out", + "FileSpec matches the executable") + if __name__ == '__main__': import atexit diff --git a/lldb/test/dead-strip/TestDeadStrip.py b/lldb/test/dead-strip/TestDeadStrip.py index 37dd832d4baa..3fd3518dd1d4 100644 --- a/lldb/test/dead-strip/TestDeadStrip.py +++ b/lldb/test/dead-strip/TestDeadStrip.py @@ -28,7 +28,7 @@ class TestDeadStrip(TestBase): self.expect("breakpoint set -s a.out -n f3", BREAKPOINT_CREATED, startstr = "Breakpoint created: 3: name = 'f3', module = a.out, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint (breakpoint #1). self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, diff --git a/lldb/test/enum_types/TestEnumTypes.py b/lldb/test/enum_types/TestEnumTypes.py index bb22c378768b..b8831b58390b 100644 --- a/lldb/test/enum_types/TestEnumTypes.py +++ b/lldb/test/enum_types/TestEnumTypes.py @@ -18,7 +18,7 @@ class TestEnumTypes(TestBase): self.expect("breakpoint set -f main.c -l 26", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.c', line = 26, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, diff --git a/lldb/test/function_types/TestFunctionTypes.py b/lldb/test/function_types/TestFunctionTypes.py index b9190d7d3077..81fb52491db1 100644 --- a/lldb/test/function_types/TestFunctionTypes.py +++ b/lldb/test/function_types/TestFunctionTypes.py @@ -18,7 +18,7 @@ class TestFunctionTypes(TestBase): self.expect("breakpoint set -f main.c -l 21", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.c', line = 21, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, diff --git a/lldb/test/global_variables/TestGlobalVariables.py b/lldb/test/global_variables/TestGlobalVariables.py index c12305fd89a3..088a82d6579b 100644 --- a/lldb/test/global_variables/TestGlobalVariables.py +++ b/lldb/test/global_variables/TestGlobalVariables.py @@ -18,7 +18,7 @@ class TestGlobalVariables(TestBase): self.expect("breakpoint set -f main.c -l 20", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.c', line = 20, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 851b2de6794b..9b5975ea9a62 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -117,7 +117,7 @@ import lldb CURRENT_EXECUTABLE_SET = "Current executable set successfully" -RUN_STOPPED = "Process is launched and then stopped successfully" +RUN_SUCCEEDED = "Process is launched successfully" RUN_COMPLETED = "Process exited successfully" @@ -135,6 +135,8 @@ DATA_TYPES_DISPLAYED_CORRECTLY = "Data type(s) displayed correctly" VALID_BREAKPOINT = "Got a valid breakpoint" +VALID_FILESPEC = "Got a valid filespec" + VALID_PROCESS = "Got a valid process" VALID_TARGET = "Got a valid target" diff --git a/lldb/test/load_unload/TestLoadUnload.py b/lldb/test/load_unload/TestLoadUnload.py index d9c014dee406..cdd26487ecac 100644 --- a/lldb/test/load_unload/TestLoadUnload.py +++ b/lldb/test/load_unload/TestLoadUnload.py @@ -20,7 +20,7 @@ class TestLoadUnload(TestBase): self.expect("breakpoint set -n a_function", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: name = 'a_function', locations = 0 (pending)") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint and at a_function. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, diff --git a/lldb/test/macosx/universal/TestUniversal.py b/lldb/test/macosx/universal/TestUniversal.py index 73fced6e7235..98eaa6e2a10c 100644 --- a/lldb/test/macosx/universal/TestUniversal.py +++ b/lldb/test/macosx/universal/TestUniversal.py @@ -25,7 +25,7 @@ class TestUniversal(TestBase): startstr = "Breakpoint created: 1: file ='main.c', line = 5, locations = 1") # We should be able to launch the x86_64 executable. - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # Check whether we have a 64-bit process launched. target = self.dbg.GetSelectedTarget() @@ -46,7 +46,7 @@ class TestUniversal(TestBase): startstr = "Breakpoint created: 1: file ='main.c', line = 5, locations = 1") # We should be able to launch the i386 executable as well. - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # Check whether we have a 32-bit process launched. target = self.dbg.GetSelectedTarget() diff --git a/lldb/test/persistent_variables/TestPersistentVariables.py b/lldb/test/persistent_variables/TestPersistentVariables.py index 64637e3c33fc..3e66965f6dfd 100644 --- a/lldb/test/persistent_variables/TestPersistentVariables.py +++ b/lldb/test/persistent_variables/TestPersistentVariables.py @@ -17,7 +17,7 @@ class TestPersistentVariables(TestBase): self.runCmd("breakpoint set --name main") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) self.runCmd("expr int $i = 5; $i + 1") # $0 = (int)6 diff --git a/lldb/test/set_values/TestSetValues.py b/lldb/test/set_values/TestSetValues.py index b115dee7c561..c1a962188ebb 100644 --- a/lldb/test/set_values/TestSetValues.py +++ b/lldb/test/set_values/TestSetValues.py @@ -30,7 +30,7 @@ class TestSetValues(TestBase): self.expect("breakpoint set -f main.c -l 85", BREAKPOINT_CREATED, startstr = "Breakpoint created: 5: file ='main.c', line = 85, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, diff --git a/lldb/test/stl/TestSTL.py b/lldb/test/stl/TestSTL.py index 95b055154fa9..0d1f69cbd8c2 100644 --- a/lldb/test/stl/TestSTL.py +++ b/lldb/test/stl/TestSTL.py @@ -26,7 +26,7 @@ class TestSTL(TestBase): self.expect("breakpoint set -f main.cpp -l 13", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.cpp', line = 13, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # Stop at 'std::string hello_world ("Hello World!");'. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, diff --git a/lldb/test/struct_types/TestStructTypes.py b/lldb/test/struct_types/TestStructTypes.py index ddd8ec820a8b..2d2297a80973 100644 --- a/lldb/test/struct_types/TestStructTypes.py +++ b/lldb/test/struct_types/TestStructTypes.py @@ -22,7 +22,7 @@ class TestStructTypes(TestBase): self.expect("breakpoint set -f main.c -l 14", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.c', line = 14, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # We should be stopped on the first executable statement within the # function where the original breakpoint was attempted. diff --git a/lldb/test/unsigned_types/TestUnsignedTypes.py b/lldb/test/unsigned_types/TestUnsignedTypes.py index cadee1409223..44147a08067d 100644 --- a/lldb/test/unsigned_types/TestUnsignedTypes.py +++ b/lldb/test/unsigned_types/TestUnsignedTypes.py @@ -21,7 +21,7 @@ class TestUnsignedTypes(TestBase): self.expect("breakpoint set -f main.cpp -l 19", BREAKPOINT_CREATED, startstr = "Breakpoint created: 1: file ='main.cpp', line = 19, locations = 1") - self.runCmd("run", RUN_STOPPED) + self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,