public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* Why I cannot see content of std::vector in the gdb?
@ 2021-10-06  2:17 unlvsur unlvsur
  2021-10-06  8:56 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: unlvsur unlvsur @ 2021-10-06  2:17 UTC (permalink / raw)
  To: unlvsur unlvsur via Libstdc++

c++ - Inspecting standard container (std::map) contents with gdb - Stack Overflow<https://stackoverflow.com/questions/427589/inspecting-standard-container-stdmap-contents-with-gdb>

I just saw your (jwakely) answer that libstdc++ supports pretty printer for gdb. But it does not work? Any configs I missed here?

g++ -o a a.cc -g -std=c++20 -I../fast_io/include

gdb ./a
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a...
(gdb) dir
Reinitialize source path to empty? (y or n) n
(gdb) l
1       #include<vector>
2       #include<fast_io.h>
3
4       int main()
5       {
6               std::vector<int> vec{2,4,6,1,204,6,5};
7               for(auto const& e : vec)
8                       println(e);
9       }
(gdb) break 7
Breakpoint 1 at 0x40129e: file a.cc, line 7.
(gdb) r
Starting program: /home/cqwrteur/fast_io_cleanup/temp/a

Breakpoint 1, main () at a.cc:7
7               for(auto const& e : vec)
(gdb) print vec
$1 = {<std::_Vector_base<int, std::allocator<int> >> = {
    _M_impl = {<std::allocator<int>> = {<__gnu_cxx::new_allocator<int>> = {<No data fields>}, <No data fields>}, <std::_Vector_base<int, std::allocator<int> >::_Vector_impl_data> = {_M_start = 0x4072a0, _M_finish = 0x4072bc,
        _M_end_of_storage = 0x4072bc}, <No data fields>}}, <No data fields>}
(gdb)

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-06  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06  2:17 Why I cannot see content of std::vector in the gdb? unlvsur unlvsur
2021-10-06  8:56 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).