You can test the code generated from UML development models
by opening them in debug mode. When you run the C++ application in
debug mode, it stops at each breakpoint that you set, so that you
can see what is happening in the model and determine if the application
is working as expected.
Before you begin
You must build the model project to create the executable
file.
About this task
To run a generated C++ application in debug mode, complete
one of the following steps:
- To run the debugger so that it does not stop at breakpoints, in
the Project Explorer view, in the CPP project
folder, right-click the EXE file; then click . This configuration sets up the environment variable -URTS_DEBUG=quit,
which enables the debugger to run without stopping.
- To run the debugger so that it stops at each breakpoint, in the Project
Explorer view, in the CPP project folder, right-click the
EXE file; then click . The
application stops at each generated breakpoint. To continue to run
the application, you must press C each time
that it stops.
Results
When you run a C++ application, the
Debug perspective
opens. When the application stops at a breakpoint, the generated code
is displayed in the editor and the current line of code is highlighted.
If the breakpoint is in the model, the state machine diagram opens
and the UML breakpoint is highlighted. If the breakpoint is in the
source code, the code is highlighted in the
Code view.
What to do next
You can update the model or fix errors in the code, rebuild
the model, and then rerun the application to test your changes.