Target Language Compiler    

Debug gain.tlc

Now let's look around to find out what is wrong with our code:

  1. Set a breakpoint on line 49 of gain.tlc:
  1. Instruct the TLC debugger to advance to your breakpoint:

    TLC processes input, reports its progress, advances to line 50 in gain.tlc, displays the line, and pauses:

  1. Use the whos command to see the variables in the current scope:
  2. Inspect the variables using the print command (note, names are case sensitive):
  3. Execute one step:
  1. (We reached this statement because InlineParameters is TRUE.)

  1. Step again, into FcnEliminateUnnecessaryParams:
  2. Rather than stepping into LibIsEqual(), advance via the next command:
  1. Examine k's value:

  1. Since k does equal 1.0, the statement following the %if is executed:
  1. Examine y's value:

  1. Advance once more time and you'll see that this function is finished:

Clearly, this is the origin of the C statement responsible for the erroneous constant output, rtb_first_output = 1.0;.

  1. Abandon the build by quitting the TLC. Type

  Start the Debugger and Explore Commands Fix the Bug and Verify the Fix