Updated over 4 years ago by Knödlseder Jürgen
How to use gdb?¶
Running an executable¶
gdb --args ctlike inobs=file.fits ...
Getting the backtrace¶
(gdb) where (gdb) bt (gdb) bt full
Setting break points¶
(gdb) break ctobservation.cpp:129
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
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
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