- Infos im HLRS Wiki sind nicht rechtsverbindlich und ohne Gewähr -
- Information contained in the HLRS Wiki is not legally binding and HLRS is not responsible for any damages that might result from its use -

GDB: Difference between revisions

From HLRS Platforms
Jump to navigationJump to search
 
Line 32: Line 32:
To get a backtrace of a crashing program start it via gdb as follows:
To get a backtrace of a crashing program start it via gdb as follows:
{{Command|command=mpirun -n 2 gdb -batch -ex "run" -ex "bt" <program>}}
{{Command|command=mpirun -n 2 gdb -batch -ex "run" -ex "bt" <program>}}
{{Note|text=To get the rank of the crashing process for Open MPI the '--tag-output' option can be used.}}
{{Note|text=To get the rank of the crashing process for Open MPI the <tt>--tag-output<tt> option can be used.}}
 
=== HAWK/MPT special ===
To use gdb with [[MPT]] on HAWK one has to run with <tt>MPI_SHEPHERD=true<tt> and provide the absolute path to gdb:
{{Command|command=MPI_SHEPHERD=true  mpirun -n 2 $(which gdb) <program>}}


== See also ==
== See also ==

Latest revision as of 14:24, 1 April 2022

GDB is the debugger of the GNU Project
Developer: GNU
Platforms: (all systems)
Category: Debugger
License: GPL
Website: GDB homepage


The GNU debugger (GDB) can be used to inspect problems in programs. It allows to trace and alter the execution of running programs as well as to create and inspect coredumps.

Usage

The gdb debugger is available on HLRS systems without the need to load a module.

Note: Do not forget to compile your application with debugging info (-g option).


Obtaining coredumps of crashing programs

GDB can be used to obtain a coredump of a program crash. To do so start gdb with the program and its arguments

$ gdb --args <program> <program args>

Then start program execution and run until it crashes. When the program crashed save a corefile of the crashed process via the generate-core-file command - optionally providing an output file name:

(gdb) run
(gdb) generate-core-file [file]


Obtaining a backtrace of a crashing MPI program

To get a backtrace of a crashing program start it via gdb as follows:

mpirun -n 2 gdb -batch -ex "run" -ex "bt" <program>
Note: To get the rank of the crashing process for Open MPI the --tag-output option can be used.


HAWK/MPT special

To use gdb with MPT on HAWK one has to run with MPI_SHEPHERD=true and provide the absolute path to gdb:

MPI_SHEPHERD=true mpirun -n 2 $(which gdb) <program>


See also

External links