Skip to contentSkip to conversation

How to enable libstdc++ Pretty Printers in GDB #poky

DISCUSSION Rahul Chauhan 2 participants 5 messages Jan 29, 2024 – Jan 31, 2024

lore
Share & tools
lore
#0 lore raw

Hi Team,

Can any one please help me  to enable libstdc++ Pretty Printers in GDB .

As of now i am only seeing below pretty printer enable. (gdb) info pretty-printer
global pretty-printers:
builtin
mpx_bound128

I tried
IMAGE_INSTALL:append = " libstdc++" but unfortunately no luck.

Thanks
Rahul Chauhan

#1 lore raw
Quoted 9 lines · Rahul Chauhan

Hi Team,

Can any one please help me to enable libstdc++ Pretty Printers in GDB .

As of now i am only seeing below pretty printer enable. (gdb) info pretty-printer
global pretty-printers:
builtin

Quoted 5 lines
    mpx_bound128

I tried

IMAGE_INSTALL:append = " libstdc++"

yeah libstdc++ pretty printing is provided via printer.py which is part of gcc-runtime-dbg package so try
adding IMAGE_INSTALL:append = " gcc-runtime-dbg" and see if if it helps. You will also need to add

set auto-load safe-path /

temporarily, or apply a backport of this fix [1] to your core layer

[1] https://lore.kernel.org/openembedded-core/[email protected]/T/#u

Quoted 14 lines

but unfortunately no luck.

Thanks
Rahul Chauhan
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194460): https://lists.openembedded.org/g/openembedded-core/message/194460
Mute This Topic: https://lists.openembedded.org/mt/104030581/1997914
Mute #poky:https://lists.openembedded.org/g/openembedded-core/mutehashtag/poky Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Khem Raj,

Thankyou very much for quick solution.

I backported patch and added below line in local.conf and its working fine. IMAGE_INSTALL:append = " gcc-runtime-dbg"

but but when i am checking *info pretty-printer* i am not seeing libstdc++-v6 in the list (gdb) info pretty-printer
global pretty-printers:
builtin
mpx_bound128

But I was expecting
(gdb) info pretty-printer
global pretty-printers:
builtin
mpx_bound128
libstdc++-v6

Can you please comment on this?

#3 lore raw
Quoted 14 lines · Rahul Chauhan

Hi Khem Raj,

Thankyou very much for quick solution.

I backported patch and added below line in local.conf and its working fine. IMAGE_INSTALL:append = " gcc-runtime-dbg"

but but when i am checking info pretty-printer i am not seeing libstdc++-v6 in the list (gdb) info pretty-printer
global pretty-printers:
builtin
mpx_bound128

Quoted 8 lines

But I was expecting
(gdb) info pretty-printer
global pretty-printers:
builtin
mpx_bound128
libstdc++-v6

Can you please comment on this?

It is loaded on demand. So put a breakpoint on main and let it run till main so that
it loads the libstdc++ library and then check again.

Quoted 11 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194509): https://lists.openembedded.org/g/openembedded-core/message/194509
Mute This Topic: https://lists.openembedded.org/mt/104030581/1997914
Mute #poky:https://lists.openembedded.org/g/openembedded-core/mutehashtag/poky Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
In reply to Rahul Chauhan

Hi Khem Raj,

I noti ced that whe n I chec k th e in fo p rett y-pr inte r co mman d ou tput aft er l oadi ng t he t est appl icat ion with gdb , it is show ing the expe cted beh avio r. T his mean s th at e very thin g se ems to b e fu ncti onin g co rrec tly in t hat aspe ct.

Thanks for your support.

bash-5.1# gdb -q test
Reading symbols from test...
(gdb) b 12
Breakpoint 1 at 0x234e: file test.cpp, line 12.
(gdb) r
Starting program: /test
warning: Error disabling address space randomization: Operation not permitted [Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Breakpoint 1, main () at test.cpp:12
12          return 0;
(gdb) p s
$1 = "test"
(gdb) p vi
$2 = std::vector of length 3, capacity 4 = {1, 2, 3} (gdb) info pretty-printer
global pretty-printers:
builtin
mpx_bound128
objfile /lib/libstdc++.so.6 pretty-printers:
libstdc++-v6
__gnu_cxx::_Slist_iterator __gnu_cxx::__8::_Slist_iterator __gnu_cxx::__8::__normal_iterator __gnu_cxx::__8::slist __gnu_cxx::__normal_iterator __gnu_cxx::slist
__gnu_debug::_Safe_iterator std::_Bit_const_iterator
std::_Bit_iterator
std::_Bit_reference std::_Deque_const_iterator std::_Deque_iterator std::_Fwd_list_const_iterator std::_Fwd_list_iterator std::_List_const_iterator std::_List_iterator
std::_Node_handle std::_Rb_tree_const_iterator std::_Rb_tree_iterator std::__8::_Bit_const_iterator std::__8::_Bit_iterator std::__8::_Bit_reference std::__8::_Deque_const_iterator std::__8::_Deque_iterator std::__8::_Fwd_list_const_iterator std::__8::_Fwd_list_iterator std::__8::_List_const_iterator std::__8::_List_iterator std::__8::_Node_handle std::__8::_Rb_tree_const_iterator std::__8::_Rb_tree_iterator std::__8::__cxx11::__cxx1998::list std::__8::__cxx11::basic_string std::__8::__cxx11::list std::__8::__cxx1998::_Bit_const_iterator std::__8::__cxx1998::_Bit_iterator std::__8::__cxx1998::_Bit_reference std::__8::__cxx1998::_Deque_const_iterator std::__8::__cxx1998::_Deque_iterator std::__8::__cxx1998::_Fwd_list_const_iterator std::__8::__cxx1998::_Fwd_list_iterator std::__8::__cxx1998::_List_const_iterator std::__8::__cxx1998::_List_iterator std::__8::__cxx1998::bitset std::__8::__cxx1998::deque std::__8::__cxx1998::forward_list