2012-01-12 23:09:42 +00:00
|
|
|
"""Test breaking inside functions defined within a BSD archive file libfoo.a."""
|
|
|
|
|
2015-10-23 17:04:29 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2015-10-27 20:12:05 +00:00
|
|
|
import use_lldb_suite
|
2015-10-22 20:06:20 +00:00
|
|
|
|
2012-01-12 23:09:42 +00:00
|
|
|
import os, time
|
|
|
|
import lldb
|
2015-11-03 02:06:18 +00:00
|
|
|
from lldbsuite.test.lldbtest import *
|
|
|
|
import lldbsuite.test.lldbutil as lldbutil
|
2012-01-12 23:09:42 +00:00
|
|
|
|
|
|
|
class BSDArchivesTestCase(TestBase):
|
|
|
|
|
2013-12-10 23:19:29 +00:00
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
2012-01-12 23:09:42 +00:00
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
# Call super's setUp().
|
|
|
|
TestBase.setUp(self)
|
|
|
|
# Find the line number in a(int) to break at.
|
|
|
|
self.line = line_number('a.c', '// Set file and line breakpoint inside a().')
|
|
|
|
|
2015-09-30 10:12:40 +00:00
|
|
|
@expectedFailureWindows("llvm.org/pr24527") # Makefile.rules doesn't know how to build static libs on Windows.
|
|
|
|
def test(self):
|
2012-01-12 23:09:42 +00:00
|
|
|
"""Break inside a() and b() defined within libfoo.a."""
|
2015-09-30 10:12:40 +00:00
|
|
|
self.build()
|
|
|
|
|
2012-01-12 23:09:42 +00:00
|
|
|
exe = os.path.join(os.getcwd(), "a.out")
|
|
|
|
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
|
|
|
|
|
|
|
# Break inside a() by file and line first.
|
2012-09-22 00:05:11 +00:00
|
|
|
lldbutil.run_break_set_by_file_and_line (self, "a.c", self.line, num_expected_locations=1, loc_exact=True)
|
|
|
|
|
2015-07-01 23:56:30 +00:00
|
|
|
self.runCmd("run", RUN_SUCCEEDED)
|
2012-01-12 23:09:42 +00:00
|
|
|
|
|
|
|
# The stop reason of the thread should be breakpoint.
|
|
|
|
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
|
|
|
|
substrs = ['stopped',
|
|
|
|
'stop reason = breakpoint'])
|
|
|
|
|
|
|
|
# Break at a(int) first.
|
|
|
|
self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
|
|
|
|
substrs = ['(int) arg = 1'])
|
|
|
|
self.expect("frame variable __a_global", VARIABLES_DISPLAYED_CORRECTLY,
|
|
|
|
substrs = ['(int) __a_global = 1'])
|
|
|
|
|
|
|
|
# Set breakpoint for b() next.
|
2012-09-22 00:05:11 +00:00
|
|
|
lldbutil.run_break_set_by_symbol (self, "b", num_expected_locations=1, sym_exact=True)
|
2012-01-12 23:09:42 +00:00
|
|
|
|
|
|
|
# Continue the program, we should break at b(int) next.
|
|
|
|
self.runCmd("continue")
|
|
|
|
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
|
|
|
|
substrs = ['stopped',
|
|
|
|
'stop reason = breakpoint'])
|
|
|
|
self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
|
|
|
|
substrs = ['(int) arg = 2'])
|
|
|
|
self.expect("frame variable __b_global", VARIABLES_DISPLAYED_CORRECTLY,
|
|
|
|
substrs = ['(int) __b_global = 2'])
|