diff options
| author | Jaroslav Sevcik <jarin@chromium.org> | 2021-09-25 19:29:04 +0200 |
|---|---|---|
| committer | Jaroslav Sevcik <jarin@google.com> | 2021-10-21 12:33:42 +0200 |
| commit | 5a3556aa5563fb89693935303463881df44094de (patch) | |
| tree | be8a0f744a370a5ea7b488eb1dfa07203a749374 /lldb/test/API | |
| parent | 9ba5bb43099db70031e0df6a438e7cb56fb05540 (diff) | |
[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
Diffstat (limited to 'lldb/test/API')
3 files changed, 38 insertions, 0 deletions
diff --git a/lldb/test/API/functionalities/unused-inlined-parameters/Makefile b/lldb/test/API/functionalities/unused-inlined-parameters/Makefile new file mode 100644 index 000000000000..0b283dea0b8c --- /dev/null +++ b/lldb/test/API/functionalities/unused-inlined-parameters/Makefile @@ -0,0 +1,4 @@ +C_SOURCES := main.c +CFLAGS_EXTRAS := -O1 + +include Makefile.rules diff --git a/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py b/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py new file mode 100644 index 000000000000..593773a60069 --- /dev/null +++ b/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py @@ -0,0 +1,22 @@ +""" +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"))) diff --git a/lldb/test/API/functionalities/unused-inlined-parameters/main.c b/lldb/test/API/functionalities/unused-inlined-parameters/main.c new file mode 100644 index 000000000000..f2ef5dcc213d --- /dev/null +++ b/lldb/test/API/functionalities/unused-inlined-parameters/main.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +__attribute__((optnone)) __attribute__((nodebug)) void use(int used) {} + +__attribute__((always_inline)) void f(void *unused1, int used, int unused2) { + use(used); // break here +} + +int main(int argc, char **argv) { + f(argv, 42, 1); + return 0; +}
\ No newline at end of file |
