Issue 152282
Summary [DebugInfo] Unexpanded parameter pack variables have misleading debug-info
Labels lldb, debuginfo
Assignees
Reporter Michael137
    Was looking at what the debug-info looks like for https://github.com/llvm/llvm-project/pull/121417.

Take this modified example from p1061r10:
```
struct C { int x = 1, y = 2, z = 3; };

template <class T>
void now_i_know_my() {
  auto [a, b, c] = C();
 auto [d, ...e] = C();
  auto [...f, g] = C();
  auto [h, i, j, ...k] = C();
  __builtin_debugtrap();
}

int main() {
 now_i_know_my<int>();
    return 0;
}
```

```
clang++ pack.cpp -g
```

Then in LLDB:
```
$ lldb a.out -o run -o v
(lldb) v
(int) a = 1
(int) b = 2
(int) c = 3
(int) d = 1
(int) e = 2
(int) f = 1
(int) g = 3
(int) h = 1
(int) i = 2
(int) j = 3
```

Note how the unexpanded parameter packs (e.g., `e`, `f`) are represented are showing as `int`s instead of packs.

Here's a dwarfdump snippet
```
0x00000058: DW_TAG_variable
                  DW_AT_location        (DW_OP_fbreg -16, DW_OP_plus_uconst 0x8)
                  DW_AT_name    ("c")
 DW_AT_type    (0x00000000000000e7 "int")

0x00000065: DW_TAG_variable
                  DW_AT_location        (DW_OP_breg31 WSP+32)
                  DW_AT_name    ("d")
 DW_AT_type    (0x00000000000000e7 "int")

0x00000070: DW_TAG_variable
                  DW_AT_location        (DW_OP_breg31 WSP+32, DW_OP_plus_uconst 0x4)
                  DW_AT_name    ("e")
 DW_AT_type    (0x00000000000000e7 "int")
```

Symptoms look similar to what happens with template parameter packs https://github.com/llvm/llvm-project/issues/24643
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to