How does GDB pretty print this container?
const unordered_map<string, int> map{{"hello", 1}, {"world", 2}};
(gdb) p map
$1 = std::unordered_map with 2 elements = {["world"] = 2, ["hello"] = 1}
How can I get this functionality for my custom container?
How does GDB pretty print this container?
By using pretty-printers .
The pretty-printers for libstdc++
std::vector
, std::unordred_map
etc. are part of and shipped with libstdc++
.
I see the pretty printers are located in the stl objfile
No, they are not. A filename pointing to them is in the object file, but not the pretty-printers themselves.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.