Some things were taken from this post, be sure to check it out.
Prepare pretty printers for GDB
The first thing you should always do is to get the pretty printers and use them to print the variables in gdb. To do this you will need to find the install path of thec gcc that was used to build the executable that has generated a coredump, and inside that path there should be some pretty printers. Usually, this path can be found here(on ubuntu):
In my case it was in
/opt/gcc/9.2.0/share/gcc-9.2.0/python/, because the gcc that I was using was built from sources.
That folder contains a folder called:
libstdcxx which contains some python scripts that are used to print the variables nicer.
If you are investigating a coredump on a different server, you can copy that folder to the server using scp:
scp -r /usr/share/gcc-10/python/ [email protected]:/path/to/server/.
Activate the pretty printers from the gdb config file
Pretty printers, added this in
from libstdcxx.v6.printers import register_libstdcxx_printers
# Will print the whoile object
set pagination off
set print array on
# It will format the output
set print pretty on