Debugging RTDLLs

You can debug an application that uses RTDLLs. An RTDLL is a Real-Time Dynamic Linked Library. It is like a Windows DLL, so it can be debugged within the Visual Studio instance that is debugging your application.

Running an eRTOS Application that uses RTDLLs in the Debugger

eRTOS provides a Visual Studio integrated base debugger and launch provider that is used by Visual Studio when debugging Real-time applications. eRTOS applications are started by the eRTOS loader. For this reason, when debugging eRTOS applications in Visual Studio, conditional breakpoints and the following options in the Debug pull-down menu (which would assume Windows control) are not supported:

Note: The MaxRT eRTOS Debugger supports relative pathnames.

Build Configurations

Two configurations for creating DLLs are generated in Visual Studio when you create a project using the eRTOS RTDLL template:

x64

  • eRTOSDebug – Real-time DLL that has debug flags enabled
  • eRTOSRelease – Optimized Real-time DLL that does not include additional debug information

Note: We recommend selecting the eRTOSDebug configuration of the application you want to debug, as this configuration is set up to generate debug information.

Set Debugging Properties

For more information about setting up eRTOS debugging properties, see Setting Debugging Properties in Visual Studio.

Debugging

To debug an RTDLL, you must now have a solution with two projects: a project that will create an RTDLL and a project that will create an eRTOS process that will use the RTDLL. The program that will use the DLL explicitly or implicitly should start when debugging begins.

Note: Data breakpoints are not supported.

To debug a eRTOS program and RTDLL:

  1. Ensure that eRTOSDebug is selected from the Solutions Configurations pull-down menu.

  2. In Solution Explorer, right-click on the eRTOS project and select Set as Startup Project.

  3. In Solution Explorer, right-click on the eRTOS project and select Properties. Open Debugging tab.

  4. Ensure that MaxRT eRTOS Debugger is the selected debugger. Note that this will already be selected when eRTOSDebug is the selected configuration.

  5. Make the following changes to the properties:

    Settings Value
    Command C:\eRTOS\bin\eRTOSApp1.ertos
    Remote Server Name IP address of eRTOS target. For example: 192.168.100.50
  6. Set a breakpoint in the application.

  7. Select Build Solution from the Build pull-down menu.
  8. Ensure that RtVsMon.ertos is started on eRTOS target computer and waiting on remote connection.

  9. Ensure that eRTOSApp1.ertos and eRTOSRTDLL1.edll are copied to target. For example, copy to C:\eRTOS\bin\ folder.

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

  1. If you get a message asking if you would like to rebuild the eRTOSRTDLL1, click No. A rebuild is not necessary since there have been no changes since the previous build.
  2. Explicitly load eRTOSRTDLL1.edll from RtssApp1.ertos by calling LoadLibrary.

  3. Set breakpoint after LoadLibrary is called.

  4. At the first breakpoint after LoadLibrary is being called successfully, click Modules at the bottom of the window. If symbols are not loaded for either of the modules, right-click and select Load Symbols from the pull-down menu.

Note: If Modules is not available from the status bar at the bottom of the window, select Modules from the Windows option in the Debug pull-down menu to open the modules window.

  1. If necessary, locate the symbol file in the eRTOS directory where the binaries were built.

The Output window should now indicate that symbols are loaded.

  1. To continue from the first breakpoint, select Continue from the Debug pull-down menu or press the F5 key.
  2. When the debugger stops at the second breakpoint, if this is the call to the toggle function, select Step Into or press the F11 key to step into the DLL function.

Focus will now turn to the RTDLL1ExportFunction.cpp source code.

  1. To continue, select Step Out from the Debug pull-down menu or press Shift+F11.

When focus returns to the RtssApp1.cpp program, 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.

For a more comprehensive example of debugging a RTDLL, see MiniTutorial: Debugging Applications in Visual Studio.

Related Topics:

MiniTutorials: