diff options
author | Ilia K <ki.stfu@gmail.com> | 2015-02-20 13:07:41 +0000 |
---|---|---|
committer | Ilia K <ki.stfu@gmail.com> | 2015-02-20 13:07:41 +0000 |
commit | c12d88dc8f129e0cf18119c9ba6391e9a82681cc (patch) | |
tree | 7aa7b5ac17f93e40d153c95fca1d287c8acc59d0 /lldb/test/tools/lldb-mi/TestMiSymbol.py | |
parent | 7329636d1baa550c3880e7ad7f3d1fde40a351a1 (diff) | |
download | bcm5719-llvm-c12d88dc8f129e0cf18119c9ba6391e9a82681cc.tar.gz bcm5719-llvm-c12d88dc8f129e0cf18119c9ba6391e9a82681cc.zip |
Add -symbol-list-lines command (MI)
Summary:
Add -symbol-list-lines command + test.
All test passed on OS X.
Reviewers: emaste, abidh, clayborg
Reviewed By: clayborg
Subscribers: lldb-commits, clayborg, abidh, emaste
Differential Revision: http://reviews.llvm.org/D7768
llvm-svn: 230008
Diffstat (limited to 'lldb/test/tools/lldb-mi/TestMiSymbol.py')
-rw-r--r-- | lldb/test/tools/lldb-mi/TestMiSymbol.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lldb/test/tools/lldb-mi/TestMiSymbol.py b/lldb/test/tools/lldb-mi/TestMiSymbol.py new file mode 100644 index 00000000000..7bcea4cf678 --- /dev/null +++ b/lldb/test/tools/lldb-mi/TestMiSymbol.py @@ -0,0 +1,60 @@ +""" +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() |