Added a test case test_breakpoint_creation_by_filespec_python() which creates a
breakpoint by FileSpec and line number and exercises some FileSpec APIs. Also, RUN_STOPPED is a bad assert name, RUN_SUCCEEDED is better. llvm-svn: 112327
This commit is contained in:
parent
a56984c72f
commit
5ee881948a
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue