{{lastupdated_at}} by {{lastupdated_by}} h1. How to use gdb? h2. Running an executable
gdb --args ctlike inobs=file.fits ...
h2. Getting the backtrace
(gdb) where
(gdb) bt
(gdb) bt full
h2. Setting break points
(gdb) break ctobservation.cpp:129
h2. Continuing after a break
(gdb) s (or step)      # Step to next source line
(gdb) n (or next)      # Step to next source line in the current file
h2. Inspecting variables
(gdb) p obs
(gdb) p obs.m_models
(gdb) p obs.m_models.m_models
(gdb) p **(obs.m_models.m_models._M_impl._M_start)@1    # Print one element of vector
(gdb) p **(obs.m_models.m_models._M_impl._M_start+1)    # Print 2nd element of vector
h2. Using a core dump
$ ulimit -c unlimited
$ ssh root@dirac (or whatever machine)
# sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t
kernel.core_pattern = /tmp/core-%e.%p.%h.%t
# exit
$ gdb -c /tmp/core-gsrvy.8920.dirac.1596483045 (or whatever the filename of the core dump)
(gdb) symbol-file /home/knodlseder/install/bin/gsrvy (or whatever path to the binary)
(gdb) sharedlibrary
(gdb) where