Ada: Debugging tools


Your program must be compiled with option -g.  This compilation option stores useful information for debuggers in the executable file (source code line numbers, variable names, …)

On Ada (Intel compilers):

  • Option -g is not positioned by default.
  • When only option -g is specified, the Intel compiler optimisation level passes from default -O2 to -O0 (no optimisation).  Nevertheless, it is possible to explicitly specify the optimisation level of -O2 (or superior) on the command line, along with option -g:  This can be useful when optimisation inhibition hides the bug being investigated.
  • A complete list of Intel compiler debugging options is available on this page.


Attention The version of gdb installed by default on Ada cannot read DWARF4 debug format. If you use a gcc compiler writing information with this format (you can see that by the fact that debugging information seems to lack despite specifying -g when compiling), you need to specify -gdwarf-3 option.

GDB is a debugger in the command line.  It is available in interactive on the Ada interactive front-end. Here is un example of a gdb session (setting a breakpoint, execution, and displaying of the list of function calls) :

$ ifort -g main.f

$ gdb ./a.out

(gdb) help

(gdb) break main.f:13
Breakpoint 1 at 0x402af1: file main.f, line 13.

(gdb) run
Starting program: a.out
Breakpoint 1, main () at main.f:13
13	      if (a == 0) then

(gdb) backtrace
#0  main () at main.f:13
#1  0x0000000000402a9c in main ()

(gdb) print a
$1 = 8

(gdb) continue

(gdb) quit

GDB documentation is available on line or directly on Ada (command man gdb).


TotalView is a graphical parallel debugger.  It is available on the Ada interactive front-end and computing nodes.  It supports the exchange library of MPI and OpenMP messages and multithreaded applications with Pthreads.


Launching TotalView

Attention:  It is no longer possible to launch TotalView in parallel (interactive or batch) simply by using the command tv poe -a ./mon_executable:  The parallel parameters of the execution are not taken into account correctly and it is not possible to navigate in the source code.  It is necessary, therefore, to use the Startup Parameter window as described below.

Remote display

TotalView is a graphical debugger.  In order to use the graphical mode, it is necessary to set up an XWindows remote display from IDRIS to your terminal. If unable to obtain this redirection, please contact the User Support Team . It is also possible to launch TotalView without a graphical interface by using the command tvcli but this will greatly reduce the benefits of TotalView.  The use of the command line mode is described in the Reference Guide.

Launching in sequential interactive

To use TotalView in sequential on the interactive front-end, you just need to load the TotalView module and then use the command tv, tv8 or totalview :

$ module load tv
(load) totalview version 2016.06.21
$ tv ./my_executablefile -a arg1 arg2

This mode of functioning allows you to become familiar with the TotalView graphical interface without using billed resources.

Launching in parallel interactive

TotalView interacts with poe for the launching of parallel jobs.  In interactive (up to 32 MPI processes), you just need to launch TotalView on the front-end (see below) and then use the window Startup Parameter (by default, or Ctrl+A) to configure the debugging session. In the Parallel tab, it is necessary to select poe - Linux in Parallel system and configure the number of necessary Tasks.

Fenêtre d'initialisation de TotalView

Launching in parallel batch

In batch, you must not forget to load the TotalView module in the submission script and to configure the remote display.  It is imperative that you be available at your computer screen during the start-up of the job.  To obtain your program's standard output messages on your screen, it is necessary to launch TotalView in a terminal (if not, you must read these lines in the job output file). The following is an example of a submission batch for an MPI debugging session on 16 cores:

  # @ job_name = TotalView
  # @ job_type = parallel
  # @ output = $(job_name).$(jobid)
  # @ error = $(output)
  # @ wall_clock_limit = 00:30:00
  # @ total_tasks = 16
  # @ environment = $DISPLAY
  # @ queue
  set -x
  xterm -sb -e 'module load tv; tv'

In the Parallel tab of the Startup Parameter window, it is necessary to select poe - Linux in Parallel system and configure the adequate number of  Tasks.

Attention:  In parallel, the resources are billed.  It is for this reason that you must be careful about being available during the start-up of the job, and also not to leave a debugging session open uselessly after it has ended (verification possible with the command llq -u my_login).

Usage of TotalView

After closing the Startup Parameter window, the main TotalView window displays the source code of the prinicipal program.  It is possible to navigate in the source code (right click on the function name, then on Dive) and add the breakpoints (by clicking on the line numbers).  To launch the program, click on the green Go arrow in the tool bar.

TotalView advanced options are available for the debugging of memory problems (table overfows, memory leaks).   In the Startup Parameter window of Totalview (or Ctrl+A), you need to choose Enable Memory Debugging (or activate it via the Debug menu of the main window); this option, however, significantly slows down the program execution.  Statistics concerning the memory usage are available in the MemoryScape window (menu Debug, then Open Memoryscape or Alt+Shift+M).


Known problems

  • The usage of the window Startup Parameter is obligatory.
  • The ReplayEngine does not work.

Complementary resources

Documentation for the most recent versions of TotalView tools is available on the Rogue Wave editor site :

Complete documentation of the TotalView version available on Ada by default (in PDF, on our Web server):