What's the best way to capture data values?

 

Is your monitor covered with yellow stickies because you want to remember data values? That is, your program is in a loop and you want to see the value of a variable the last time through the loop or perhaps even its original value. Here are some techniques for cleaning up your monitor:

  1. Use a screen capture program. In other words, take a picture and then display it when you need to.  
  2. Cut and paste into a text editor window. On some systems, you'll have to use TotalView's copy command to capture the information.  
  3. Use the Tools > Command Line command to open a CLI window. Then, use the dprint command to see values. For example:

    dprint {my_array[3:6]}

    Notice the braces surrounding the variable. They are needed in C and C++ because brackets have special meaning in Tcl. If you use this technique, you'll probably want to tell TotalView that it shouldn't display much other information. Here's the CLI command for doing this:

    dset VERBOSE ERROR

  4. Use an eval point containing a printf() statement.  

However, using yellow stickies can be an effective debugging technique.


You can find tips that we've already sent out in our Tip Archive

Help us improve these tips!