Here is an example script that I've created to investigate a coredump. This automates the investigation by printing some objects from multiple sessions.
To call this script into gdb run the following inside gdb:
source ~/scripts/print_sessions.py
print_sessions Namespace::object