From: unlvsur unlvsur <unlvsur@live.com>
To: unlvsur unlvsur via Libstdc++ <libstdc++@gcc.gnu.org>
Subject: Why I cannot see content of std::vector in the gdb?
Date: Wed, 6 Oct 2021 02:17:52 +0000 [thread overview]
Message-ID: <DM6PR05MB469710F9CF22D67DE99269A7D6B09@DM6PR05MB4697.namprd05.prod.outlook.com> (raw)
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
next reply other threads:[~2021-10-06 2:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 2:17 unlvsur unlvsur [this message]
2021-10-06 8:56 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR05MB469710F9CF22D67DE99269A7D6B09@DM6PR05MB4697.namprd05.prod.outlook.com \
--to=unlvsur@live.com \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).