[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
This commit is contained in:
committed by
Jaroslav Sevcik
parent
9ba5bb4309
commit
5a3556aa55
@@ -0,0 +1,4 @@
|
||||
C_SOURCES := main.c
|
||||
CFLAGS_EXTRAS := -O1
|
||||
|
||||
include Makefile.rules
|
||||
@@ -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")))
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user