[Lldb-commits] [lldb] r230022 - Refactor lldb-mi tests
Ilia K
ki.stfu at gmail.com
Fri Feb 20 08:34:34 PST 2015
Author: ki.stfu
Date: Fri Feb 20 10:34:33 2015
New Revision: 230022
URL: http://llvm.org/viewvc/llvm-project?rev=230022&view=rev
Log:
Refactor lldb-mi tests
Summary:
This patch includes following changes:
* split lldb-mi tests into separate folders. It will make our life simpler because we can modify a test program of certain test and don't worry about other tests
* a bit refactoring
* fix comments
* improve some tests
Reviewers: emaste, clayborg, abidh
Reviewed By: clayborg, abidh
Subscribers: clayborg, lldb-commits, emaste, abidh
Differential Revision: http://reviews.llvm.org/D7762
Added:
lldb/trunk/test/tools/lldb-mi/TestMiFile.py
- copied, changed from r230007, lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py
lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py
- copied, changed from r230010, lldb/trunk/test/tools/lldb-mi/TestMiNotification.py
lldb/trunk/test/tools/lldb-mi/breakpoint/
lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile
lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
- copied, changed from r230007, lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py
lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp
lldb/trunk/test/tools/lldb-mi/control/
lldb/trunk/test/tools/lldb-mi/control/Makefile
lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
- copied, changed from r230010, lldb/trunk/test/tools/lldb-mi/TestMiExec.py
lldb/trunk/test/tools/lldb-mi/control/main.cpp
lldb/trunk/test/tools/lldb-mi/data/
lldb/trunk/test/tools/lldb-mi/data/Makefile
lldb/trunk/test/tools/lldb-mi/data/TestMiData.py
- copied, changed from r230007, lldb/trunk/test/tools/lldb-mi/TestMiData.py
lldb/trunk/test/tools/lldb-mi/data/main.cpp
lldb/trunk/test/tools/lldb-mi/main.cpp
- copied, changed from r230010, lldb/trunk/test/tools/lldb-mi/main.c
lldb/trunk/test/tools/lldb-mi/signal/
lldb/trunk/test/tools/lldb-mi/signal/Makefile
lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
- copied, changed from r230010, lldb/trunk/test/tools/lldb-mi/TestMiNotification.py
lldb/trunk/test/tools/lldb-mi/signal/main.cpp
lldb/trunk/test/tools/lldb-mi/stack/
lldb/trunk/test/tools/lldb-mi/stack/Makefile
lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
- copied, changed from r230007, lldb/trunk/test/tools/lldb-mi/TestMiStack.py
lldb/trunk/test/tools/lldb-mi/stack/main.cpp
lldb/trunk/test/tools/lldb-mi/symbol/
lldb/trunk/test/tools/lldb-mi/symbol/Makefile
lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py
- copied, changed from r230010, lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py
lldb/trunk/test/tools/lldb-mi/symbol/main.cpp
lldb/trunk/test/tools/lldb-mi/variable/
lldb/trunk/test/tools/lldb-mi/variable/Makefile
lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
- copied, changed from r230007, lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py
lldb/trunk/test/tools/lldb-mi/variable/main.cpp
Removed:
lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py
lldb/trunk/test/tools/lldb-mi/TestMiData.py
lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py
lldb/trunk/test/tools/lldb-mi/TestMiExec.py
lldb/trunk/test/tools/lldb-mi/TestMiInterrupt.py
lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py
lldb/trunk/test/tools/lldb-mi/TestMiNotification.py
lldb/trunk/test/tools/lldb-mi/TestMiStack.py
lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py
lldb/trunk/test/tools/lldb-mi/a.c
lldb/trunk/test/tools/lldb-mi/b.c
lldb/trunk/test/tools/lldb-mi/locals.c
lldb/trunk/test/tools/lldb-mi/loop.c
lldb/trunk/test/tools/lldb-mi/main.c
Modified:
lldb/trunk/test/tools/lldb-mi/Makefile
lldb/trunk/test/tools/lldb-mi/TestMiExit.py
lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py
lldb/trunk/test/tools/lldb-mi/TestMiSyntax.py
lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py
Modified: lldb/trunk/test/tools/lldb-mi/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/Makefile?rev=230022&r1=230021&r2=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/Makefile (original)
+++ lldb/trunk/test/tools/lldb-mi/Makefile Fri Feb 20 10:34:33 2015
@@ -1,5 +1,5 @@
LEVEL = ../../make
-C_SOURCES := main.c a.c b.c loop.c locals.c
+CXX_SOURCES := main.cpp
include $(LEVEL)/Makefile.rules
Removed: lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py (removed)
@@ -1,113 +0,0 @@
-"""
-Test that the lldb-mi driver understands an MI breakpoint command.
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiBreakpointTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_pendbreakonsym(self):
- """Test that 'lldb-mi --interpreter' works for pending symbol breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-break-insert -f b_MyFunction")
- self.expect("\^done,bkpt={number=\"1\"")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_pendbreakonsrc(self):
- """Test that 'lldb-mi --interpreter' works for pending source breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Find the line number to break inside main() and set
- # pending BP
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert -f main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_breakpoints(self):
- """Test that 'lldb-mi --interpreter' works for breakpoints."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Break on symbol
- self.runCmd("-break-insert b_MyFunction")
- self.expect("\^done,bkpt={number=\"2\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Break on source
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
-
- # Check with full path. TODO, figure out why this commands fails
- # if -f is not given
- line = line_number('main.c', '// BP_doloop')
- full_path = os.path.join(os.getcwd(), "main.c")
- self.runCmd("-break-insert -f %s:%d" % (full_path, line))
- self.expect("\^done,bkpt={number=\"4\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Run to exit
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
-if __name__ == '__main__':
- unittest2.main()
Removed: lldb/trunk/test/tools/lldb-mi/TestMiData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiData.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiData.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiData.py (removed)
@@ -1,127 +0,0 @@
-"""
-Test that the lldb-mi driver works with -data-xxx commands
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_disassemble(self):
- """Test that 'lldb-mi --interpreter' works for -data-disassemble."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Get an address for disassembling: use main
- self.runCmd("-data-evaluate-expression main")
- self.expect("\^done,value=\"0x[0-9a-f]+\"")
- addr = int(self.child.after.split("\"")[1], 16)
-
- # Test -data-disassemble: try to disassemble some address
- self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10))
- self.expect("\^done,asm_insns=\[{address=\"0x%08x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+\"}," % addr)
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_read_memory_bytes(self):
- """Test that 'lldb-mi --interpreter' works for -data-read-memory-bytes."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Get address of s_RawData
- self.runCmd("-data-evaluate-expression &s_RawData")
- self.expect("\^done,value=\"0x[0-9a-f]+\"",timeout=1)
- addr = int(self.child.after.split("\"")[1], 16)
- size = 5
-
- # Test -data-read-memory-bytes: try to read data of s_RawData
- self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
- self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1234567800\"}\]" % (addr, addr + size))
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_list_register_names(self):
- """Test that 'lldb-mi --interpreter' works for -data-list-register-names."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -data-list-register-names: try to get all registers
- self.runCmd("-data-list-register-names")
- self.expect("\^done,register-names=\[\".+\",")
-
- # Test -data-list-register-names: try to get specified registers
- self.runCmd("-data-list-register-names 0")
- self.expect("\^done,register-names=\[\".+\"\]")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_data_list_register_values(self):
- """Test that 'lldb-mi --interpreter' works for -data-list-register-values."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -data-list-register-values: try to get all registers
- self.runCmd("-data-list-register-values x")
- self.expect("\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"")
-
- # Test -data-list-register-values: try to get specified registers
- self.runCmd("-data-list-register-values x 0")
- self.expect("\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"}\]")
-
-if __name__ == '__main__':
- unittest2.main()
Removed: lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py (removed)
@@ -1,113 +0,0 @@
-"""
-Test that the lldb-mi driver can evaluate expressions.
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiEvaluateTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_eval(self):
- """Test that 'lldb-mi --interpreter' works for evaluating."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to program return (marked BP_source)
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Print non-existant variable
- self.runCmd("-var-create var1 * undef")
- #self.expect("\^error") #FIXME: shows undef as {...}
- self.runCmd("-data-evaluate-expression undef")
- self.expect("\^error,msg=\"Could not evaluate expression\"")
-
- # Print global "g_MyVar", modify, delete and create again
- self.runCmd("-data-evaluate-expression g_MyVar")
- self.expect("\^done,value=\"3\"")
- self.runCmd("-var-create var2 * g_MyVar")
- self.expect("\^done,name=\"var2\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
- self.runCmd("-var-evaluate-expression var2")
- self.expect("\^done,value=\"3\"")
- self.runCmd("-var-show-attributes var2")
- self.expect("\^done,status=\"editable\"")
- self.runCmd("-data-evaluate-expression \"g_MyVar=30\"")
- self.expect("\^done,value=\"30\"")
- self.runCmd("-var-update var2")
- #self.expect("name=\"var2\",value=\"30\"") #FIXME -var-update doesn't work
- self.runCmd("-var-delete var2")
- self.expect("\^done")
- self.runCmd("-var-create var2 * g_MyVar")
- self.expect("\^done,name=\"var2\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
-
- # Print static "s_MyVar", modify, delete and create again
- self.runCmd("-data-evaluate-expression s_MyVar")
- self.expect("\^done,value=\"30\"")
- self.runCmd("-var-create var3 * s_MyVar")
- self.expect("\^done,name=\"var3\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
- self.runCmd("-var-evaluate-expression var3")
- self.expect("\^done,value=\"30\"")
- self.runCmd("-var-show-attributes var3")
- self.expect("\^done,status=\"editable\"")
- self.runCmd("-data-evaluate-expression \"s_MyVar=3\"")
- self.expect("\^done,value=\"3\"")
- self.runCmd("-var-update var3")
- #self.expect("name=\"var3\",value=\"3\"") #FIXME -var-update doesn't work
- self.runCmd("-var-delete var3")
- self.expect("\^done")
- self.runCmd("-var-create var3 * s_MyVar")
- self.expect("\^done,name=\"var3\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
-
- # Print local "b", modify, delete and create again
- self.runCmd("-data-evaluate-expression b")
- self.expect("\^done,value=\"20\"")
- self.runCmd("-var-create var4 * b")
- self.expect("\^done,name=\"var4\",numchild=\"0\",value=\"20\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
- self.runCmd("-var-evaluate-expression var4")
- self.expect("\^done,value=\"20\"")
- self.runCmd("-var-show-attributes var4")
- self.expect("\^done,status=\"editable\"")
- self.runCmd("-data-evaluate-expression \"b=2\"")
- self.expect("\^done,value=\"2\"")
- self.runCmd("-var-update var4")
- #self.expect("name=\"var4\",value=\"2\"") #FIXME -var-update doesn't work
- self.runCmd("-var-delete var4")
- self.expect("\^done")
- self.runCmd("-var-create var4 * b")
- self.expect("\^done,name=\"var4\",numchild=\"0\",value=\"2\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
-
- # Print temp "a + b"
- self.runCmd("-data-evaluate-expression \"a + b\"")
- self.expect("\^done,value=\"12\"")
- self.runCmd("-var-create var5 * \"a + b\"")
- self.expect("\^done,name=\"var5\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
- self.runCmd("-var-evaluate-expression var5")
- self.expect("\^done,value=\"12\"")
- self.runCmd("-var-show-attributes var5")
- self.expect("\^done,status=\"editable\"") #FIXME editable or not?
-
- # Print argument "argv[0]"
- self.runCmd("-data-evaluate-expression \"argv[0]\"")
- self.expect("\^done,value=\"0x[0-9a-f]+\"")
- self.runCmd("-var-create var6 * \"argv[0]\"")
- self.expect("\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"")
- self.runCmd("-var-evaluate-expression var6")
- self.expect("\^done,value=\"0x[0-9a-f]+\"")
- self.runCmd("-var-show-attributes var6")
- self.expect("\^done,status=\"editable\"")
-
-if __name__ == '__main__':
- unittest2.main()
Removed: lldb/trunk/test/tools/lldb-mi/TestMiExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiExec.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiExec.py (removed)
@@ -1,453 +0,0 @@
-"""
-Test that the lldb-mi driver works with -exec-xxx commands
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skip("-exec-abort isn't implemented")
- def test_lldbmi_exec_abort(self):
- """Test that 'lldb-mi --interpreter' works for -exec-abort."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -exec-abort fails on invalid process
- self.runCmd("-exec-abort")
- self.expect("\^error,msg=\"Command 'exec-abort'. Invalid process during debug session\"")
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set arguments
- self.runCmd("-exec-arguments arg1")
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that arguments were passed
- self.runCmd("-data-evaluate-expression argc")
- self.expect("\^done,value=\"2\"")
-
- # Test that program may be aborted
- self.runCmd("-exec-abort")
- self.expect("\^done")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- # Test that program can be run again
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that arguments were passed again
- self.runCmd("-data-evaluate-expression argc")
- self.expect("\^done,value=\"2\"")
-
- # Test that program may be aborted again
- self.runCmd("-exec-abort")
- self.expect("\^done")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_arguments_set(self):
- """Test that 'lldb-mi --interpreter' can pass args using -exec-arguments."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set arguments
- self.runCmd("-exec-arguments --arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Check argc and argv to see if arg passed
- self.runCmd("-data-evaluate-expression argc")
- self.expect("\^done,value=\"5\"")
- #self.runCmd("-data-evaluate-expression argv[1]")
- #self.expect("\^done,value=\"--arg1\"")
- self.runCmd("-interpreter-exec command \"print argv[1]\"")
- self.expect("\"--arg1\"")
- #self.runCmd("-data-evaluate-expression argv[2]")
- #self.expect("\^done,value=\"2nd arg\"")
- self.runCmd("-interpreter-exec command \"print argv[2]\"")
- #FIXME: lldb-mi doesn't handle inner quotes
- self.expect("\"\\\\\\\"2nd arg\\\\\\\"\"") #FIXME: self.expect("\"2nd arg\"")
- #self.runCmd("-data-evaluate-expression argv[3]")
- #self.expect("\^done,value=\"third_arg\"")
- self.runCmd("-interpreter-exec command \"print argv[3]\"")
- self.expect("\"third_arg\"")
- #self.runCmd("-data-evaluate-expression argv[4]")
- #self.expect("\^done,value=\"fourth=\\\\\\\"4th arg\\\\\\\"\"")
- self.runCmd("-interpreter-exec command \"print argv[4]\"")
- self.expect("\"fourth=\\\\\\\"4th arg\\\\\\\"\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_arguments_reset(self):
- """Test that 'lldb-mi --interpreter' can reset previously set args using -exec-arguments."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set arguments
- self.runCmd("-exec-arguments foo bar baz")
- self.expect("\^done")
- self.runCmd("-exec-arguments")
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Check argc to see if arg passed
- self.runCmd("-data-evaluate-expression argc")
- self.expect("\^done,value=\"1\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_next(self):
- """Test that 'lldb-mi --interpreter' works for stepping."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Warning: the following is sensative to the lines in the source.
-
- # Test -exec-next
- self.runCmd("-exec-next --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
-
- # Test that --thread is optional
- self.runCmd("-exec-next --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
-
- # Test that --frame is optional
- self.runCmd("-exec-next --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"29\"")
-
- # Test that both --thread and --frame are optional
- self.runCmd("-exec-next --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"31\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-next --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-next --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- self.runCmd("-exec-next --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_next_instruction(self):
- """Test that 'lldb-mi --interpreter' works for instruction stepping."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Warning: the following is sensative to the lines in the
- # source and optimizations
-
- # Test -exec-next-instruction
- self.runCmd("-exec-next-instruction --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
-
- # Test that --thread is optional
- self.runCmd("-exec-next-instruction --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
-
- # Test that --frame is optional
- self.runCmd("-exec-next-instruction --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
-
- # Test that both --thread and --frame are optional
- self.runCmd("-exec-next-instruction --thread 1")
- self.expect("\^running")
- # Depending on compiler, it can stop at different line.
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-next-instruction --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-next-instruction --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- self.runCmd("-exec-next-instruction --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_step(self):
- """Test that 'lldb-mi --interpreter' works for stepping into."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to printf call
- line = line_number('main.c', '//BP_printf_call')
- self.runCmd("-break-insert -f main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Warning: the following is sensative to the lines in the source
-
- # Test that -exec-step does not step into printf (which
- # has no debug info)
- #FIXME: is this supposed to step into printf?
- self.runCmd("-exec-step --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
-
- # Test that -exec-step steps into a_MyFunction and back out
- # (and that --thread is optional)
- self.runCmd("-exec-step --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
- #FIXME: is this supposed to step into printf?
- self.runCmd("-exec-step --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
- # Use -exec-finish here to make sure that control reaches the caller.
- # -exec-step can keep us in the a_MyFunction for gcc
- self.runCmd("-exec-finish --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
- self.runCmd("-exec-step --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
-
- # Test that -exec-step steps into b_MyFunction
- # (and that --frame is optional)
- self.runCmd("-exec-step --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"b_MyFunction\"")
-
- # Test that -exec-step steps into a_MyFunction from inside
- # b_MyFunction (and that both --thread and --frame are optional)
- self.runCmd("-exec-step")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-step --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-step --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- self.runCmd("-exec-step --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin due to calling convention assumptions")
- def test_lldbmi_exec_step_instruction(self):
- """Test that 'lldb-mi --interpreter' works for instruction stepping into."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Warning: the following is sensative to the lines in the
- # source and optimizations
-
- # Run to a_MyFunction call
- line = line_number('main.c', '//BP_a_MyFunction_call')
- self.runCmd("-break-insert -f main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -exec-step-instruction steps over non branching
- # instruction
- self.runCmd("-exec-step-instruction --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
-
- # Test that -exec-step-instruction steps over non branching
- # instruction (and that --thread is optional)
- self.runCmd("-exec-step-instruction --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
-
- # Test that -exec-step-instruction steps into a_MyFunction
- # (and that --frame is optional)
- self.runCmd("-exec-step-instruction --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
-
- # Test that -exec-step-instruction steps into a_MyFunction
- # (and that both --thread and --frame are optional)
- self.runCmd("-exec-step-instruction --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-step-instruction --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-step-instruction --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- self.runCmd("-exec-step-instruction --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exec_finish(self):
- """Test that 'lldb-mi --interpreter' works for -exec-finish."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Set argument 'l'
- self.runCmd("-exec-arguments l")
- self.expect("\^done")
-
- # Set BP at a_MyFunction_call and run to BP
- self.runCmd("-break-insert -f a_MyFunction")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -exec-finish returns from a_MyFunction
- self.runCmd("-exec-finish --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"main\"")
-
- # Run to BP inside b_MyFunction call
- line = line_number('b.c', '//BP_b_MyFunction')
- self.runCmd("-break-insert -f b.c:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -exec-finish hits BP at a_MyFunction call inside
- # b_MyFunction (and that --thread is optional)
- self.runCmd("-exec-finish --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -exec-finish returns from a_MyFunction call inside
- # b_MyFunction (and that --frame is optional)
- self.runCmd("-exec-finish --thread 1")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"b_MyFunction\"")
-
- # Test that -exec-finish returns from b_MyFunction
- # (and that both --thread and --frame are optional)
- self.runCmd("-exec-finish")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"main\"")
-
- # Test that an invalid --thread is handled
- self.runCmd("-exec-finish --thread 0")
- self.expect("\^error,message=\"error: Thread index 0 is out of range")
- self.runCmd("-exec-finish --thread 10")
- self.expect("\^error,message=\"error: Thread index 10 is out of range")
-
- # Test that an invalid --frame is handled
- # FIXME: no error is returned
- #self.runCmd("-exec-finish --frame 10")
- #self.expect("\^error: Frame index 10 is out of range")
-
- # Set BP at printf and run to BP
- # FIXME: BP at printf not resolved and never hit!
- self.runCmd("-interpreter-exec command \"b printf\"") #FIXME: self.runCmd("-break-insert -f printf")
- self.expect("\^done") #FIXME: self.expect("\^done,bkpt={number=\"3\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- ## Test that -exec-finish returns from printf
- self.runCmd("-exec-finish --thread 1 --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"main\"")
-
-if __name__ == '__main__':
- unittest2.main()
Modified: lldb/trunk/test/tools/lldb-mi/TestMiExit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiExit.py?rev=230022&r1=230021&r2=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiExit.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiExit.py Fri Feb 20 10:34:33 2015
@@ -1,5 +1,5 @@
"""
-Test that the lldb-mi driver works properly with "-gdb-exit".
+Test that the lldb-mi driver exits properly.
"""
import lldbmi_testcase
@@ -8,12 +8,13 @@ import unittest2
class MiExitTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_gdbexit(self):
- """Test that '-gdb-exit' terminates debug session and exits."""
+ def test_lldbmi_gdb_exit(self):
+ """Test that '-gdb-exit' terminates local debug session and exits."""
self.spawnLldbMi(args = None)
@@ -37,7 +38,6 @@ class MiExitTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_quit(self):
"""Test that 'quit' exits immediately."""
Copied: lldb/trunk/test/tools/lldb-mi/TestMiFile.py (from r230007, lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiFile.py?p2=lldb/trunk/test/tools/lldb-mi/TestMiFile.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py&r1=230007&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiFile.py Fri Feb 20 10:34:33 2015
@@ -1,26 +1,28 @@
"""
-Test various ways the lldb-mi driver can launch a program.
+Test lldb-mi -file-xxx commands.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
-class MiLaunchTestCase(lldbmi_testcase.MiTestCaseBase):
+class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exe(self):
+ def test_lldbmi_file_exec_and_symbols_file(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols exe."""
self.spawnLldbMi(args = None)
- # Use no path
+ # Test that -file-exec-and-symbols works for filename
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
@@ -28,18 +30,18 @@ class MiLaunchTestCase(lldbmi_testcase.M
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_abspathexe(self):
+ def test_lldbmi_file_exec_and_symbols_absolute_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols fullpath/exe."""
self.spawnLldbMi(args = None)
- # Use full path
+ # Test that -file-exec-and-symbols works for absolute path
import os
- exe = os.path.join(os.getcwd(), self.myexe)
- self.runCmd("-file-exec-and-symbols %s" % exe)
+ path = os.path.join(os.getcwd(), self.myexe)
+ self.runCmd("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
@@ -47,17 +49,17 @@ class MiLaunchTestCase(lldbmi_testcase.M
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_relpathexe(self):
+ def test_lldbmi_file_exec_and_symbols_relative_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols relpath/exe."""
self.spawnLldbMi(args = None)
- # Use relative path
- exe = "../../" + self.mydir + "/" + self.myexe
- self.runCmd("-file-exec-and-symbols %s" % exe)
+ # Test that -file-exec-and-symbols works for relative path
+ path = "./%s" % self.myexe
+ self.runCmd("-file-exec-and-symbols %s" % path)
self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
@@ -65,15 +67,14 @@ class MiLaunchTestCase(lldbmi_testcase.M
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_badpathexe(self):
+ def test_lldbmi_file_exec_and_symbols_unknown_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols badpath/exe."""
self.spawnLldbMi(args = None)
- # Use non-existant path
- exe = "badpath/" + self.myexe
- self.runCmd("-file-exec-and-symbols %s" % exe)
+ # Test that -file-exec-and-symbols fails on unknown path
+ path = "unknown_dir/%s" % self.myexe
+ self.runCmd("-file-exec-and-symbols %s" % path)
self.expect("\^error")
if __name__ == '__main__':
Modified: lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py?rev=230022&r1=230021&r2=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py Fri Feb 20 10:34:33 2015
@@ -1,5 +1,5 @@
"""
-Test that the lldb-mi driver works with -interpreter-exec command
+Test lldb-mi -interpreter-exec command.
"""
import lldbmi_testcase
@@ -8,6 +8,8 @@ import unittest2
class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.skip("lldb-mi handles double quotes in passed app path incorrectly")
@@ -30,7 +32,6 @@ class MiInterpreterExecTestCase(lldbmi_t
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_breakpoint_set(self):
"""Test that 'lldb-mi --interpreter' can set breakpoint by 'breakpoint set' command."""
@@ -52,7 +53,6 @@ class MiInterpreterExecTestCase(lldbmi_t
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_settings_set_target_run_args_before(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command before than target was created."""
@@ -67,10 +67,7 @@ class MiInterpreterExecTestCase(lldbmi_t
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Run to BP_argctest
- line = line_number('main.c', '//BP_argctest')
- self.runCmd("-break-insert --file main.c:%d" % line)
- self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
@@ -80,7 +77,6 @@ class MiInterpreterExecTestCase(lldbmi_t
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_settings_set_target_run_args_after(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command after than target was created."""
@@ -95,10 +91,7 @@ class MiInterpreterExecTestCase(lldbmi_t
self.runCmd("-interpreter-exec console \"setting set target.run-args arg1\"")
self.expect("\^done")
- # Run to BP_argctest
- line = line_number('main.c', '//BP_argctest')
- self.runCmd("-break-insert --file main.c:%d" % line)
- self.expect("\^done")
+ # Run
self.runCmd("-exec-run")
self.expect("\^running")
@@ -108,7 +101,6 @@ class MiInterpreterExecTestCase(lldbmi_t
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_process_launch(self):
"""Test that 'lldb-mi --interpreter' can launch process by "process launch" command."""
@@ -132,7 +124,6 @@ class MiInterpreterExecTestCase(lldbmi_t
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_step_in(self):
"""Test that 'lldb-mi --interpreter' can step in by "thread step-in" command."""
@@ -159,7 +150,6 @@ class MiInterpreterExecTestCase(lldbmi_t
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_step_over(self):
"""Test that 'lldb-mi --interpreter' can step over by "thread step-over" command."""
@@ -185,7 +175,6 @@ class MiInterpreterExecTestCase(lldbmi_t
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_continue(self):
"""Test that 'lldb-mi --interpreter' can continue execution by "thread continue" command."""
Removed: lldb/trunk/test/tools/lldb-mi/TestMiInterrupt.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiInterrupt.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiInterrupt.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiInterrupt.py (removed)
@@ -1,96 +0,0 @@
-"""
-Test that the lldb-mi driver can interrupt and resume a looping app.
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiInterruptTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def test_lldbmi_interrupt(self):
- """Test that 'lldb-mi --interpreter' interrupt and resume a looping app."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set doloop=1 and run (to loop forever)
- self.runCmd("-data-evaluate-expression \"doloop=1\"")
- self.expect("value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Issue interrupt, set BP in loop (marked BP_loop), and resume
- self.runCmd("-exec-interrupt")
- self.expect("\*stopped,reason=\"signal-received\"")
- line = line_number('loop.c', '//BP_loop')
- self.runCmd("-break-insert loop.c:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
- #self.runCmd("-exec-resume") #FIXME: command not recognized
- self.runCmd("-exec-continue")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # We should have hit BP
- # Set loop=-1 so we'll exit the loop
- self.runCmd("-data-evaluate-expression \"loop=-1\"")
- self.expect("value=\"-1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skip("lldb-mi how to send cntl-C to app?")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def test_lldbmi_cntlC(self):
- """Test that 'lldb-mi --interpreter' cntl-C interrupts app."""
-
- self.spawnLldbMi(args = None)
-
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set doloop=1 and run (to loop forever)
- self.runCmd("-var-create var2 --thread 1 --frame 0 * \"doloop=1\"")
- self.expect("value=\"1\",type=\"int\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Issue interrupt, set a bp, and resume
- #FIXME: how to runCmd cntl-C?
- self.runCmd("-exec-interrupt") # or cntl-c
- self.expect("\*stopped,reason=\"signal-received\"")
- self.runCmd("-break-insert loop.c:11")
- self.expect("\^done,bkpt={number=\"2\"")
- self.runCmd("-exec-continue")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # We should be sitting at loop.c:12
- # Set loop=-1 so we'll exit the loop
- self.runCmd("-data-evaluate-expression \"loop=-1\"")
- self.expect("value=\"-1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
-if __name__ == '__main__':
- unittest2.main()
Removed: lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiLaunch.py (removed)
@@ -1,80 +0,0 @@
-"""
-Test various ways the lldb-mi driver can launch a program.
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiLaunchTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_exe(self):
- """Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols exe."""
-
- self.spawnLldbMi(args = None)
-
- # Use no path
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_abspathexe(self):
- """Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols fullpath/exe."""
-
- self.spawnLldbMi(args = None)
-
- # Use full path
- import os
- exe = os.path.join(os.getcwd(), self.myexe)
- self.runCmd("-file-exec-and-symbols %s" % exe)
- self.expect("\^done")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_relpathexe(self):
- """Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols relpath/exe."""
-
- self.spawnLldbMi(args = None)
-
- # Use relative path
- exe = "../../" + self.mydir + "/" + self.myexe
- self.runCmd("-file-exec-and-symbols %s" % exe)
- self.expect("\^done")
-
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_badpathexe(self):
- """Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols badpath/exe."""
-
- self.spawnLldbMi(args = None)
-
- # Use non-existant path
- exe = "badpath/" + self.myexe
- self.runCmd("-file-exec-and-symbols %s" % exe)
- self.expect("\^error")
-
-if __name__ == '__main__':
- unittest2.main()
Removed: lldb/trunk/test/tools/lldb-mi/TestMiNotification.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiNotification.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiNotification.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiNotification.py (removed)
@@ -1,220 +0,0 @@
-"""
-Test that the lldb-mi driver nofities user properly.
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiNotificationTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_prompt(self):
- """Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
-
- self.spawnLldbMi(args = None)
-
- # Test that lldb-mi is ready after startup
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after unknown command
- self.runCmd("-unknown-command")
- self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -file-exec-and-symbols
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -break-insert
- self.runCmd("-break-insert -f b_MyFunction")
- self.expect("\^done,bkpt={number=\"1\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -exec-run
- self.runCmd("-exec-run")
- self.expect("\*running")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after BP hit
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -exec-continue
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after program exited
- self.expect("\*stopped,reason=\"exited-normally\"")
- self.expect(self.child_prompt, exactly = True)
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stopped_when_stopatentry_local(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (local)."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run with stop-at-entry flag
- self.runCmd("-interpreter-exec command \"process launch -s\"")
- self.expect("\^done")
-
- # Test that *stopped is printed
- # Note that message is different in Darwin and Linux:
- # Darwin: "*stopped,reason=\"signal-received\",signal=\"17\",thread-id=\"1\",stopped-threads=\"all\""
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=\[\],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
- self.expect("\*stopped,reason=\"(signal-received|end-stepping-range)\",.+,thread-id=\"1\",stopped-threads=\"all\"")
-
- # Run to main to make sure we have not exited the application
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def test_lldbmi_stopped_when_stopatentry_remote(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (remote)."""
-
- # Prepare debugserver
- import os, sys
- lldb_gdbserver_folder = os.path.abspath(os.path.join(os.path.dirname(os.getcwd()), "lldb-gdbserver"))
- sys.path.append(lldb_gdbserver_folder)
- import lldbgdbserverutils
- debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
- if not debugserver_exe:
- raise Exception("debugserver not found")
- hostname = "localhost"
- import random
- port = 12000 + random.randint(0,3999) # the same as GdbRemoteTestCaseBase.get_next_port
- import pexpect
- debugserver_child = pexpect.spawn("%s %s:%d" % (debugserver_exe, hostname, port))
-
- self.spawnLldbMi(args = None)
-
- # Connect to debugserver
- self.runCmd("-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
- self.expect("\^done")
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
- self.runCmd("-interpreter-exec command \"process connect connect://%s:%d\"" % (hostname, port))
- self.expect("\^done")
-
- try:
- # Run with stop-at-entry flag
- self.runCmd("-interpreter-exec command \"process launch -s\"")
- self.expect("\^done")
-
- # Test that *stopped is printed
- self.expect("\*stopped,reason=\"signal-received\",signal=\"17\",thread-id=\"1\",stopped-threads=\"all\"")
-
- # Exit
- self.runCmd("-gdb-exit")
- self.expect("\^exit")
-
- finally:
- # Clean up
- debugserver_child.terminate(force = True)
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stopped_when_segfault_local(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (local)."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set dosegfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"dosegfault=1\"")
- self.expect("\^done,value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Test that *stopped is printed
- self.expect("\*stopped,reason=\"exception-received\",exception=\"(EXC_BAD_ACCESS \(code=1, address=0x0\)|invalid address \(fault address: 0x0\))\",thread-id=\"1\",stopped-threads=\"all\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def test_lldbmi_stopped_when_segfault_remote(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (remote)."""
-
- # Prepare debugserver
- import os, sys
- lldb_gdbserver_folder = os.path.abspath(os.path.join(os.path.dirname(os.getcwd()), "lldb-gdbserver"))
- sys.path.append(lldb_gdbserver_folder)
- import lldbgdbserverutils
- debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
- if not debugserver_exe:
- raise Exception("debugserver not found")
- hostname = "localhost"
- import random
- port = 12000 + random.randint(0,3999) # the same as GdbRemoteTestCaseBase.get_next_port
- import pexpect
- debugserver_child = pexpect.spawn("%s %s:%d" % (debugserver_exe, hostname, port))
-
- self.spawnLldbMi(args = None)
-
- # Connect to debugserver
- self.runCmd("-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
- self.expect("\^done")
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
- self.runCmd("-interpreter-exec command \"process connect connect://%s:%d\"" % (hostname, port))
- self.expect("\^done")
-
- try:
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- #FIXME -exec-run doesn't work
- self.runCmd("-interpreter-exec command \"process launch\"") #FIXME: self.runCmd("-exec-run")
- self.expect("\^done") #FIXME: self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set dosegfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"dosegfault=1\"")
- self.expect("\^done,value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Test that *stopped is printed
- self.expect("\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"")
-
- # Exit
- self.runCmd("-gdb-exit")
- self.expect("\^exit")
-
- finally:
- # Clean up
- debugserver_child.terminate(force = True)
-
-if __name__ == '__main__':
- unittest2.main()
Copied: lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py (from r230010, lldb/trunk/test/tools/lldb-mi/TestMiNotification.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py?p2=lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiNotification.py&r1=230010&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiNotification.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiPrompt.py Fri Feb 20 10:34:33 2015
@@ -1,19 +1,18 @@
"""
-Test that the lldb-mi driver nofities user properly.
+Test that the lldb-mi driver prints prompt properly.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
-class MiNotificationTestCase(lldbmi_testcase.MiTestCaseBase):
+class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_prompt(self):
"""Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
@@ -33,7 +32,7 @@ class MiNotificationTestCase(lldbmi_test
self.expect(self.child_prompt, exactly = True)
# Test that lldb-mi is ready after -break-insert
- self.runCmd("-break-insert -f b_MyFunction")
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.expect(self.child_prompt, exactly = True)
@@ -55,166 +54,5 @@ class MiNotificationTestCase(lldbmi_test
self.expect("\*stopped,reason=\"exited-normally\"")
self.expect(self.child_prompt, exactly = True)
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stopped_when_stopatentry_local(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (local)."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run with stop-at-entry flag
- self.runCmd("-interpreter-exec command \"process launch -s\"")
- self.expect("\^done")
-
- # Test that *stopped is printed
- # Note that message is different in Darwin and Linux:
- # Darwin: "*stopped,reason=\"signal-received\",signal=\"17\",thread-id=\"1\",stopped-threads=\"all\""
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=\[\],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
- self.expect("\*stopped,reason=\"(signal-received|end-stepping-range)\",.+,thread-id=\"1\",stopped-threads=\"all\"")
-
- # Run to main to make sure we have not exited the application
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def test_lldbmi_stopped_when_stopatentry_remote(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (remote)."""
-
- # Prepare debugserver
- import os, sys
- lldb_gdbserver_folder = os.path.abspath(os.path.join(os.path.dirname(os.getcwd()), "lldb-gdbserver"))
- sys.path.append(lldb_gdbserver_folder)
- import lldbgdbserverutils
- debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
- if not debugserver_exe:
- raise Exception("debugserver not found")
- hostname = "localhost"
- import random
- port = 12000 + random.randint(0,3999) # the same as GdbRemoteTestCaseBase.get_next_port
- import pexpect
- debugserver_child = pexpect.spawn("%s %s:%d" % (debugserver_exe, hostname, port))
-
- self.spawnLldbMi(args = None)
-
- # Connect to debugserver
- self.runCmd("-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
- self.expect("\^done")
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
- self.runCmd("-interpreter-exec command \"process connect connect://%s:%d\"" % (hostname, port))
- self.expect("\^done")
-
- try:
- # Run with stop-at-entry flag
- self.runCmd("-interpreter-exec command \"process launch -s\"")
- self.expect("\^done")
-
- # Test that *stopped is printed
- self.expect("\*stopped,reason=\"signal-received\",signal=\"17\",thread-id=\"1\",stopped-threads=\"all\"")
-
- # Exit
- self.runCmd("-gdb-exit")
- self.expect("\^exit")
-
- finally:
- # Clean up
- debugserver_child.terminate(force = True)
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stopped_when_segfault_local(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (local)."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set dosegfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"dosegfault=1\"")
- self.expect("\^done,value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Test that *stopped is printed
- self.expect("\*stopped,reason=\"exception-received\",exception=\"(EXC_BAD_ACCESS \(code=1, address=0x0\)|invalid address \(fault address: 0x0\))\",thread-id=\"1\",stopped-threads=\"all\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def test_lldbmi_stopped_when_segfault_remote(self):
- """Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (remote)."""
-
- # Prepare debugserver
- import os, sys
- lldb_gdbserver_folder = os.path.abspath(os.path.join(os.path.dirname(os.getcwd()), "lldb-gdbserver"))
- sys.path.append(lldb_gdbserver_folder)
- import lldbgdbserverutils
- debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
- if not debugserver_exe:
- raise Exception("debugserver not found")
- hostname = "localhost"
- import random
- port = 12000 + random.randint(0,3999) # the same as GdbRemoteTestCaseBase.get_next_port
- import pexpect
- debugserver_child = pexpect.spawn("%s %s:%d" % (debugserver_exe, hostname, port))
-
- self.spawnLldbMi(args = None)
-
- # Connect to debugserver
- self.runCmd("-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
- self.expect("\^done")
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
- self.runCmd("-interpreter-exec command \"process connect connect://%s:%d\"" % (hostname, port))
- self.expect("\^done")
-
- try:
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- #FIXME -exec-run doesn't work
- self.runCmd("-interpreter-exec command \"process launch\"") #FIXME: self.runCmd("-exec-run")
- self.expect("\^done") #FIXME: self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Set dosegfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"dosegfault=1\"")
- self.expect("\^done,value=\"1\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
-
- # Test that *stopped is printed
- self.expect("\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"")
-
- # Exit
- self.runCmd("-gdb-exit")
- self.expect("\^exit")
-
- finally:
- # Clean up
- debugserver_child.terminate(force = True)
-
if __name__ == '__main__':
unittest2.main()
Removed: lldb/trunk/test/tools/lldb-mi/TestMiStack.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiStack.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiStack.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiStack.py (removed)
@@ -1,302 +0,0 @@
-"""
-Test that the lldb-mi driver works with -stack-xxx commands
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_list_arguments(self):
- """Test that 'lldb-mi --interpreter' can shows arguments."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-arguments: use 0 or --no-values
- self.runCmd("-stack-list-arguments 0")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[name=\"argc\",name=\"argv\"\]}")
- self.runCmd("-stack-list-arguments --no-values")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[name=\"argc\",name=\"argv\"\]}")
-
- # Test -stack-list-arguments: use 1 or --all-values
- self.runCmd("-stack-list-arguments 1")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}")
- self.runCmd("-stack-list-arguments --all-values")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}")
-
- # Test -stack-list-arguments: use 2 or --simple-values
- self.runCmd("-stack-list-arguments 2")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}")
- self.runCmd("-stack-list-arguments --simple-values")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_list_locals(self):
- """Test that 'lldb-mi --interpreter' can shows local variables."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- line = line_number('main.c', '//BP_localstest')
- self.runCmd("-break-insert --file main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-locals: use 0 or --no-values
- self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"a\",name=\"b\"\]")
- self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"a\",name=\"b\"\]")
-
- # Test -stack-list-locals: use 1 or --all-values
- self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
- self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
-
- # Test -stack-list-locals: use 2 or --simple-values
- self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
- self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
-
- # Test struct local variable
- line = line_number('locals.c', '// BP_LOCAL_STRUCT')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-locals: use 0 or --no-values
- self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"var_c\"\]")
- self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"var_c\"\]")
-
- # Test -stack-list-locals: use 1 or --all-values
- self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = { var_d = 30 }}\"}\]")
- self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = { var_d = 30 }}\"}\]")
-
- # Test -stack-list-locals: use 2 or --simple-values
- self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[name=\"var_c\"\]")
- self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[name=\"var_c\"\]")
-
- # Test array local variable
- line = line_number('locals.c', '// BP_LOCAL_ARRAY')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-locals: use 0 or --no-values
- self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"array\"\]")
- self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"array\"\]")
-
- # Test -stack-list-locals: use 1 or --all-values
- self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"array\",value=\"{\[0\] = 100,\[1\] = 200,\[2\] = 300}\"}\]")
- self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"array\",value=\"{\[0\] = 100,\[1\] = 200,\[2\] = 300}\"}\]")
-
- # Test -stack-list-locals: use 2 or --simple-values
- self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[name=\"array\"\]")
- self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[name=\"array\"\]")
-
- # Test pointers as local variable
- line = line_number('locals.c', '// BP_LOCAL_PTR')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"4\"")
-
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test -stack-list-locals: use 0 or --no-values
- self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"test_str\",name=\"var_e\",name=\"ptr\"\]")
- self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"test_str\",name=\"var_e\",name=\"ptr\"\]")
-
- # Test -stack-list-locals: use 1 or --all-values
- self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"test_str\",value=\".*Rakaposhi.*\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*\"}\]")
- self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"test_str\",value=\".*Rakaposhi.*\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*\"}\]")
-
- # Test -stack-list-locals: use 2 or --simple-values
- self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[{name=\"test_str\",value=\".*Rakaposhi.*\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*\"}\]")
- self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[{name=\"test_str\",value=\".*Rakaposhi.*\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*\"}\]")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_info_depth(self):
- """Test that 'lldb-mi --interpreter' can shows depth of the stack."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test stack depth
- self.runCmd("-stack-info-depth")
- self.expect("\^done,depth=\"[1-9]\"")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_info_frame(self):
- """Test that 'lldb-mi --interpreter' can show information about current frame."""
-
- self.spawnLldbMi(args = None)
-
- # Test that -stack-info-frame fails when program isn't running
- self.runCmd("-stack-info-frame")
- self.expect("\^error,msg=\"Command 'stack-info-frame'. Invalid process during debug session\"")
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -stack-info-frame works when program is running
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_list_frames(self):
- """Test that 'lldb-mi --interpreter' can lists the frames on the stack."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test stack frame: get frame #0 info
- self.runCmd("-stack-list-frames 0 0")
- self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\".+\"\}\]")
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_stack_select_frame(self):
- """Test that 'lldb-mi --interpreter' can choose current frame."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Test that -stack-select-frame requires 1 mandatory argument
- self.runCmd("-stack-select-frame")
- self.expect("\^error,msg=\"Command 'stack-select-frame'. Command Args. Missing options, 1 or more required\"")
-
- # Test that -stack-select-frame fails on invalid frame number
- self.runCmd("-stack-select-frame 99")
- self.expect("\^error,msg=\"Command 'stack-select-frame'. Frame ID invalid\"")
-
- # Test that current frame is #0
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
-
- # Test that -stack-select-frame can select the selected frame
- self.runCmd("-stack-select-frame 0")
- self.expect("\^done")
-
- # Test that current frame is still #0
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
-
- # Test that -stack-select-frame can select frame #1 (parent frame)
- self.runCmd("-stack-select-frame 1")
- self.expect("\^done")
-
- # Test that current frame is #1
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"1\",addr=\".+\",func=\".+\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\}")
-
- # Test that -stack-select-frame can select frame #0 (child frame)
- self.runCmd("-stack-select-frame 0")
- self.expect("\^done")
-
- # Test that current frame is #0 and it has the same information
- self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
-
-if __name__ == '__main__':
- unittest2.main()
Removed: lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py (removed)
@@ -1,60 +0,0 @@
-"""
-Test that the lldb-mi driver works with -symbol-xxx commands
-"""
-
-import lldbmi_testcase
-from lldbtest import *
-import unittest2
-
-class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase):
-
- @lldbmi_test
- @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_symbol_list_lines_file(self):
- """Test that 'lldb-mi --interpreter' works for -symbol-list-lines when file exists."""
-
- self.spawnLldbMi(args = None)
-
- # Load executable
- self.runCmd("-file-exec-and-symbols %s" % self.myexe)
- self.expect("\^done")
-
- # Run to main
- self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\"")
- self.runCmd("-exec-run")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
- # Get address of main
- self.runCmd("-data-evaluate-expression main")
- self.expect("\^done,value=\"0x[0-9a-f]+\"")
- main_addr = int(self.child.after.split("\"")[1], 16)
- main_line = line_number('main.c', '//FUNC_main')
-
- # Test that -symbol-list-lines works on valid data
- self.runCmd("-symbol-list-lines main.c")
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (main_addr, main_line))
-
- # Test that -symbol-list-lines fails when file doesn't exist
- self.runCmd("-symbol-list-lines unknown_file")
- self.expect("\^error,message=\"warning: No source filenames matched 'unknown_file'. error: no source filenames matched any command arguments \"")
-
- # Test that -symbol-list-lines fails when file is specified using relative path
- self.runCmd("-symbol-list-lines ./main.c")
- self.expect("\^error,message=\"warning: No source filenames matched './main.c'. error: no source filenames matched any command arguments \"")
-
- # Test that -symbol-list-lines works when file is specified using absolute path
- import os
- main_file = os.path.join(os.getcwd(), "main.c")
- self.runCmd("-symbol-list-lines \"%s\"" % main_file)
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (main_addr, main_line))
-
- # Test that -symbol-list-lines fails when file doesn't exist
- self.runCmd("-symbol-list-lines unknown_dir/main.c")
- self.expect("\^error,message=\"warning: No source filenames matched 'unknown_dir/main.c'. error: no source filenames matched any command arguments \"")
-
-if __name__ == '__main__':
- unittest2.main()
Modified: lldb/trunk/test/tools/lldb-mi/TestMiSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiSyntax.py?rev=230022&r1=230021&r2=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiSyntax.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiSyntax.py Fri Feb 20 10:34:33 2015
@@ -8,12 +8,13 @@ import unittest2
class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_tokens(self):
- """Test that 'lldb-mi --interpreter' echos command tokens."""
+ """Test that 'lldb-mi --interpreter' prints command tokens."""
self.spawnLldbMi(args = None)
@@ -22,7 +23,7 @@ class MiSyntaxTestCase(lldbmi_testcase.M
self.expect("000\^done")
# Run to main
- self.runCmd("100000001-break-insert -f b_MyFunction")
+ self.runCmd("100000001-break-insert -f main")
self.expect("100000001\^done,bkpt={number=\"1\"")
self.runCmd("2-exec-run")
self.expect("2\^running")
@@ -53,7 +54,7 @@ class MiSyntaxTestCase(lldbmi_testcase.M
self.expect("\^done")
# Check that it was loaded correctly
- self.runCmd("-break-insert -f a_MyFunction")
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
Removed: lldb/trunk/test/tools/lldb-mi/a.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/a.c?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/a.c (original)
+++ lldb/trunk/test/tools/lldb-mi/a.c (removed)
@@ -1,8 +0,0 @@
-#include <stdio.h>
-
-int
-a_MyFunction ()
-{
- printf ("a is about to return 10.\n"); //BP_a_MyFunction
- return 10;
-}
Removed: lldb/trunk/test/tools/lldb-mi/b.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/b.c?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/b.c (original)
+++ lldb/trunk/test/tools/lldb-mi/b.c (removed)
@@ -1,10 +0,0 @@
-#include <stdio.h>
-
-extern int a_MyFunction();
-int
-b_MyFunction ()
-{
- (void)a_MyFunction(); //BP_b_MyFunction
- printf ("b is about to return 20.\n");
- return 20;
-}
Added: lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile (added)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/Makefile Fri Feb 20 10:34:33 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Copied: lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py (from r230007, lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py?p2=lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py&r1=230007&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiBreakpoint.py (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py Fri Feb 20 10:34:33 2015
@@ -1,42 +1,63 @@
"""
-Test that the lldb-mi driver understands an MI breakpoint command.
+Test lldb-mi -break-xxx commands.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
-class MiBreakpointTestCase(lldbmi_testcase.MiTestCaseBase):
+class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_pendbreakonsym(self):
- """Test that 'lldb-mi --interpreter' works for pending symbol breakpoints."""
+ def test_lldbmi_break_insert_function_pending(self):
+ """Test that 'lldb-mi --interpreter' works for pending function breakpoints."""
self.spawnLldbMi(args = None)
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- self.runCmd("-break-insert -f b_MyFunction")
+ self.runCmd("-break-insert -f g_MyFunction")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_break_insert_function(self):
+ """Test that 'lldb-mi --interpreter' works for function breakpoints."""
+
+ self.spawnLldbMi(args = None)
+
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ self.runCmd("-break-insert g_MyFunction")
+ self.expect("\^done,bkpt={number=\"2\"")
+
self.runCmd("-exec-continue")
self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_pendbreakonsrc(self):
- """Test that 'lldb-mi --interpreter' works for pending source breakpoints."""
+ def test_lldbmi_break_insert_file_line_pending(self):
+ """Test that 'lldb-mi --interpreter' works for pending file:line breakpoints."""
self.spawnLldbMi(args = None)
@@ -45,24 +66,19 @@ class MiBreakpointTestCase(lldbmi_testca
# Find the line number to break inside main() and set
# pending BP
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert -f main.c:%d" % line)
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert -f main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
-
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_breakpoints(self):
- """Test that 'lldb-mi --interpreter' works for breakpoints."""
+ def test_lldbmi_break_insert_file_line(self):
+ """Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
self.spawnLldbMi(args = None)
@@ -76,38 +92,42 @@ class MiBreakpointTestCase(lldbmi_testca
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Break on symbol
- self.runCmd("-break-insert b_MyFunction")
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"2\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Break on source
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert main.c:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
-
- # Check with full path. TODO, figure out why this commands fails
- # if -f is not given
- line = line_number('main.c', '// BP_doloop')
- full_path = os.path.join(os.getcwd(), "main.c")
- self.runCmd("-break-insert -f %s:%d" % (full_path, line))
- self.expect("\^done,bkpt={number=\"4\"")
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @unittest2.expectedFailure("-break-insert doesn't work for absolute path")
+ def test_lldbmi_break_insert_file_line_absolute_path(self):
+ """Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
- self.runCmd("-exec-continue")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\"")
+ self.spawnLldbMi(args = None)
- self.runCmd("-exec-continue")
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+
+ self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Run to exit
+ import os
+ path = os.path.join(os.getcwd(), "main.cpp")
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert %s:%d" % (path, line))
+ self.expect("\^done,bkpt={number=\"2\"")
+
self.runCmd("-exec-continue")
self.expect("\^running")
- self.expect("\*stopped,reason=\"exited-normally\"")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
if __name__ == '__main__':
unittest2.main()
Added: lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp (added)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp Fri Feb 20 10:34:33 2015
@@ -0,0 +1,20 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+void
+g_MyFunction(void)
+{
+}
+
+int
+main(int argc, char const *argv[])
+{
+ g_MyFunction();
+ return 0; // BP_return
+}
Added: lldb/trunk/test/tools/lldb-mi/control/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/Makefile?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/control/Makefile (added)
+++ lldb/trunk/test/tools/lldb-mi/control/Makefile Fri Feb 20 10:34:33 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Copied: lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py (from r230010, lldb/trunk/test/tools/lldb-mi/TestMiExec.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py?p2=lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiExec.py&r1=230010&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py Fri Feb 20 10:34:33 2015
@@ -1,5 +1,5 @@
"""
-Test that the lldb-mi driver works with -exec-xxx commands
+Test lldb-mi -exec-xxx commands.
"""
import lldbmi_testcase
@@ -8,6 +8,8 @@ import unittest2
class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.skip("-exec-abort isn't implemented")
@@ -61,7 +63,6 @@ class MiExecTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_arguments_set(self):
"""Test that 'lldb-mi --interpreter' can pass args using -exec-arguments."""
@@ -106,7 +107,6 @@ class MiExecTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_arguments_reset(self):
"""Test that 'lldb-mi --interpreter' can reset previously set args using -exec-arguments."""
@@ -117,7 +117,7 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.expect("\^done")
# Set arguments
- self.runCmd("-exec-arguments foo bar baz")
+ self.runCmd("-exec-arguments arg1")
self.expect("\^done")
self.runCmd("-exec-arguments")
self.expect("\^done")
@@ -136,7 +136,6 @@ class MiExecTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_next(self):
"""Test that 'lldb-mi --interpreter' works for stepping."""
@@ -153,27 +152,27 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Warning: the following is sensative to the lines in the source.
+ # Warning: the following is sensative to the lines in the source
# Test -exec-next
self.runCmd("-exec-next --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
# Test that --thread is optional
self.runCmd("-exec-next --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"30\"")
# Test that --frame is optional
self.runCmd("-exec-next --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"29\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"31\"")
# Test that both --thread and --frame are optional
- self.runCmd("-exec-next --thread 1")
+ self.runCmd("-exec-next")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"31\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"32\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next --thread 0")
@@ -189,7 +188,6 @@ class MiExecTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_next_instruction(self):
"""Test that 'lldb-mi --interpreter' works for instruction stepping."""
@@ -212,23 +210,23 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Test -exec-next-instruction
self.runCmd("-exec-next-instruction --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"28\"")
# Test that --thread is optional
self.runCmd("-exec-next-instruction --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"28\"")
# Test that --frame is optional
self.runCmd("-exec-next-instruction --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
# Test that both --thread and --frame are optional
- self.runCmd("-exec-next-instruction --thread 1")
+ self.runCmd("-exec-next-instruction")
self.expect("\^running")
- # Depending on compiler, it can stop at different line.
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
+ # Depending on compiler, it can stop at different line
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next-instruction --thread 0")
@@ -244,7 +242,6 @@ class MiExecTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_step(self):
"""Test that 'lldb-mi --interpreter' works for stepping into."""
@@ -254,9 +251,8 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Run to printf call
- line = line_number('main.c', '//BP_printf_call')
- self.runCmd("-break-insert -f main.c:%d" % line)
+ # Run to main
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
@@ -269,37 +265,39 @@ class MiExecTestCase(lldbmi_testcase.MiT
#FIXME: is this supposed to step into printf?
self.runCmd("-exec-step --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
- # Test that -exec-step steps into a_MyFunction and back out
+ # Test that -exec-step steps into g_MyFunction and back out
# (and that --thread is optional)
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
#FIXME: is this supposed to step into printf?
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
# Use -exec-finish here to make sure that control reaches the caller.
- # -exec-step can keep us in the a_MyFunction for gcc
+ # -exec-step can keep us in the g_MyFunction for gcc
self.runCmd("-exec-finish --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"30\"")
+
+ # Test that -exec-step steps into s_MyFunction
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"s_MyFunction\(\)\"")
- # Test that -exec-step steps into b_MyFunction
+ # Test that -exec-step steps into g_MyFunction
# (and that --frame is optional)
self.runCmd("-exec-step --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"b_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
- # Test that -exec-step steps into a_MyFunction from inside
- # b_MyFunction (and that both --thread and --frame are optional)
+ # Test that -exec-step steps into g_MyFunction from inside
+ # s_MyFunction (and that both --thread and --frame are optional)
self.runCmd("-exec-step")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-step --thread 0")
@@ -327,37 +325,41 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Warning: the following is sensative to the lines in the
# source and optimizations
- # Run to a_MyFunction call
- line = line_number('main.c', '//BP_a_MyFunction_call')
- self.runCmd("-break-insert -f main.c:%d" % line)
+ # Run to main
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
+ # Test that -exec-next steps over printf
+ self.runCmd("-exec-next --thread 1 --frame 0")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
+
# Test that -exec-step-instruction steps over non branching
# instruction
self.runCmd("-exec-step-instruction --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"2[8-9]\"")
- # Test that -exec-step-instruction steps over non branching
+ # Test that -exec-step-instruction steps into g_MyFunction
# instruction (and that --thread is optional)
self.runCmd("-exec-step-instruction --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
- # Test that -exec-step-instruction steps into a_MyFunction
+ # Test that -exec-step-instruction steps over non branching
# (and that --frame is optional)
self.runCmd("-exec-step-instruction --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
- # Test that -exec-step-instruction steps into a_MyFunction
+ # Test that -exec-step-instruction steps into g_MyFunction
# (and that both --thread and --frame are optional)
- self.runCmd("-exec-step-instruction --thread 1")
+ self.runCmd("-exec-step-instruction")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"a_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-step-instruction --thread 0")
@@ -373,7 +375,6 @@ class MiExecTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_finish(self):
"""Test that 'lldb-mi --interpreter' works for -exec-finish."""
@@ -383,43 +384,38 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Set argument 'l'
- self.runCmd("-exec-arguments l")
- self.expect("\^done")
-
- # Set BP at a_MyFunction_call and run to BP
- self.runCmd("-break-insert -f a_MyFunction")
+ # Set BP at g_MyFunction and run to BP
+ self.runCmd("-break-insert -f g_MyFunction")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Test that -exec-finish returns from a_MyFunction
+ # Test that -exec-finish returns from g_MyFunction
self.runCmd("-exec-finish --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"main\"")
- # Run to BP inside b_MyFunction call
- line = line_number('b.c', '//BP_b_MyFunction')
- self.runCmd("-break-insert -f b.c:%d" % line)
+ # Run to BP inside s_MyFunction call
+ self.runCmd("-break-insert s_MyFunction")
self.expect("\^done,bkpt={number=\"2\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Test that -exec-finish hits BP at a_MyFunction call inside
- # b_MyFunction (and that --thread is optional)
+ # Test that -exec-finish hits BP at g_MyFunction call inside
+ # s_MyFunction (and that --thread is optional)
self.runCmd("-exec-finish --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Test that -exec-finish returns from a_MyFunction call inside
- # b_MyFunction (and that --frame is optional)
+ # Test that -exec-finish returns from g_MyFunction call inside
+ # s_MyFunction (and that --frame is optional)
self.runCmd("-exec-finish --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"b_MyFunction\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"s_MyFunction\(\)\"")
- # Test that -exec-finish returns from b_MyFunction
+ # Test that -exec-finish returns from s_MyFunction
# (and that both --thread and --frame are optional)
self.runCmd("-exec-finish")
self.expect("\^running")
@@ -438,8 +434,8 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Set BP at printf and run to BP
# FIXME: BP at printf not resolved and never hit!
- self.runCmd("-interpreter-exec command \"b printf\"") #FIXME: self.runCmd("-break-insert -f printf")
- self.expect("\^done") #FIXME: self.expect("\^done,bkpt={number=\"3\"")
+ self.runCmd("-interpreter-exec command \"breakpoint set --name printf\"") #FIXME: self.runCmd("-break-insert -f printf")
+ self.expect("\^done") #FIXME: self.expect("\^done,bkpt={number=\"3\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
Added: lldb/trunk/test/tools/lldb-mi/control/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/main.cpp?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/control/main.cpp (added)
+++ lldb/trunk/test/tools/lldb-mi/control/main.cpp Fri Feb 20 10:34:33 2015
@@ -0,0 +1,33 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdio>
+
+void
+g_MyFunction(void)
+{
+ printf("g_MyFunction");
+}
+
+static void
+s_MyFunction(void)
+{
+ g_MyFunction();
+ printf("s_MyFunction");
+}
+
+int
+main(int argc, char const *argv[])
+{
+ printf("start");
+ g_MyFunction();
+ s_MyFunction();
+ printf("exit");
+ return 0;
+}
Added: lldb/trunk/test/tools/lldb-mi/data/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/Makefile?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/data/Makefile (added)
+++ lldb/trunk/test/tools/lldb-mi/data/Makefile Fri Feb 20 10:34:33 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Copied: lldb/trunk/test/tools/lldb-mi/data/TestMiData.py (from r230007, lldb/trunk/test/tools/lldb-mi/TestMiData.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/TestMiData.py?p2=lldb/trunk/test/tools/lldb-mi/data/TestMiData.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiData.py&r1=230007&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiData.py (original)
+++ lldb/trunk/test/tools/lldb-mi/data/TestMiData.py Fri Feb 20 10:34:33 2015
@@ -1,5 +1,5 @@
"""
-Test that the lldb-mi driver works with -data-xxx commands
+Test lldb-mi -data-xxx commands.
"""
import lldbmi_testcase
@@ -8,10 +8,11 @@ import unittest2
class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_disassemble(self):
"""Test that 'lldb-mi --interpreter' works for -data-disassemble."""
@@ -40,7 +41,7 @@ class MiDataTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
+ @unittest2.skip("-data-evaluate-expression doesn't work") #FIXME: the global case worked before refactoring
def test_lldbmi_data_read_memory_bytes(self):
"""Test that 'lldb-mi --interpreter' works for -data-read-memory-bytes."""
@@ -57,20 +58,29 @@ class MiDataTestCase(lldbmi_testcase.MiT
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Get address of s_RawData
- self.runCmd("-data-evaluate-expression &s_RawData")
- self.expect("\^done,value=\"0x[0-9a-f]+\"",timeout=1)
+ # Get address of char[] (global)
+ self.runCmd("-data-evaluate-expression &g_CharArray")
+ self.expect("\^done,value=\"0x[0-9a-f]+\"")
+ addr = int(self.child.after.split("\"")[1], 16)
+ size = 5
+
+ # Test that -data-read-memory-bytes works for char[] type (global)
+ self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
+ self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % (addr, addr + size))
+
+ # Get address of static char[]
+ self.runCmd("-data-evaluate-expression &s_CharArray")
+ self.expect("\^done,value=\"0x[0-9a-f]+\"")
addr = int(self.child.after.split("\"")[1], 16)
size = 5
- # Test -data-read-memory-bytes: try to read data of s_RawData
+ # Test that -data-read-memory-bytes works for static char[] type
self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
- self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1234567800\"}\]" % (addr, addr + size))
+ self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % (addr, addr + size))
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_list_register_names(self):
"""Test that 'lldb-mi --interpreter' works for -data-list-register-names."""
@@ -98,7 +108,6 @@ class MiDataTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_list_register_values(self):
"""Test that 'lldb-mi --interpreter' works for -data-list-register-values."""
Added: lldb/trunk/test/tools/lldb-mi/data/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/main.cpp?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/data/main.cpp (added)
+++ lldb/trunk/test/tools/lldb-mi/data/main.cpp Fri Feb 20 10:34:33 2015
@@ -0,0 +1,17 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+const char g_CharArray[] = "\x10\x11\x12\x13";
+static const char s_CharArray[] = "\x20\x21\x22\x23";
+
+int
+main(int argc, char const *argv[])
+{
+ return 0;
+}
Modified: lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py?rev=230022&r1=230021&r2=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-mi/lldbmi_testcase.py Fri Feb 20 10:34:33 2015
@@ -8,7 +8,7 @@ import unittest2
class MiTestCaseBase(Base):
- mydir = Base.compute_mydir(__file__)
+ mydir = Base.compute_mydir(__file__) #TODO remove me
myexe = "a.out"
mylog = "child.log"
Removed: lldb/trunk/test/tools/lldb-mi/locals.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/locals.c?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/locals.c (original)
+++ lldb/trunk/test/tools/lldb-mi/locals.c (removed)
@@ -1,45 +0,0 @@
-struct inner
-{
- int var_d;
-};
-
-struct my_type
-{
- int var_a;
- char var_b;
- struct inner inner_;
-};
-
-int local_struct_test(void)
-{
- struct my_type var_c;
- var_c.var_a = 10;
- var_c.var_b = 'a';
- var_c.inner_.var_d = 30;
- return 0; // BP_LOCAL_STRUCT
-}
-
-int local_array_test(void)
-{
- int array[3];
- array[0] = 100;
- array[1] = 200;
- array[2] = 300;
- return 0; // BP_LOCAL_ARRAY
-}
-
-int local_pointer_test(void)
-{
- const char* test_str = "Rakaposhi";
- int var_e = 24;
- int *ptr = &var_e;
- return 0; // BP_LOCAL_PTR
-}
-
-int local_test()
-{
- local_struct_test();
- local_array_test();
- local_pointer_test();
- return 0;
-}
\ No newline at end of file
Removed: lldb/trunk/test/tools/lldb-mi/loop.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/loop.c?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/loop.c (original)
+++ lldb/trunk/test/tools/lldb-mi/loop.c (removed)
@@ -1,14 +0,0 @@
-#include <unistd.h>
-int
-infloop ()
-{
- int loop = 1;
- while (loop > 0) {
- if (loop > 10) {
- sleep(1);
- loop = 1;
- }
- loop++; //BP_loop
- }
- return loop;
-}
Removed: lldb/trunk/test/tools/lldb-mi/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/main.c?rev=230021&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/main.c (original)
+++ lldb/trunk/test/tools/lldb-mi/main.c (removed)
@@ -1,40 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <stdio.h>
-extern int a_MyFunction();
-extern int b_MyFunction();
-extern int infloop();
-extern int local_test();
-int doloop, dosegfault;
-int g_MyVar = 3;
-static int s_MyVar = 4;
-//FIXME -data-evaluate-expression/print can't evaluate value of type "static char[]"
-const char s_RawData[] = "\x12\x34\x56\x78"; //FIXME static const char s_RawData[] = "\x12\x34\x56\x78";
-
-int main (int argc, char const *argv[])
-{ //FUNC_main
- int a, b;
- printf("argc=%d\n", argc); //BP_printf_call
- //BP_argctest
- a = a_MyFunction(); //BP_a_MyFunction_call
- b = b_MyFunction(); //BP_b_MyFunction_call
- //BP_localstest -- it must be at line #24 (or fix it in main*.micmds)
- if (doloop) // BP_doloop
- infloop();
- if (dosegfault)
- *(volatile int *)NULL = 1;
- if (argc > 1 && *argv[1] == 'l') {
- a++;
- printf("a=%d, argv[1]=%s\n", a, argv[1]); //BP_argtest
- }
- s_MyVar = a + b;
- local_test();
- return a + b - s_MyVar; //BP_source
-}
Copied: lldb/trunk/test/tools/lldb-mi/main.cpp (from r230010, lldb/trunk/test/tools/lldb-mi/main.c)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/main.cpp?p2=lldb/trunk/test/tools/lldb-mi/main.cpp&p1=lldb/trunk/test/tools/lldb-mi/main.c&r1=230010&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/main.c (original)
+++ lldb/trunk/test/tools/lldb-mi/main.cpp Fri Feb 20 10:34:33 2015
@@ -7,34 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
-extern int a_MyFunction();
-extern int b_MyFunction();
-extern int infloop();
-extern int local_test();
-int doloop, dosegfault;
-int g_MyVar = 3;
-static int s_MyVar = 4;
-//FIXME -data-evaluate-expression/print can't evaluate value of type "static char[]"
-const char s_RawData[] = "\x12\x34\x56\x78"; //FIXME static const char s_RawData[] = "\x12\x34\x56\x78";
+#include <cstdio>
-int main (int argc, char const *argv[])
-{ //FUNC_main
- int a, b;
- printf("argc=%d\n", argc); //BP_printf_call
- //BP_argctest
- a = a_MyFunction(); //BP_a_MyFunction_call
- b = b_MyFunction(); //BP_b_MyFunction_call
- //BP_localstest -- it must be at line #24 (or fix it in main*.micmds)
- if (doloop) // BP_doloop
- infloop();
- if (dosegfault)
- *(volatile int *)NULL = 1;
- if (argc > 1 && *argv[1] == 'l') {
- a++;
- printf("a=%d, argv[1]=%s\n", a, argv[1]); //BP_argtest
- }
- s_MyVar = a + b;
- local_test();
- return a + b - s_MyVar; //BP_source
+int
+main(int argc, char const *argv[])
+{
+ printf("argc=%d\n", argc);
+ return 0;
}
Added: lldb/trunk/test/tools/lldb-mi/signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/signal/Makefile?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/signal/Makefile (added)
+++ lldb/trunk/test/tools/lldb-mi/signal/Makefile Fri Feb 20 10:34:33 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Copied: lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py (from r230010, lldb/trunk/test/tools/lldb-mi/TestMiNotification.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py?p2=lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiNotification.py&r1=230010&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiNotification.py (original)
+++ lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py Fri Feb 20 10:34:33 2015
@@ -1,64 +1,55 @@
"""
-Test that the lldb-mi driver nofities user properly.
+Test that the lldb-mi handles signals properly.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
-class MiNotificationTestCase(lldbmi_testcase.MiTestCaseBase):
+class MiSignalTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
- def test_lldbmi_prompt(self):
- """Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_lldbmi_stopped_when_interrupt(self):
+ """Test that 'lldb-mi --interpreter' interrupt and resume a looping app."""
self.spawnLldbMi(args = None)
- # Test that lldb-mi is ready after startup
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after unknown command
- self.runCmd("-unknown-command")
- self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -file-exec-and-symbols
+ # Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- self.expect(self.child_prompt, exactly = True)
- # Test that lldb-mi is ready after -break-insert
- self.runCmd("-break-insert -f b_MyFunction")
+ # Run to main
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after -exec-run
self.runCmd("-exec-run")
- self.expect("\*running")
- self.expect(self.child_prompt, exactly = True)
-
- # Test that lldb-mi is ready after BP hit
+ self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- self.expect(self.child_prompt, exactly = True)
- # Test that lldb-mi is ready after -exec-continue
+ # Set doloop=1 and run (to loop forever)
+ self.runCmd("-data-evaluate-expression \"do_loop=1\"")
+ self.expect("\^done,value=\"1\"")
+ self.runCmd("-exec-continue")
+ self.expect("\^running")
+
+ # Test that -exec-interrupt can interrupt an execution
+ self.runCmd("-exec-interrupt")
+ self.expect("\*stopped,reason=\"signal-received\"")
+
+ # Continue (to loop forever)
self.runCmd("-exec-continue")
self.expect("\^running")
- self.expect(self.child_prompt, exactly = True)
- # Test that lldb-mi is ready after program exited
- self.expect("\*stopped,reason=\"exited-normally\"")
- self.expect(self.child_prompt, exactly = True)
+ # Test that Ctrl+C can interrupt an execution
+ self.child.sendintr() #FIXME: here uses self.child directly
+ self.expect("\*stopped,reason=\"signal-received\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stopped_when_stopatentry_local(self):
"""Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (local)."""
@@ -93,7 +84,7 @@ class MiNotificationTestCase(lldbmi_test
# Prepare debugserver
import os, sys
- lldb_gdbserver_folder = os.path.abspath(os.path.join(os.path.dirname(os.getcwd()), "lldb-gdbserver"))
+ lldb_gdbserver_folder = os.path.abspath(os.path.join(os.getcwd(), "../../lldb-gdbserver"))
sys.path.append(lldb_gdbserver_folder)
import lldbgdbserverutils
debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
@@ -134,7 +125,6 @@ class MiNotificationTestCase(lldbmi_test
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stopped_when_segfault_local(self):
"""Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (local)."""
@@ -151,8 +141,8 @@ class MiNotificationTestCase(lldbmi_test
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Set dosegfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"dosegfault=1\"")
+ # Set do_segfault=1 and run (to cause a segfault error)
+ self.runCmd("-data-evaluate-expression \"do_segfault=1\"")
self.expect("\^done,value=\"1\"")
self.runCmd("-exec-continue")
self.expect("\^running")
@@ -168,7 +158,7 @@ class MiNotificationTestCase(lldbmi_test
# Prepare debugserver
import os, sys
- lldb_gdbserver_folder = os.path.abspath(os.path.join(os.path.dirname(os.getcwd()), "lldb-gdbserver"))
+ lldb_gdbserver_folder = os.path.abspath(os.path.join(os.getcwd(), "../../lldb-gdbserver"))
sys.path.append(lldb_gdbserver_folder)
import lldbgdbserverutils
debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
@@ -199,8 +189,8 @@ class MiNotificationTestCase(lldbmi_test
self.expect("\^done") #FIXME: self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Set dosegfault=1 and run (to cause a segfault error)
- self.runCmd("-data-evaluate-expression \"dosegfault=1\"")
+ # Set do_segfault=1 and run (to cause a segfault error)
+ self.runCmd("-data-evaluate-expression \"do_segfault=1\"")
self.expect("\^done,value=\"1\"")
self.runCmd("-exec-continue")
self.expect("\^running")
Added: lldb/trunk/test/tools/lldb-mi/signal/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/signal/main.cpp?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/signal/main.cpp (added)
+++ lldb/trunk/test/tools/lldb-mi/signal/main.cpp Fri Feb 20 10:34:33 2015
@@ -0,0 +1,33 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstddef>
+#include <unistd.h>
+
+int do_loop;
+int do_segfault;
+
+int
+main(int argc, char const *argv[])
+{
+ if (do_loop)
+ {
+ do
+ sleep(1);
+ while (do_loop); // BP_loop_condition
+ }
+
+ if (do_segfault)
+ {
+ int *null_ptr = NULL;
+ return *null_ptr;
+ }
+
+ return 0;
+}
Added: lldb/trunk/test/tools/lldb-mi/stack/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/Makefile?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/stack/Makefile (added)
+++ lldb/trunk/test/tools/lldb-mi/stack/Makefile Fri Feb 20 10:34:33 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Copied: lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py (from r230007, lldb/trunk/test/tools/lldb-mi/TestMiStack.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py?p2=lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiStack.py&r1=230007&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiStack.py (original)
+++ lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py Fri Feb 20 10:34:33 2015
@@ -1,5 +1,5 @@
"""
-Test that the lldb-mi driver works with -stack-xxx commands
+Test lldb-mi -stack-xxx commands.
"""
import lldbmi_testcase
@@ -8,10 +8,11 @@ import unittest2
class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_arguments(self):
"""Test that 'lldb-mi --interpreter' can shows arguments."""
@@ -49,7 +50,6 @@ class MiStackTestCase(lldbmi_testcase.Mi
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_locals(self):
"""Test that 'lldb-mi --interpreter' can shows local variables."""
@@ -60,13 +60,21 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.expect("\^done")
# Run to main
- line = line_number('main.c', '//BP_localstest')
- self.runCmd("-break-insert --file main.c:%d" % line)
+ self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
+ # Test int local variables:
+ # Run to BP_local_int_test
+ line = line_number('main.cpp', '// BP_local_int_test')
+ self.runCmd("-break-insert --file main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"2\"")
+ self.runCmd("-exec-continue")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
# Test -stack-list-locals: use 0 or --no-values
self.runCmd("-stack-list-locals 0")
self.expect("\^done,locals=\[name=\"a\",name=\"b\"\]")
@@ -85,11 +93,11 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
- # Test struct local variable
- line = line_number('locals.c', '// BP_LOCAL_STRUCT')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"2\"")
-
+ # Test struct local variable:
+ # Run to BP_local_struct_test
+ line = line_number('main.cpp', '// BP_local_struct_test')
+ self.runCmd("-break-insert --file main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"3\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
@@ -112,11 +120,11 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[name=\"var_c\"\]")
- # Test array local variable
- line = line_number('locals.c', '// BP_LOCAL_ARRAY')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"3\"")
-
+ # Test array local variable:
+ # Run to BP_local_array_test
+ line = line_number('main.cpp', '// BP_local_array_test')
+ self.runCmd("-break-insert --file main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"4\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
@@ -139,11 +147,11 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[name=\"array\"\]")
- # Test pointers as local variable
- line = line_number('locals.c', '// BP_LOCAL_PTR')
- self.runCmd("-break-insert --file locals.c:%d" % line)
- self.expect("\^done,bkpt={number=\"4\"")
-
+ # Test pointers as local variable:
+ # Run to BP_local_pointer_test
+ line = line_number('main.cpp', '// BP_local_pointer_test')
+ self.runCmd("-break-insert --file main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"5\"")
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
@@ -169,7 +177,6 @@ class MiStackTestCase(lldbmi_testcase.Mi
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_info_depth(self):
"""Test that 'lldb-mi --interpreter' can shows depth of the stack."""
@@ -193,7 +200,6 @@ class MiStackTestCase(lldbmi_testcase.Mi
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_info_frame(self):
"""Test that 'lldb-mi --interpreter' can show information about current frame."""
@@ -216,12 +222,11 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that -stack-info-frame works when program is running
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
+ self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_frames(self):
"""Test that 'lldb-mi --interpreter' can lists the frames on the stack."""
@@ -240,12 +245,11 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test stack frame: get frame #0 info
self.runCmd("-stack-list-frames 0 0")
- self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\".+\"\}\]")
+ self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\".+\"\}\]")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_select_frame(self):
"""Test that 'lldb-mi --interpreter' can choose current frame."""
@@ -272,7 +276,7 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that current frame is #0
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
+ self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
# Test that -stack-select-frame can select the selected frame
self.runCmd("-stack-select-frame 0")
@@ -280,7 +284,7 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that current frame is still #0
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
+ self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
# Test that -stack-select-frame can select frame #1 (parent frame)
self.runCmd("-stack-select-frame 1")
@@ -296,7 +300,7 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that current frame is #0 and it has the same information
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.c\",fullname=\".*main\.c\",line=\"\d+\"\}")
+ self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
if __name__ == '__main__':
unittest2.main()
Added: lldb/trunk/test/tools/lldb-mi/stack/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/main.cpp?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/stack/main.cpp (added)
+++ lldb/trunk/test/tools/lldb-mi/stack/main.cpp Fri Feb 20 10:34:33 2015
@@ -0,0 +1,66 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+struct inner
+{
+ int var_d;
+};
+
+struct my_type
+{
+ int var_a;
+ char var_b;
+ struct inner inner_;
+};
+
+int
+local_int_test(void)
+{
+ int a = 10, b = 20;
+ return 0; // BP_local_int_test
+}
+
+int
+local_struct_test(void)
+{
+ struct my_type var_c;
+ var_c.var_a = 10;
+ var_c.var_b = 'a';
+ var_c.inner_.var_d = 30;
+ return 0; // BP_local_struct_test
+}
+
+int
+local_array_test(void)
+{
+ int array[3];
+ array[0] = 100;
+ array[1] = 200;
+ array[2] = 300;
+ return 0; // BP_local_array_test
+}
+
+int
+local_pointer_test(void)
+{
+ const char *test_str = "Rakaposhi";
+ int var_e = 24;
+ int *ptr = &var_e;
+ return 0; // BP_local_pointer_test
+}
+
+int
+main(int argc, char const *argv[])
+{
+ local_int_test();
+ local_struct_test();
+ local_array_test();
+ local_pointer_test();
+ return 0;
+}
Added: lldb/trunk/test/tools/lldb-mi/symbol/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/Makefile?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/Makefile (added)
+++ lldb/trunk/test/tools/lldb-mi/symbol/Makefile Fri Feb 20 10:34:33 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Copied: lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py (from r230010, lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py?p2=lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py&r1=230010&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiSymbol.py (original)
+++ lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py Fri Feb 20 10:34:33 2015
@@ -1,5 +1,5 @@
"""
-Test that the lldb-mi driver works with -symbol-xxx commands
+Test lldb-mi -symbol-xxx commands.
"""
import lldbmi_testcase
@@ -8,10 +8,11 @@ import unittest2
class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase):
+ mydir = TestBase.compute_mydir(__file__)
+
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_symbol_list_lines_file(self):
"""Test that 'lldb-mi --interpreter' works for -symbol-list-lines when file exists."""
@@ -28,33 +29,33 @@ class MiSymbolTestCase(lldbmi_testcase.M
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Get address of main
+ # Get address of main and its line
self.runCmd("-data-evaluate-expression main")
self.expect("\^done,value=\"0x[0-9a-f]+\"")
- main_addr = int(self.child.after.split("\"")[1], 16)
- main_line = line_number('main.c', '//FUNC_main')
+ addr = int(self.child.after.split("\"")[1], 16)
+ line = line_number('main.cpp', '// FUNC_main')
# Test that -symbol-list-lines works on valid data
- self.runCmd("-symbol-list-lines main.c")
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (main_addr, main_line))
+ self.runCmd("-symbol-list-lines main.cpp")
+ self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (addr, line))
# Test that -symbol-list-lines fails when file doesn't exist
self.runCmd("-symbol-list-lines unknown_file")
self.expect("\^error,message=\"warning: No source filenames matched 'unknown_file'. error: no source filenames matched any command arguments \"")
# Test that -symbol-list-lines fails when file is specified using relative path
- self.runCmd("-symbol-list-lines ./main.c")
- self.expect("\^error,message=\"warning: No source filenames matched './main.c'. error: no source filenames matched any command arguments \"")
+ self.runCmd("-symbol-list-lines ./main.cpp")
+ self.expect("\^error,message=\"warning: No source filenames matched './main.cpp'. error: no source filenames matched any command arguments \"")
# Test that -symbol-list-lines works when file is specified using absolute path
import os
- main_file = os.path.join(os.getcwd(), "main.c")
- self.runCmd("-symbol-list-lines \"%s\"" % main_file)
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (main_addr, main_line))
+ path = os.path.join(os.getcwd(), "main.cpp")
+ self.runCmd("-symbol-list-lines \"%s\"" % path)
+ self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (addr, line))
# Test that -symbol-list-lines fails when file doesn't exist
- self.runCmd("-symbol-list-lines unknown_dir/main.c")
- self.expect("\^error,message=\"warning: No source filenames matched 'unknown_dir/main.c'. error: no source filenames matched any command arguments \"")
+ self.runCmd("-symbol-list-lines unknown_dir/main.cpp")
+ self.expect("\^error,message=\"warning: No source filenames matched 'unknown_dir/main.cpp'. error: no source filenames matched any command arguments \"")
if __name__ == '__main__':
unittest2.main()
Added: lldb/trunk/test/tools/lldb-mi/symbol/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/main.cpp?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/main.cpp (added)
+++ lldb/trunk/test/tools/lldb-mi/symbol/main.cpp Fri Feb 20 10:34:33 2015
@@ -0,0 +1,14 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int
+main(int argc, char const *argv[])
+{ // FUNC_main
+ return 0;
+}
Added: lldb/trunk/test/tools/lldb-mi/variable/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/Makefile?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/Makefile (added)
+++ lldb/trunk/test/tools/lldb-mi/variable/Makefile Fri Feb 20 10:34:33 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Copied: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py (from r230007, lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py?p2=lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py&p1=lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py&r1=230007&r2=230022&rev=230022&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiEvaluate.py (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py Fri Feb 20 10:34:33 2015
@@ -1,17 +1,18 @@
"""
-Test that the lldb-mi driver can evaluate expressions.
+Test lldb-mi -var-xxx commands.
"""
import lldbmi_testcase
from lldbtest import *
import unittest2
-class MiEvaluateTestCase(lldbmi_testcase.MiTestCaseBase):
+class MiVarTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_eval(self):
"""Test that 'lldb-mi --interpreter' works for evaluating."""
@@ -21,9 +22,9 @@ class MiEvaluateTestCase(lldbmi_testcase
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Run to program return (marked BP_source)
- line = line_number('main.c', '//BP_source')
- self.runCmd("-break-insert main.c:%d" % line)
+ # Run to program return
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
self.expect("\^running")
@@ -44,10 +45,12 @@ class MiEvaluateTestCase(lldbmi_testcase
self.expect("\^done,value=\"3\"")
self.runCmd("-var-show-attributes var2")
self.expect("\^done,status=\"editable\"")
+ self.runCmd("-var-list-children var2")
+ self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.runCmd("-data-evaluate-expression \"g_MyVar=30\"")
self.expect("\^done,value=\"30\"")
- self.runCmd("-var-update var2")
- #self.expect("name=\"var2\",value=\"30\"") #FIXME -var-update doesn't work
+ self.runCmd("-var-update --all-values var2")
+ #self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
self.runCmd("-var-delete var2")
self.expect("\^done")
self.runCmd("-var-create var2 * g_MyVar")
@@ -62,10 +65,12 @@ class MiEvaluateTestCase(lldbmi_testcase
self.expect("\^done,value=\"30\"")
self.runCmd("-var-show-attributes var3")
self.expect("\^done,status=\"editable\"")
+ self.runCmd("-var-list-children var3")
+ self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.runCmd("-data-evaluate-expression \"s_MyVar=3\"")
self.expect("\^done,value=\"3\"")
- self.runCmd("-var-update var3")
- #self.expect("name=\"var3\",value=\"3\"") #FIXME -var-update doesn't work
+ self.runCmd("-var-update --all-values var3")
+ #self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
self.runCmd("-var-delete var3")
self.expect("\^done")
self.runCmd("-var-create var3 * s_MyVar")
@@ -80,10 +85,12 @@ class MiEvaluateTestCase(lldbmi_testcase
self.expect("\^done,value=\"20\"")
self.runCmd("-var-show-attributes var4")
self.expect("\^done,status=\"editable\"")
+ self.runCmd("-var-list-children var4")
+ self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
self.runCmd("-data-evaluate-expression \"b=2\"")
self.expect("\^done,value=\"2\"")
- self.runCmd("-var-update var4")
- #self.expect("name=\"var4\",value=\"2\"") #FIXME -var-update doesn't work
+ self.runCmd("-var-update --all-values var4")
+ #self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
self.runCmd("-var-delete var4")
self.expect("\^done")
self.runCmd("-var-create var4 * b")
@@ -98,6 +105,8 @@ class MiEvaluateTestCase(lldbmi_testcase
self.expect("\^done,value=\"12\"")
self.runCmd("-var-show-attributes var5")
self.expect("\^done,status=\"editable\"") #FIXME editable or not?
+ self.runCmd("-var-list-children var5")
+ self.expect("\^done,numchild=\"0\",children=\"\[\]\"")
# Print argument "argv[0]"
self.runCmd("-data-evaluate-expression \"argv[0]\"")
@@ -108,6 +117,8 @@ class MiEvaluateTestCase(lldbmi_testcase
self.expect("\^done,value=\"0x[0-9a-f]+\"")
self.runCmd("-var-show-attributes var6")
self.expect("\^done,status=\"editable\"")
+ self.runCmd("-var-list-children var6")
+ #self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$15\",exp=\"\*\$15\",numchild=\"0\",type=\"const char\",thread-id=\"1\",has_more=\"0\"\}\]") #FIXME -var-list-children shows invalid thread-id
if __name__ == '__main__':
unittest2.main()
Added: lldb/trunk/test/tools/lldb-mi/variable/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/main.cpp?rev=230022&view=auto
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/main.cpp (added)
+++ lldb/trunk/test/tools/lldb-mi/variable/main.cpp Fri Feb 20 10:34:33 2015
@@ -0,0 +1,19 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int g_MyVar = 3;
+static int s_MyVar = 4;
+
+int
+main(int argc, char const *argv[])
+{
+ int a = 10, b = 20;
+ s_MyVar = a + b;
+ return 0; // BP_return
+}
More information about the lldb-commits
mailing list