Debugging commands

When hcitpstest is stopped, the client can send debugging commands to the server and receive responses.

Breakpoint management

Debugging commands for manipulating breakpoints include:

  • Insert a breakpoint
    b file:line[?condition]

    file must be an absolute path (Unix) or fully-qualified path (Windows, beginning with a driver letter and “:”) of the Tcl source file.

    line is the line number.

    The optional condition is a Tcl expression. For example:

    b /work/quovadx_dev/qdx6.2P/integrator/t-dtc/tclprocs/myproc.tcl:12?$i==3

    If there are whitespaces in the file path or in the Tcl expression, then “"” or “{}” must be used. For example:

    b "/work/quovadx_dev/qdx6.2P/integrator/t-dtc/tclprocs/myproc.tcl:12?$i == 3"

    or

    b {/work/quovadx_dev/qdx6.2P/integrator/t-dtc/tclprocs/myproc.tcl:12?$i == 3}

    The response to the b command is:

    {"status": "done", "dbgcmd": "break"}
  • Delete an existing breakpoint
    d file:line[?condition]

    The argument must be exactly the same as given in a previous “b” command. Otherwise, the breakpoint is not deleted.

    The response to the d command is:

    {"status": "done", "dbgcmd": "delete"}

    The debugger client can use these two commands to implement more complex functionality. For example, adding a condition to an existed unconditional breakpoint, or updating the expression of an existing conditional breakpoint.

Running the program

These are the debugging commands for running the program, including continue, step over, step into, and step out.

  • c: Continue running the program

    This resumes the running of the debugged TPS procedure. This continues to run until it reaches the next breakpoint.

    The response to a c command is:

    {"status": "running", "dbgcmd": "continue"}
  • n: Step over (or “next”)

    This resumes the running of the debugged TPS procedure. This stops when the beginning of the next source line is reached.

    The response to the n command is:

    {"status": "running", "dbgcmd": "step-over"}
  • s: Step into

    This resumes the running of the debugged TPS procedure. This stops when the beginning of the next source line is reached, if the next source line is not a procedure invocation. If it is, then it stops at the first command of the invoked procedure.

    You cannot step into Tcl’s built-in commands or extension commands that are implemented in C/C++. The behavior is the same as "step over."

    You can step into an “unknown” procedure that is defined in $HCIROOT/tcl/lib/tcl8.6/init.tcl. This means the procedure to step into is not loaded yet and the auto-loading handler is triggered. You must locate the file in which the procedure is defined and re-run hcitpstest with a source command added to the -D option’s Tcl script argument.

    The response to the s command is:

    {"status": "running", "dbgcmd": "step-into"}
  • o: Step out

    This resumes the running of the debugged TPS procedure until the current procedure exits.

    The response to the o command is:

    {"status": "running", "dbgcmd": "step-out"}
  • q: Quit debugging session

This removes all breakpoints, then resumes the running of the debugged TPS procedure until the program ends.

The response to the q command is:
{"status": "running", "dbgcmd": "quit"}

After this command, when the program hcitpstest ends, the connection to the Tcl debugger server is closed.

Data manipulation

Use the Tcl set command to change the value of a visible variable. For example:

set varName value

The response to the set command is:

{"status": "done", "dbgcmd": "set i 10", "result": "10"}