If you are building your RTist application with the Visual Studio compiler, you also need to use the Visual Studio IDE for debugging it. Fortunately, it’s very easy to do that. Let’s look at the steps needed to use Visual Studio 2017 to debug an executable that has been created with RTist.

The first step is to set-up the transformation configuration in RTist so the built executable will contain debug symbols. Open the TC editor and go to the Target Configuration tab. Set $(DEBUG_TAG) in Compile Arguments and /DEBUG in Link Arguments.

TC Debug Settings

These two settings are sufficient to be able to debug all generated C++ code. However, if you also need to debug into the TargetRTS code, follow these additional steps.

Now you can build your TC as usual to create the executable.

The next step is to open the generated project folder in Visual Studio. Right-click the generated CDT project in Eclipse and do Properties. Copy the full path to the project that is shown as Location in the Properties dialog. In Visual Studio do File – Open – Folder and paste the copied path in the dialog. Then close the dialog to open the content of the folder in Visual Studio.

Solution Explorer

If you want you can now set some breakpoints in the generated source code. When you are ready to start debugging, right-click the executable in the Solution Explorer and choose Debug.

Debug Menu

The application is launched and can now be debugged in Visual Studio.

If you need to define command-line arguments, environment variables etc for the debugged application you can use the Debug and Launch Settings command in the context menu of the executable. Choose the Native debugger and edit the launch.vs.json file. For example, to prevent that the debugged application runs under the RTist command-line debugger, set the -URTS_DEBUG=quit command-line argument like this:


Use Content Assist (Ctrl + Space) in the above file to learn about more configuration properties you can set.

Happy debugging!

Comment wrap
Further Reading
Secure DevOps  /  June 22, 2020
Developing IoT and Embedded Applications the Efficient Way
By: Nabeel Jaitapker, Product Marketing Lead, HCL Software
In order to gain a competitive advantage, companies need advanced tooling to support and scale their embedded and IoT applications with strategic uses of these model-based designs.Companies that adopt new technologies and are able to react to this data to enhance the customer experience, gain a significant edge on their competitors.
Secure DevOps  /  June 11, 2020
RTist 11 2020.22 Now Available
By: Mattias Mohlin, Senior Solutions Architect for HCL Software
The latest release of RTist 11, called 2020.22, is now available. Here’s a look at what’s most noteworthy: Final Modifier Supported The C++ 11, Final Modifier is now supported by the model compiler. There is a new Final property that can be set on classes and capsules to specify that they cannot be inherited. The same property is also available on operations to specify that they cannot be overridden. Automatic Variables with Auto Keyword Another C++ 11 feature is automatic variables declared with the auto keyword. In RTist, you can now create attributes typed by a special auto type that has been added to the CppPrimitiveDatatypes package. You need to specify a default value for the attribute, set its Initializer Kind property to either "equal" or "brace" and make it static const or static constexpr, so that the model compiler will generate an initializer for the corresponding C++ variable. The C++ compiler will deduce the type of the variable from that initializer value.   Fix for Broken References An important improvement in the 2020.22 release is the better support for working with broken references. In the previous versions, the tool had difficulties coping with certain broken references, and as a remedy it sometimes deleted elements with such references. Now this no longer happens, and instead we have made it easier to fix broken references by means of a new Quick Fix called "Rebind Broken References". This quick fix can be run from the context menu of a broken reference problem in the Problems view, and it is able to rebind broken references that have been introduced by refactorings, where not all affected references could be updated at the time of the refactoring. A common example is when elements in a model library are moved so they end up in a...