Files
clang-p2996/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
Jaroslav Sevcik 5a3556aa55 [lldb] Add omitted abstract formal parameters in DWARF symbol files
This patch fixes a problem introduced by clang change
https://reviews.llvm.org/D95617 and described by
https://bugs.llvm.org/show_bug.cgi?id=50076#c6, where inlined functions
omit unused parameters both in the stack trace and in `frame var`
command. With this patch, the parameters are listed correctly in the
stack trace and in `frame var` command.

Specifically, we parse formal parameters from the abstract version of
inlined functions and use those formal parameters if they are missing
from the concrete version.

Differential Revision: https://reviews.llvm.org/D110571
2021-10-21 12:33:42 +02:00

23 lines
898 B
Python

"""
Test that unused inlined parameters are displayed.
"""
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestUnusedInlinedParameters(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_unused_inlined_parameters(self):
self.build()
lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
# For the unused parameters, only check the types.
self.assertIn("(void *) unused1 = <no location, value may have been optimized out>",
lldbutil.get_description(self.frame().FindVariable("unused1")))
self.assertEqual(42, self.frame().FindVariable("used").GetValueAsUnsigned())
self.assertIn("(int) unused2 = <no location, value may have been optimized out>",
lldbutil.get_description(self.frame().FindVariable("unused2")))