Personal tools
You are here: Home / cm / Wiki / Using Totalview
Navigation
Log in


Forgot your password?
 

Using Totalview

Starting Totalview

  • Running totalview on hpc (Strategy Number One)

    • Run 'totalview cm64-debug' (Make sure you are using a debugged version)
    • Go to 'Process->Startup Parameters' and type your comfile as a Command-line argument
  • Running totalview on hpc (Strategy Number Two)

    • Run 'totalview cm64-debug -a myfile.com'

Overview of Important Commands Used in Totalview<a name="commands"></a>

  • Type 'f' in totalview window allows you to search for file. For example, type 'march8_' will bring up MARCH8.f which you can then place a breakpoint in.
  • To set a breakpoint, e.g. line 129 of MARCH8.f, just click on line 129 on left hand side of page and a red 'STOP' will cover the line number.
  • Click on 'Go' to get the programming running. You can 'Halt' at anytime to stop at a point in the program. Note that this does not end your program, just temporarily suspend computation.
  • Click 'Next' to step to the next active line in the code without stepping into any subroutines. ('Next' simply steps over all subroutines.) You can also simply type 'n' to go to the next line.
  • Click 'Step' to step to the next active line, or into a subroutine. You can also click 's' to go to the next line or into a subroutine.
  • Click 'Out' to go out of the current subroutine and into the next higher subroutine on the tree.

Viewing Contents of Arrays and Variables

  • First option (one I never use) is to look at the 'Stack Frame' window. Gives all variables on the stack. (Note that a subroutine places all local variables on the stack versus global variables which are placed on the heap. Google stack and heap and learn more information about them.)
  • Common means of viewing arrays are variables is to double click on them. A window will pop-up with the array values in the window. Use that to search for values or to only look at a slice. (Use 'Slice' window.)
  • You can view a variable value (not an array) by simply placing the mouse pointer over that variable.

Creating Breakpoint based on Variable Values

  • To set a condition breakpoint edit the properties of the breakpoint and set the Evaluation Expression to be something of the form: "if(np.eq.840) $stop"
  • To set a breakpoint for writing to a variable, highlight the variable in the Expression View and create a Watchpoint (under Tools)

Tracing segmentation faults with a coredump file and totalview

  • First change your 'limits' to allow a coredump 'limit coredumpsize unlimited'
  • Then start from the command line your comfile, e.g. ' /hpc/cmiss/bin/rs6000-aix/cm64-debug -batch "comfile" >& "outputfile" </dev/null ' (I would recommend to use the full path for cm64-debug instead of aliases). The option '-batch' supresses any further input from stdin.
  • Start totalview: 'totalview':
    • In the start-up window, change the box 'Start a new process' to 'Open a core file'
    • Choose in the field 'Program' the cm-debug executable which produced the coredump file (with its full path, e.g. ' /hpc/cmiss/bin/rs6000-aix/cm64-debug ')
    • Then browse for the coredump file 'core' produced by running cm64-debug
    • Hit the 'OK' button.
  • Totalview pops-up with a window which displays (just as in normal debugging mode) the source code. An arrow points to the position at which the segmentation fault occured.
  • Now, you can look at the variables, trace back subroutines, ... You can now use totalview just as you would be in normal debug-mode (of course "execute the next command"-button is not an option).
  • After debugging, make sure that you remove your cordump file again. Coredump files are extremely large (can easily be >10G).
  • Set your limits back such that no coredump file gets created any more: 'limit coredumpsize 0'