Target Language Compiler    

Example TLC Debugging Session

When you press the Build button and invoke the TLC debugger, you see the TLC-DEBUG> prompt. Note that this example will use the local version of gain.tlc. The simple_log model is configured with the Inline parameters option turned on.

  1. Place a breakpoint in line 50 of gain.tlc and then continue. To do this, use

    This continues the TLC code generation process and invokes the debugger when it reaches the specified breakpoint.

  1. When control is transferred back to the debugger, use where to show the TLC stack.

    You can use whos to see the variables in the LOCAL scope and then probe their values.

  1. If you look at the gain.tlc file, you see the FcnEliminateUnnecessaryParams function has to return the required output code to be dumped in the Outputs function of the C file. You can also look at this using print, and then you can step into the function. For example,
  2. You probably cannot interpret too much from this, so continue to the next iteration.
  3. Step into the function FcnEliminateUnnecessaryParams and examine outputs in the function.
  4. You are now in the function scope. You do not want to step through the lines in LibIsEqual, so use next to go to the next line.

    Looking at this output, you can see that the variable k, instead of the input u, is assigned to the output y. This is done with the statement

    This assignment represents the "bug" in this example.

  1. You can use up to go to the Outputs function and then down to return to the function scope.
  2. To fix the bug, you must change k to u. Try making the change and rebuilding the model. Your results from the simulation and RTW build should match.

This example covered several ways to use some of the debugger commands. You should try using other commands with this example to familiarize yourself with the various commands.


 TLC Debugger Commands TLC Coverage