You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using GDB's MI mode and enabling pretty-printing, container contents aren't displayed for the following container types when they contain two or more elements:
std::list
std::deque
std::set
std::unordered_set
std::map
std::unordered_map
This issue affects IDEs such as VSCode's C++ extension that use GDB's MI mode. The issue doesn't occur when using GDB in normal mode.
The issue seems to be caused by duplicate keys in printers.py. For example, for std::deque, the key is always an empty string in the following line: https://github.com/llvm/llvm-project/blob/main/libcxx/utils/gdb/libcxx/printers.py#L479
(Note that in printers.py for libstdc++, sequential numbers with square brackets [0], [1], [2], etc. are used as keys.)
GDB/MI requires unique names for each child, otherwise fails with "Duplicate variable object name".
Additionally wrapped containers printers were flattened for cleaner visualization in IDEs and CLI.
Fixesllvm#62340
AngryLoki
added a commit
to AngryLoki/llvm-project
that referenced
this issue
Dec 23, 2024
GDB/MI requires unique names for each child, otherwise fails with "Duplicate variable object name".
Additionally wrapped containers printers were flattened for cleaner visualization in IDEs and CLI.
Fixesllvm#62340
AngryLoki
added a commit
to AngryLoki/llvm-project
that referenced
this issue
Dec 23, 2024
GDB/MI requires unique names for each child, otherwise fails with "Duplicate variable object name".
Additionally wrapped containers printers were flattened for cleaner visualization in IDEs and CLI.
Fixesllvm#62340
I'm reporting an issue with
printers.py
at https://github.com/llvm/llvm-project/blob/main/libcxx/utils/gdb/libcxx/printers.py.When using GDB's MI mode and enabling pretty-printing, container contents aren't displayed for the following container types when they contain two or more elements:
std::list
std::deque
std::set
std::unordered_set
std::map
std::unordered_map
This issue affects IDEs such as VSCode's C++ extension that use GDB's MI mode. The issue doesn't occur when using GDB in normal mode.
The issue seems to be caused by duplicate keys in
printers.py
. For example, forstd::deque
, the key is always an empty string in the following line:https://github.com/llvm/llvm-project/blob/main/libcxx/utils/gdb/libcxx/printers.py#L479
(Note that in
printers.py
for libstdc++, sequential numbers with square brackets[0]
,[1]
,[2]
, etc. are used as keys.)According to GDB's documentation (https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing-API.html), duplicate children keys aren't explicitly forbidden, but in MI mode, they don't seem to work as expected.
Here are the steps to reproduce:
The expected result should be a list of children. However, the following error is returned instead:
Additionally, here is a screenshot of the issue in VSCode. The contents of the std::list is not visible:
Thank you.
The text was updated successfully, but these errors were encountered: