https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93024
Bug ID: 93024 Summary: Python Pretty Printers get disabled on executable reload by GDB Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at mailinator dot com Target Milestone: --- Version: ``` $ gcc --version gcc (GCC) 9.2.0 Copyright (C) 2019 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. $ gdb --version GNU gdb (GDB) 8.3.1 Copyright (C) 2019 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. ``` Description: When the executable changes, `run` will automatically reload the symbol, but the pretty printer are not reloaded. GDB session: ``` $ cat <<'eof' >a.cpp > #include <iostream> > #include <vector> > int main() { > std::vector<int> a{1}; > std::cout<<""; > } > eof $ g++ -g a.cpp -o a $ gdb -q a Reading symbols from a... (gdb) b 5 Breakpoint 1 at 0x1236: file a.cpp, line 5. (gdb) r Starting program: /tmp/a Breakpoint 1, main () at a.cpp:5 5 std::cout<<""; (gdb) p a $1 = std::vector of length 1, capacity 1 = {1} (gdb) [1]+ Stopped gdb -q a (failed reverse-i-search)`g+++': ^C+ -g a.cpp -o a $ g++ -g a.cpp -o a $ fg %1 (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y `/tmp/a' has changed; re-reading symbols. Starting program: /tmp/a Breakpoint 1, main () at a.cpp:5 5 std::cout<<""; (gdb) p a $3 = {<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 = 0x55555556aeb0, _M_finish = 0x55555556aeb4, _M_end_of_storage = 0x55555556aeb4}, <No data fields>}}, <No data fields>} ``` You can see that the last `p a` command doesn't use the pretty printer. -------------- Currently, `file a` will work (if used for each recompilation), and `py register_libstdcxx_printers(None)` will work (only need to call once regardless of the number of recompilation)