| 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.
gain.tlc and then continue. To do this, useTLC-DEBUG> break "gain.tlc":50 TLC-DEBUG> cont
This continues the TLC code generation process and invokes the debugger when it reaches the specified breakpoint.
where to show the TLC stack.TLC-DEBUG> where
==> [00] gain.tlc:Outputs(50)
[01] /devel/R12/.snapshot/nightly.0/perfect/rtw/c/tlc/
commonbodlib.tlc:FcnGenerateConstantTID(407)
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,TLC-DEBUG> print FcnEliminateUnnecessaryParams(y, u, k)
/* y0[i1] = u0[i1] * (0.0); */
TLC-DEBUG> step
Stopped in file "gain.tlc" at line 23
00023: %if LibIsEqual(k, "(0.0)")
TLC-DEBUG> cont TLC-DEBUG> print k (1.0) TLC-DEBUG> print FcnEliminateUnnecessaryParams(y, u, k) rtb_temp2 = (1.0);
FcnEliminateUnnecessaryParams and examine outputs in the function.TLC-DEBUG> step Stopped in file "gain.tlc" at line 23 00023: %if LibIsEqual(k, "(0.0)")
LibIsEqual, so use next to go to the next line.TLC-DEBUG> next Stopped in file "gain.tlc" at line 27 00027: %elseif LibIsEqual(k, "(1.0)") TLC-DEBUG> print u rtb_temp2 TLC-DEBUG> print k (1.0) TLC-DEBUG> print y rtb_temp2
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
%<y> = %<k>;
up to go to the Outputs function and then down to return to the function scope.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 | ![]() |