<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/122028>122028</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLDB] List structured bindings as frame variables
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Skynet0
</td>
</tr>
</table>
<pre>
In reference to the C++17 feature <https://en.cppreference.com/w/cpp/language/structured_binding>.
I've searched quite a bit, but haven't found a thread discussing this on Discourse or GitHub.
I have the following program:
```c++
#include <map>
int main() {
std::map<int, int> m = {{0, 1}, {2, 3}};
int t = 0;
for (const auto& [k, v] : m) {
t += v;
}
}
```
Running LLDB:
```
$ lldb ./a.out
(lldb) target create "./a.out"
Current executable set to '/Users/skynet/devel/tmp/a.out' (arm64).
(lldb) b 7
Breakpoint 1: where = a.out`main + 264 at sb2.cpp:7:10, address = 0x0000000100001340
(lldb) r
Process 88718 launched: '/Users/skynet/devel/tmp/a.out' (arm64)
Process 88718 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100001340 a.out`main at sb2.cpp:7:10
4 std::map<int, int> m = {{0, 1}, {2, 3}};
5 int t = 0;
6 for (const auto& [k, v] : m) {
-> 7 t += v;
8 }
9 }
Target 0: (a.out) stopped.
(lldb) fr v
(std::map<int, int>) m = size=2 {
[0] = (first = 0, second = 1)
[1] = (first = 2, second = 3)
}
(int) t = 0
(lldb) fr v k
(const int &) 0x000000015370456c (&k = 0)
(lldb) fr v v
(const int &) 0x0000000153704570 (&v = 1)
```
Inside the loop, I'd expect to see `k` and `v` as `int&`. Instead, I need to manually evaluate them, also in the frame.
Developing on an M2 Macbook Pro.
Compiler:
```
Homebrew clang version 19.1.6
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/19.1.6/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin23.cfg
```
LLDB: `lldb version 19.1.6`
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVluPo7gS_jXOS6mRMQHCQx5ymZxpaUYanTPneWWgknhjbMY26Z799auySd93tbtaFAUw5a-qvrpZeq9OBnHNyi0r9ws5hbN16_9dfhoMfNHa_uf63oDDIzo0HUKwEM4IOya2TGzzGo4ow-QQWLE7hzB6VmyYODBxQJN14_i0M-vswMThgYlDN45MHLQ0p0mekImDD27qCKX_pVWmV-bEik8Z4xvGN_dM1FcEj9J1Z-zhx6QCgoRWBSZ20E4BzvKKhok6wNFOpgcJ4exQ9tAr303eK3OCcFYerIG98p2dnEewDv6jwuepvSmKONG7o9XaPtC20dmTkwM5FYVYxdOvSwTQkiiU6fTURw4GObLiUxJWJsAglWFixUQDrCZxAB96wis2UXanTHSEbsUnGIAV-yhabzmt56ze053VW0H3gt7rPSsSGOkIcQ-_LR2tAyZWnTU-gJyCZaICVm4vtP3Kyj2wYgPDS5OAMMSWYK43GFLCN_P_ze3k2H8nY4idL1_22_fURE6WoHXfQsbEQWZ2CnFxRWukN0h3wgCdQxkQmBDPckIwvtlNzqEJgI_YTUG2mhIgUPIxUTNx-L9H5ylxYp4ycejxipqJQxjGZ6SaaJBuqJZMNNlrC1qoGd9sHcrLaInEnEh5OGNM5T0kiIpT_IgaENUSZADfCkprVmxqVmzyGCLZ9w69T1F45OnK41-x5K_1OsY335ztSH61qvMVaDkZymzS_4-9e4fqgx1H7KPyza0emChyMvjHhFNyk4m6s0Mmx1FjRr7eJdFoyC6igEPprYni7Qu-snxOnaOTAwWx4OTCewJec_kRhxFnCfH6V6sDygT6QZVAlT797Wq5I0NqmK_3dQOr9CVVDgA0z2_fU97zFOvVHMnmFq03OXp0cE0rf0YKSSZevPoNWbEXT2XNyi1PHlCkV0fl_I0FCi521vTxPU8pFHfkH-4Qb3YUacfcHsQqmtQ8kfzOD7iktcQzxYOJij4-50tZ1HxZVh3EflldbpY2H6Bd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