xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/unused-inlined-params.test (revision 15983c28aa819031e08a2b3fe49d02c41839b22c)
1# RUN: llvm-mc -filetype=obj %S/Inputs/unused-inlined-params.s \
2# RUN:         -triple x86_64-pc-linux -o %t.o
3# RUN: %lldb %t.o -s %s -o exit | FileCheck %s
4
5
6# In this test we verify that inlined functions still mention
7# all their parameters in `frame variable`, even when those
8# parameters were completely optimized away from the concrete
9# instance of the inlined function in the debug info.
10# The debugger should look up the parameters in the abstract
11# origin of the concrete instance.
12
13# Let us check that unused parameters of an inlined function are listed
14# at the inlined function entry.
15image lookup -v -s break_at_inlined_f_in_main
16# CHECK-LABEL: image lookup -v -s break_at_inlined_f_in_main
17# CHECK: name = "unused1", type = "void *", valid ranges = <block>, location = <empty>
18# CHECK: name = "used", type = "int", valid ranges = <block>, location = [0x0000000000000011, 0x0000000000000014) -> DW_OP_consts +42
19# CHECK: name = "unused2", type = "int", valid ranges = <block>, location = <empty>
20# CHECK: name = "partial", type = "int", valid ranges = <block>, location = [0x0000000000000011, 0x0000000000000019) -> DW_OP_reg4 RSI
21# CHECK: name = "unused3", type = "int", valid ranges = <block>, location = <empty>
22
23# Show variables outsid of the live range of the 'partial' parameter
24# and verify that the output is as expected.
25image lookup -v -s break_at_inlined_f_in_main_between_printfs
26# CHECK-LABEL: image lookup -v -s break_at_inlined_f_in_main_between_printfs
27# CHECK: name = "unused1", type = "void *", valid ranges = <block>, location = <empty>
28# CHECK: name = "used", type = "int", valid ranges = <block>, location = [0x0000000000000014, 0x000000000000001e) -> DW_OP_reg3 RBX
29# CHECK: name = "unused2", type = "int", valid ranges = <block>, location = <empty>
30# Note: image lookup does not show variables outside of their
31#       location, so |partial| is missing here.
32# CHECK-NOT: partial
33# CHECK: name = "unused3", type = "int", valid ranges = <block>, location = <empty>
34
35# Check that we show parameters even if all of them are compiled away.
36image lookup -v -s  break_at_inlined_g_in_main
37# CHECK-LABEL: image lookup -v -s  break_at_inlined_g_in_main
38# CHECK: name = "unused", type = "int", valid ranges = <block>, location = <empty>
39
40# Check that even the other inlined instance of f displays the correct
41# parameters.
42image lookup -v -s  break_at_inlined_f_in_other
43# CHECK-LABEL: image lookup -v -s  break_at_inlined_f_in_other
44# CHECK: name = "unused1", type = "void *", valid ranges = <block>, location = <empty>
45# CHECK: name = "used", type = "int", valid ranges = <block>, location = [0x0000000000000001, 0x000000000000000b) -> DW_OP_consts +1
46# CHECK: name = "unused2", type = "int", valid ranges = <block>, location = <empty>
47# CHECK: name = "partial", type = "int", valid ranges = <block>, location = [0x0000000000000001, 0x0000000000000006) -> DW_OP_consts +2
48# CHECK: name = "unused3", type = "int", valid ranges = <block>, location = <empty>
49