2015-08-13 22:05:54 +00:00
|
|
|
"""
|
2015-02-20 16:34:33 +00:00
|
|
|
Test lldb-mi -file-xxx commands.
|
2014-11-25 10:41:57 +00:00
|
|
|
"""
|
|
|
|
|
2015-10-23 17:04:29 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2015-11-03 19:20:39 +00:00
|
|
|
|
2015-01-27 18:03:50 +00:00
|
|
|
import lldbmi_testcase
|
2016-02-04 23:04:17 +00:00
|
|
|
from lldbsuite.test.decorators import *
|
2015-11-03 02:06:18 +00:00
|
|
|
from lldbsuite.test.lldbtest import *
|
2016-02-04 23:04:17 +00:00
|
|
|
from lldbsuite.test import lldbutil
|
2014-11-25 10:41:57 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-02-20 16:34:33 +00:00
|
|
|
class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):
|
|
|
|
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
2014-11-25 10:41:57 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
|
|
|
|
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
|
2017-03-04 01:48:43 +00:00
|
|
|
@skipIfRemote # We do not currently support remote debugging via the MI.
|
2015-02-20 16:34:33 +00:00
|
|
|
def test_lldbmi_file_exec_and_symbols_file(self):
|
2014-11-25 10:41:57 +00:00
|
|
|
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols exe."""
|
2015-01-27 18:03:50 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
self.spawnLldbMi(args=None)
|
2015-01-27 18:03:50 +00:00
|
|
|
|
2015-02-20 16:34:33 +00:00
|
|
|
# Test that -file-exec-and-symbols works for filename
|
2015-01-27 18:03:50 +00:00
|
|
|
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
|
|
|
|
self.expect("\^done")
|
|
|
|
|
2015-02-20 16:34:33 +00:00
|
|
|
# Run
|
2015-01-27 18:03:50 +00:00
|
|
|
self.runCmd("-exec-run")
|
|
|
|
self.expect("\^running")
|
|
|
|
self.expect("\*stopped,reason=\"exited-normally\"")
|
2014-11-25 10:41:57 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
|
|
|
|
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
|
2017-03-04 01:48:43 +00:00
|
|
|
@skipIfRemote # We do not currently support remote debugging via the MI.
|
2015-02-20 16:34:33 +00:00
|
|
|
def test_lldbmi_file_exec_and_symbols_absolute_path(self):
|
2014-11-25 10:41:57 +00:00
|
|
|
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols fullpath/exe."""
|
2015-01-27 18:03:50 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
self.spawnLldbMi(args=None)
|
2015-01-27 18:03:50 +00:00
|
|
|
|
2015-02-20 16:34:33 +00:00
|
|
|
# Test that -file-exec-and-symbols works for absolute path
|
2018-01-19 23:24:35 +00:00
|
|
|
self.runCmd("-file-exec-and-symbols \"%s\"" % self.myexe)
|
2015-01-27 18:03:50 +00:00
|
|
|
self.expect("\^done")
|
|
|
|
|
2015-02-20 16:34:33 +00:00
|
|
|
# Run
|
2015-01-27 18:03:50 +00:00
|
|
|
self.runCmd("-exec-run")
|
|
|
|
self.expect("\^running")
|
|
|
|
self.expect("\*stopped,reason=\"exited-normally\"")
|
2014-11-25 10:41:57 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
|
|
|
|
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
|
2017-03-04 01:48:43 +00:00
|
|
|
@skipIfRemote # We do not currently support remote debugging via the MI.
|
2015-02-20 16:34:33 +00:00
|
|
|
def test_lldbmi_file_exec_and_symbols_relative_path(self):
|
2014-11-25 10:41:57 +00:00
|
|
|
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols relpath/exe."""
|
2015-01-27 18:03:50 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
self.spawnLldbMi(args=None)
|
2015-01-27 18:03:50 +00:00
|
|
|
|
2015-02-20 16:34:33 +00:00
|
|
|
# Test that -file-exec-and-symbols works for relative path
|
2018-01-19 23:24:35 +00:00
|
|
|
import os
|
|
|
|
path = os.path.relpath(self.myexe)
|
2015-02-20 16:34:33 +00:00
|
|
|
self.runCmd("-file-exec-and-symbols %s" % path)
|
2015-01-27 18:03:50 +00:00
|
|
|
self.expect("\^done")
|
|
|
|
|
2015-02-20 16:34:33 +00:00
|
|
|
# Run
|
2015-01-27 18:03:50 +00:00
|
|
|
self.runCmd("-exec-run")
|
|
|
|
self.expect("\^running")
|
|
|
|
self.expect("\*stopped,reason=\"exited-normally\"")
|
2014-11-25 10:41:57 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
|
|
|
|
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
|
2017-03-04 01:48:43 +00:00
|
|
|
@skipIfRemote # We do not currently support remote debugging via the MI.
|
2015-02-20 16:34:33 +00:00
|
|
|
def test_lldbmi_file_exec_and_symbols_unknown_path(self):
|
2014-11-25 10:41:57 +00:00
|
|
|
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols badpath/exe."""
|
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
self.spawnLldbMi(args=None)
|
2015-01-27 18:03:50 +00:00
|
|
|
|
2015-02-20 16:34:33 +00:00
|
|
|
# Test that -file-exec-and-symbols fails on unknown path
|
|
|
|
path = "unknown_dir/%s" % self.myexe
|
|
|
|
self.runCmd("-file-exec-and-symbols %s" % path)
|
2015-01-27 18:03:50 +00:00
|
|
|
self.expect("\^error")
|