Files
clang-p2996/lldb/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py
Pavel Labath be05633e28 [lldb] Clean up accidentally passing TestDeadStrip.py
This test was accidentally passing on non-darwin OS because it was
explicitly setting the CFLAGS make variable. This meant that (in the
default config) it was building with absolutely no debug info, and so
setting a breakpoint on a stripped symbol failed, because there was
really no trace of it remaining. In other configurations, we were
generating the debug info (-gsplit-dwarf implies -g) and the test failed
because we did not treat the zeroed out debug info address specially.
The test was also xfailed in pretty much every non-standard
configuration.

This patch fixes the makefile to avoid messing with CFLAGS (use
CFLAGS_EXTRAS instead). This causes it to fail in all configurations
(except darwin), and so I replace the various decorators with a simple
os!=darwin check.
2019-12-09 19:01:52 +01:00

61 lines
2.1 KiB
Python

"""
Test that breakpoint works correctly in the presence of dead-code stripping.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class DeadStripTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=no_match(lldbplatformutil.getDarwinOSTriples()),
bugnumber="llvm.org/pr24778 llvm.org/pr25087 llvm.org/pr27865")
def test(self):
"""Test breakpoint works correctly with dead-code stripping."""
self.build()
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name f1 (live code).
lldbutil.run_break_set_by_symbol(
self, "f1", num_expected_locations=1, module_name="a.out")
# Break by function name f2 (dead code).
lldbutil.run_break_set_by_symbol(
self, "f2", num_expected_locations=0, module_name="a.out")
# Break by function name f3 (live code).
lldbutil.run_break_set_by_symbol(
self, "f3", num_expected_locations=1, module_name="a.out")
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint (breakpoint #1).
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs=['stopped',
'a.out`f1',
'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f 1", BREAKPOINT_HIT_ONCE,
substrs=[' resolved, hit count = 1'])
self.runCmd("continue")
# The stop reason of the thread should be breakpoint (breakpoint #3).
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs=['stopped',
'a.out`f3',
'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f 3", BREAKPOINT_HIT_ONCE,
substrs=[' resolved, hit count = 1'])