3.7 Using debug tools

Problem

Are there any methods to debug other than creating a module?

Solution

Two principal methods are available.

  1. Debug using gdb in a command line

  2. Error checks of spatial transfer functions using the harktool 

The harktool is designed to improve localization and separation performance rather than for debugging the program. Brief descriptions are given for each of these method.

  1. Debug using gdb in a command line
    gdb is a free source level debugger of GNU and is useful for stopping executions by designating a break point or perform executions for each line. It is used as follows for debugging operations in HARK.

    • Compile with -g -ggdb options
      (Add AM_CXXFLAGS = -g -ggdb to Makefile.am)

    • gdb /path/flowdesigner
      Move to the gdb console.
      (gdb)

    • Setting of break pointers
      (gdb) b MODULE::calculate (when designating by function name)
      (gdb) b module.cc: 62 (when designating by line count;e.g., the 62nd line of module.c)

    • Confirmation of the break points
      (gdb) i b

    • Break points with conditions (example)
      (gdb) cond 3 i==500 (Stop the third break point in the loop processing after executing 500 times)

    • Normal execution
      (gdb) r nfile.n (Execute nfile.n)

    • Stepwise execution (execute for each line)
      (gdb) n

    • Restart execution (when stopping at the break point)
      c nfile.n

  2. Error checks of spatial transfer functions using the harktool 
    For (2), see the description in the section of harktool in this manual.

See Also

To create a debug module with gdb, see Making a debug node and "Implementation: Modification of Channel Selector" of the HARK training session material