Debugging a RTSS Application with Visual Studio

The following steps will demonstrate a simple Visual Studio debug session, using one of the provided RTX64 sample programs. Follow along to:

Start Visual Studio

In this tutorial, we will use Visual Studio 2012.

Steps:

  1. To begin your debug session, start Microsoft Visual Studio.
  1. Open an existing project by clicking File > Open > Project
  2. Browse to the IntervalZero Samples directory, and select the SRTM sample. If you installed in the default directory you would go to %public%\Documents\Intervalzero\RTX64 SDK\3.7\Samples\SRTM and select the solution SRTM_VS2012 and click OK.
  1. The SRTM solution will open. The project called SRTM_VS2012 contains a single source file, Srtm.c.

Build the Project

When a project like SRTM is generated using the RTX64 Application template, it contains a solution with four 64-bit configurations to build Windows executable files with and without debug symbols (Debug / Release) and RTSS executable files with and without debug symbols (RTSSDebug / RTSSRelease). These solution configurations can be seen in the pull-down menu.

Steps:

  1. To build an RTSS configuration that can be debugged, select the RTSSDebug configuration.
  1. From the Build menu select Rebuild Solution.

Build output will display in the Output window at the bottom of the screen. If the output window is not visible, select Output from the View pull-down menu.

 

------ Build started: Project: SRTM_VS2012, Configuration: RTSSDebug x64 ------

Srtm.c

Rtx64RespTime.vcxproj -> %public%\intervalzero\2.1\samples\SRTM\RTSSDebug\SRTM.rtss

StampTool: Successfully stamped file '%public%\Documents\Intervalzero\RTX64 SDK\2.1\Samples\SRTM\RTSSDebug\SRTM.rtss'!

 

Debug

NOTE: Data breakpoints are not supported.

Steps:

  1. From the Solution Explorer window, open the source file SRTM.c by right-clicking the file name and selecting Open, or by double-clicking the file name.
  2. Set the first breakpoint by double-clicking in the column to the left of the RtCreateTimer function call, or by right-clicking on the line and clicking Breakpoint > Insert Breakpoint in the pop-up menu.

  1. Set a second breakpoint by double-clicking in the column to the left of the RtGetClockTime function call.

  1. To start debugging, select Start Debugging from the Debug pull-down menu, or press the F5 key.

  1. The RTX64 Server console window will open and display text from the program and then the debugger will stop the program at the first breakpoint.
  2. To continue from the breakpoint, select Continue from the Debug pull-down menu or press the F5 key.
  3. When the debugger stops at the second breakpoint, view variable values in the Autos window. If the debug windows are not visible, use the Windows option in the Debug pull-down menu to display them. Press the F5 key to continue debugging.
  4. While debugging, you can select to Continue or to Stop Debugging from the Debug pull-down menu.  If you select Continue, program execution will continue until it completes or reaches another breakpoint. If you select Stop, program execution will halt.

After you have finished the debug session, you can close the RTX64 Server console window.

Related Topics:

MiniTutorials: