Issue |
122028
|
Summary |
[LLDB] List structured bindings as frame variables
|
Labels |
new issue
|
Assignees |
|
Reporter |
Skynet0
|
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`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs