<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60841>60841</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLDB reports empty `std::vector` when reproducer is compiled with `-D_GLIBCXX_DEBUG`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lldb,
libstdc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tbaederr
</td>
</tr>
</table>
<pre>
Using this code:
```c++
#include <cassert>
#include <vector>
int main() {
std::vector<int> V;
V.push_back(12);
assert(false);
return 0;
}
```
shows the correct vector size in lldb when compiled with `clang++ ./vec.cpp -g -std=c++20`:
```console
~ » lldb ./a.out -o run -o ' up 5' -o 'p V' -o q
(lldb) target create "./a.out"
Current executable set to '/home/tbaeder/a.out' (x86_64).
(lldb) run
a.out: ./vec.cpp:7: int main(): Assertion `false' failed.
Process 1492018 stopped
* thread #1, name = 'a.out', stop reason = signal SIGABRT
frame #0: 0x00007ffff788ebec libc.so.6`__pthread_kill_implementation + 284
libc.so.6`__pthread_kill_implementation:
-> 0x7ffff788ebec <+284>: movl %eax, %ebp
0x7ffff788ebee <+286>: negl %ebp
0x7ffff788ebf0 <+288>: cmpl $0xfffff000, %eax ; imm = 0xFFFFF000
0x7ffff788ebf5 <+293>: movl $0x0, %eax
Process 1492018 launched: '/home/tbaeder/a.out' (x86_64)
(lldb) up 5
frame #5: 0x000000000040122d a.out`main at vec.cpp:7:3
4 int main() {
5 std::vector<int> V;
6 V.push_back(12);
-> 7 assert(false);
8 return 0;
9 }
(lldb) p V
(std::vector<int, std::allocator<int> >) $0 = size=1 {
[0] = 12
}
(lldb) q
```
But when compiled with `clang++ ./vec.cpp -g -std=c++20 -D_GLIBCXX_DEBUG`:
```console
~ » lldb ./a.out -o run -o ' up 5' -o 'p V' -o q
(lldb) target create "./a.out"
Current executable set to '/home/tbaeder/a.out' (x86_64).
(lldb) run
a.out: ./vec.cpp:7: int main(): Assertion `false' failed.
Process 1492120 stopped
* thread #1, name = 'a.out', stop reason = signal SIGABRT
frame #0: 0x00007ffff788ebec libc.so.6`__pthread_kill_implementation + 284
libc.so.6`__pthread_kill_implementation:
-> 0x7ffff788ebec <+284>: movl %eax, %ebp
0x7ffff788ebee <+286>: negl %ebp
0x7ffff788ebf0 <+288>: cmpl $0xfffff000, %eax ; imm = 0xFFFFF000
0x7ffff788ebf5 <+293>: movl $0x0, %eax
Process 1492120 launched: '/home/tbaeder/a.out' (x86_64)
(lldb) up 5
frame #5: 0x00000000004012bd a.out`main at vec.cpp:7:3
4 int main() {
5 std::vector<int> V;
6 V.push_back(12);
-> 7 assert(false);
8 return 0;
9 }
(lldb) p V
(std::vector<int, std::allocator<int> >) $0 = size=0 {}
(lldb) q
```
... the size is reported as 0, which is clearly wrong.
Using lldb 15.0.7.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsV8mO2zgTfhr6UrBAkVoPPniJgwA5_PhnEuRmUFTZ0oQSFZLqdnKYZx9Qi-3udoIEs5xaMFqt2qv48ZMorK1PLeKKxBsS7xaid5U2K1cILNGYRaHLr6sPtm5P4KragtQlEr4mdEfomiR0_EnCNv43ShmvW6n6EoHwrRTWonGEv7mnfUDptLkqh79166ARdUtYRlgOJJ0CA1hX-uR8Pftt69aHho-EX4w-Bl1vq0Mh5GfCspARlt9op3JYdhTK4lOdQdebFuhFRNLds05v67SVfrTgKgSpjUHpYCwLbP0NoW5BqbKAxwpbkLrpaoUlPNauAj8xJdrTODUICNs_oAxk18HyBMuhy900UzZkfTlx3VqtcJT-CWTLyGYzJvThRKB7B0sNpm_9jbAU-g5ifx8fO_g4PXyZFybz7n7iTpgTOpAGhUMgjF1CEsZG621vDLYO8Iyyd6JQCBYduCE2YftKN0jYfsLR1T0FwrJzlhySiLA8eJHa9O0oG-35-nY6hK9TL3oKEC9ZD6ta69bPdlrZFI7Cz3xK8j-jJVoLYZQzGmZgne46LOcK1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