2013-04-30 22:05:15 +00:00
|
|
|
"""
|
|
|
|
|
Tests calling a function by basename
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import lldb
|
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
|
2013-04-30 22:05:15 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2013-04-30 22:05:15 +00:00
|
|
|
class CallCPPFunctionTestCase(TestBase):
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2013-12-10 23:19:29 +00:00
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2013-04-30 22:05:15 +00:00
|
|
|
def setUp(self):
|
|
|
|
|
TestBase.setUp(self)
|
|
|
|
|
self.line = line_number('main.cpp', '// breakpoint')
|
2016-09-06 20:57:50 +00:00
|
|
|
|
|
|
|
|
@expectedFailureAll(
|
|
|
|
|
oslist=["windows"],
|
|
|
|
|
bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
|
2015-09-30 10:12:40 +00:00
|
|
|
def test_with_run_command(self):
|
2013-04-30 22:05:15 +00:00
|
|
|
"""Test calling a function by basename"""
|
2015-09-30 10:12:40 +00:00
|
|
|
self.build()
|
2018-01-19 23:24:35 +00:00
|
|
|
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
|
2013-04-30 22:05:15 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
lldbutil.run_break_set_by_file_and_line(
|
|
|
|
|
self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
|
2013-04-30 22:05:15 +00:00
|
|
|
|
2015-07-01 23:56:30 +00:00
|
|
|
self.runCmd("process launch", RUN_SUCCEEDED)
|
2013-04-30 22:05:15 +00:00
|
|
|
|
|
|
|
|
# The stop reason of the thread should be breakpoint.
|
|
|
|
|
self.expect("thread list",
|
|
|
|
|
STOPPED_DUE_TO_BREAKPOINT,
|
2016-09-06 20:57:50 +00:00
|
|
|
substrs=['stopped', 'stop reason = breakpoint'])
|
2013-04-30 22:05:15 +00:00
|
|
|
|
|
|
|
|
self.expect("expression -- a_function_to_call()",
|
2016-09-06 20:57:50 +00:00
|
|
|
startstr="(int) $0 = 0")
|