環境
Ubuntu/Linux on WSL/Windows11。
G++はAPT、GDBはbrewでインストールしている(何故かパッケージマネージャーが別)😰😰😰。
G++ GDBのバージョン。
❯ g++ --version; which g++ g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. /usr/bin/g++ ❯ gdb --version; which gdb GNU gdb (GDB) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. /home/linuxbrew/.linuxbrew/bin/gdb
変数の中身
デバッグでVectorの中身を表示してみたが、読みやすく表示されなかった。
こんな感じ。
std::_Vector_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
pretty-printing
変数の中身を表示する機能だが、これはGDBのpretty-printingという機能らしい。 これが正しく動いてなさそう。
解消
GDBをbrewでアンインストールして、APTでインストールすると治った。
また、launch.json
のmiDebuggerPath
でAPTのGDBをフルパスで指定すると治った。
まあパスがわからなかったのかと思う。