Use offline debugging

To use offline debugging, specify the --offline argument. Optionally, specify an output filename with the --output=<filename> argument. A filename with a .html or .htm extension will generate an HTML version of the output. In other cases, a plain text report will be generated. If the --output argument is not used, an HTML output file will be generated in the current working directory and reports the name of that file upon completion.

ddt --offline mpiexec -n 4 myprog arg1 arg2
ddt --offline -o myjob.html mpiexec -n 4 myprog arg1 arg2
ddt --offline -o myjob.txt mpiexec -n 4 myprog arg1 arg2
ddt --offline -o myjob.html --np=4 myprog arg1 arg2
ddt --offline -o myjob.txt --np=4 myprog arg1 arg2

Additional arguments can be used to set breakpoints, at which the stack of the stopping processes will be recorded before they are continued. You can also set tracepoints at which variable values will be recorded, and set expressions to be evaluated on every program pause.

Settings from your current configuration file will be taken, unless over-ridden on the command line.

Command line options that are of the most significance for this mode of running are:

  • --session=SESSIONFILE - run in offline mode using settings saved using File ‣ Save Session.

  • --processes=NUMPROCS or -n NUMPROCS - run with NUMPROCS processes.

  • --mem-debug[=(fast/balanced/thorough/off)] - enable and configure memory debugging.

  • --snapshot-interval=MINUTES - write a snapshot of the program’s stack and variables to the offline log file every MINUTES minutes. See Run-time job progress reporting.

  • --trace-at=LOCATION[,N:M:P],VAR1,VAR2,...] [if CONDITION] - set a tracepoint at location, beginning recording after the N’th visit of each process to the location, and recording every M’th subsequent pass until it has been triggered P times. Record the value of variable VAR2. The if clause allows you to specify a boolean CONDITION that must be satisfied for the tracepoint to trigger.

    Example:

    main.c:22,-:2:-,x
    

    This will record x every 2nd passage of line 22.

  • --break-at=LOCATION[,N:M:P][if CONDITION] - set a breakpoint at LOCATION (either line or function), optionally starting after the N’th pass, triggering every M passes and stopping after it has been triggered P times. The if clause allows you to specify a boolean CONDITION that must be satisfied for the breakpoint to trigger. When using the if clause the value of this argument should be quoted. The stack traces of paused processes will be recorded, before the processes are then made to continue, and will contain the variables of one of the processes in the set of processes that have paused.

    Examples:

    --break-at=main
    --break-at=main.c:22
    --break-at=main.c:22 --break-at=main.c:34
    
  • --evaluate=EXPRESSION[;EXPRESSION2][;...] - set one or more expressions to be evaluated on every program pause. Multiple expressions should be separated by a semicolon and enclosed in quotes. If shell special characters are present the value of this argument should also be quoted.

    Examples:

    --evaluate=i
    --evaluate="i; (*addr) / x"
    --evaluate=i --evaluate="i * x"
    
  • --offline-frames=(all/none/n) - specify how many frames to collect variables for, where n is a positive integer. The default value is all.

    Examples:

    --offline-frames=all
    --offline-frames=none
    --offline-frames=1337
    

The program will run to completion, or to the end of the job.

When errors occur, for example a program crash, the stack back trace of crashing processes is recorded to the offline output file. In offline mode, it is as if you clicked Continue if the continue option was available in an equivalent ‘online’ debugging session.

Read a file for standard input

In offline mode, normal redirection syntax can be used to read data from a file as a source for the executable’s standard input.

Examples:

cat <input-file> | ddt --offline -o myjob.html ...
ddt --offline -o myjob.html ... < <input-file>

Write a file from standard output

Normal redirection can also be used to write data to a file from the executable’s standard output:

ddt --offline -o myjob.html ... > <output-file>