Debuggers¶
GNU | INTEL | PGI | CUDA |
---|---|---|---|
gdb,ddd | gdb-ia | pgdbg | cuda-gdb |
GDB¶
GDB, the GNU Project debugger, allows you to see what is going on `inside’ another program while it executes – or what another program was doing at the moment it crashed.
Compile your code with debugging information
gcc [flags] -g [source file] -o [output filer]
Start session
gdb ./a.out
GDB commands¶
Command | Description |
---|---|
help | display a list of named classes of commands |
run | start the program |
attach | attach to a running process outside GDB |
step | go to the next source line, will step into a function/subroutine |
next | go to the next source line, function/subroutine calls are executed without stepping into them |
continue | continue executing |
break | sets breakpoint |
watch | set a watchpoint to stop execution when the value of a variable or an expression changes |
list | display (default 10) lines of source surrounding the current line |
print value of a variable | |
backtrace | displays a stack frame for each active subroutine |
detach | detach from a process |
quit | exit GDB |
To execute shell commands during the debugging session issue shell
in front of the command, e.g.
(gdb) shell ls -l
GDB-IA¶
Debugger provided by intel.
module load intel
PGDB¶
PGDBG® is a graphical debugger for Linux, OS X and Windows capable of debugging serial and parallel programs including MPI process-parallel, OpenMP thread-parallel and hybrid MPI/OpenMP applications. PGDBG can debug programs on SMP workstations, servers, distributed-memory clusters and hybrid clusters where each node contains multiple 64-bit or 32-bit multicore processors.
module load pgi
DDD¶
GNU DDD is a graphical front-end for command-line debuggers such as GDB, DBX, WDB, Ladebug, JDB, XDB, the Perl debugger, the bash debugger bashdb, the GNU Make debugger remake, or the Python debugger pydb. Besides ``usual’’ front-end features such as viewing source texts, DDD has become famous through its interactive graphical data display, where data structures are displayed as graphs. For more information (and more screenshots), see the DDD Manual.
CUDA-GDB¶
CUDA-GDB is the NVIDIA tool for debugging CUDA applications running on Linux and Mac. CUDA-GDB is an extension to the x86-64 port of GDB, the GNU Project debugger. The tool provides developers with a mechanism for debugging CUDA applications running on actual hardware. This enables developers to debug applications without the potential variations introduced by simulation and emulation environments.
module load cuda