Debugging DLLs

To debug a DLL TestStand calls, first create the DLL with debugging enabled in the ADE. Then, launch the TestStand Sequence Editor or TestStand User Interface executable from the ADE or attach to the sequence editor or user interface process from the ADE, when supported.

Debugging LabVIEW DLLs

To build a debuggable shared library in the LabVIEW development system, you must configure the shared library to enable debugging in the build specification for the shared library before building the shared library. Using the LabVIEW development system, you can then connect to the TestStand application process that loads and calls the VIs in the debuggable shared library.

Debugging LabWindows/CVI DLLs

Select Run»Select External Process in the Project window to identify the executable for the sequence editor or user interface and select Run»Debug <executable name> to start debugging the executable. For Visual Studio, you must enable native code debugging.

When you suspend a sequence on a step that calls a debuggable DLL, click the Step Into button in TestStand to suspend at the first statement in the DLL function within LabWindows/CVI or Microsoft Visual Studio.

To step into a code module with LabWindows/CVI, you must configure the step to use the LabWindows/CVI Adapter. You can step into a code module when you configure the LabWindows/CVI Adapter to execute steps in-process or in an external instance of LabWindows/CVI.

The LabWindows/CVI debugger automatically attaches to a TestStand process when you perform a step into operation on a LabWindows/CVI Adapter step. If the LabWindows/CVIDLL is debuggable and the source code is available, LabWindows/CVI suspends the processing the called DLL function; otherwise, TestStand performs a step over operation. You do not need to launch the Sequence Editor from LabWindows/CVI to access the debugger or choose to attach the debugger to an existing process.

Note You must be using LabWindows/CVI 2015 SP1 or later for the debugger to automatically attach to a TestStand process.

Debugging Microsoft Visual Studio DLLs

To step into a DLL directly from TestStand into a supported version of Visual Studio, you must configure the step to use the C/C++ DLL Adapter. When you attempt to step into a DLL while Visual Studio is not attached to the TestStand process, TestStand launches Visual Studio, which automatically attaches to the TestStand process using native debugging.

When you launch Visual Studio from TestStand, Visual Studio runs with the same privileges you used to run TestStand. If you launch TestStand while logged in as a user with standard privileges and then you launch Visual Studio from TestStand, you cannot execute tasks in Visual Studio that require administrator privileges. Refer to the LabWindows/CVI and Visual Studio documentation for more information about debugging DLLs in an external process.

Note
  • Save sequence files and workspaces before you stop debugging and terminate the TestStand process because most ADEs terminate the process without prompting you to save modified files in TestStand.
  • When you use LabWindows/CVI to debug a DLL in the TestStand process, you cannot debug a .NET assembly at the same time. When you use Visual Studio to debug an assembly in TestStand and you want to use LabWindows/CVI to debug code modules at the same time, you must configure the LabWindows/CVI Adapter to execute the steps in an external instance of LabWindows/CVI.
  • You must attach Visual Studio to the TestStand process correctly depending on the type of code module you want to debug. For C++ code modules, NI recommends using only native debugging when attaching Visual Studio.
  • When the Step Over command executes on an End step in a Pre-Step callback sequence, TestStand attempts to step into the code module.