Getting Started with the NI LabWindows™/CVI™ Remote Debugger

Publish Date: May 29, 2014 | 8 Ratings | 3.62 out of 5 | Print | Submit your review

Overview

The LabWindows/CVI remote debugger extends debugging beyond your local desktop to remote target machines. LabWindows/CVI performs debugging on two types of targets – DLLs running on LabVIEW Real-Time and executables/DLLs running on another desktop. This document addresses the general setup and use of the remote debugging features in LabWindows/CVI

Table of Contents

  1. Terms and Definitions
  2. Introduction
  3. Configure the Debugger
  4. Configure the Debuggee
  5. The Debugging Process
  6. Troubleshooting

1. Terms and Definitions

Debugger – The LabWindows/CVI environment that has the source code in memory along with its debugging features. Usually, this is the development computer.
Debuggee – The application or DLL, meant to be debugged, running on a target PC or LabVIEW Real-Time environment.

Back to Top

2. Introduction


In LabWindows/CVI, users can easily create and debug applications and DLLs. The Remote Debugger extends this functionality so that a development machine can now debug applications or DLLs running on a remote computer. This feature is extremely useful if the target computer does not have LabWindows/CVI installed, or have the application source code present. Remote debugging is also helpful when it is difficult to re-create in the development machine the runtime conditions required to run the application or to reproduce a particular error. When creating DLLs for a real-time target, the Remote Debugger is the only way to debug the DLLs using the LabWindows/CVI environment.

Back to Top

3. Configure the Debugger


  1. Click on Run >> Switch Execution Target >> Select Target with Options…
  2. Select an execution target based on whether you are debugging the DLL/executable on another PC on the network or a DLL on an RT target.
    1. If you are debugging an executable/DLL on another PC on the network, select New Target on the Network from the drop-down menu. In the Machine Name/IP field, enter the network address of the computer on which the debug executable or DLL is running. You can enter either a machine name or an IP address for this option. LabWindows/CVI rejects debug connections that do not originate from this network address. You can either leave the Port of the debug session as the default port number, 3291, or change it.
    2. If you are debugging a Real-Time DLL running on an RT target without using LabVIEW RT, select New RT Target on the Network from the drop-down menu. In the Machine Name/IP field, enter the network address of the RT Target. This will allow LabWindows/CVI to automatically download the DLL to the RT target and run it.
    3. If you are debugging a Real-Time DLL that is running on an RT target via LabVIEW RT, select New RT Target on the Network via LabVIEW. In the Machine Name/IP field, enter the network address of the computer on which the debug executable or DLL is running. You can enter either a machine name or an IP address for this option. LabWindows/CVI rejects debug connections that do not originate from this network address. You can either leave the Port of the debug session as the default port number, 3291, or change it.
  3. Click OK
  4. Make sure there is a check mark next to Build>>Configuration>>Debug
  5. To Debug an Application (EXE):
    1. Make sure there is a check mark next to Build>>Target Type>>Executable.
    2. Click on Build>>Create Debuggable Executable. This creates an executable in your project folder
  6. To Debug a Dynamic Linked Library (DLL):
    1. Make sure there is a check mark next to Build>>Target Type>>Dynamic Linked Library. If you are creating a DLL that will run on an RT target, make sure to set Real-Time only runtime support by going to Build >> Target Settings and setting Run-time support to Real-time only. For more information about creating DLL for RT target, refer to the LabWindows/CVI Shipping Help topic Creating and Downloading Real-Time DLLs from LabWindows/CVI
      Note:
      Skip steps b, c and d if you are creating a DLL for a Real-Time system.
    2. Click on Run>>Specify External Process
    3. This opens a new window called Specify External Process
    4. For the field Program Name, enter the path of the executable that is going to call your DLL. If your DLL is being called by a LabVIEW VI, the program name should be LabVIEW.exe. If your DLL is being called by a TestStand sequence, the program name should be SeqEdit.exe.

1.

  1. Click on Build>>Create Debuggable Dynamic Link Library

Back to Top

4. Configure the Debuggee


  1. First you need to transfer the application or DLL to the target computer. You can do this either by creating a debuggable executable and then sharing the directory with the target machine or copying it, and every file that is needed to run your application – the CVI run-time engine, for example – over to the target computer or by creating an Installer (Build>>Create Distribution Kit). The following steps describe how to create an installer with a debuggable executable:
    1. Click on Build>>Create Distribution Kit and go through the regular process of creating an Installer.
    2. Install the application on the target computer.
    3. Repeat steps 4, 5, and 6 under Configuring the Debugger section
    4. Copy the newly created debuggable executable/DLL over to the target machine and replace the one created by the Installer
    5. Every time you change the source code, you can simply create another debuggable executable/DLL and copy it over to the target machine.
    Note: When you have finished debugging your executable/DLL, you can create a regular Distribution Kit and install it over the debuggable installer or build a release version of the executable/DLL and copy it over the debug version.
    Note: If you specified your target settings as New RT Target on Network, LabWindows/CVI will automatically download the DLL to the RT target. If your target settings specify RT Target via LabVIEW, you will need to use LabVIEW RT to download the DLL for you. Refer to the LabVIEW RT Help for instructions on how to download DLLs on an RT target. If you are trying to debug a DLL on a RT target (regardless of how it was downloaded), skip the rest of this section.
  2. Run ConfigureRemoteDebugging.exe located in ..\Program Files\National Instruments\CVI80\bin directory on the target computer. If the executable is not on the target computer, you can copy it over from the development machine. You can run this executable only after the CVI run-time engine has already been copied to the target computer (see step 1)
  3. Network port of the debug session. This should match the port on the debugger.
  4. Enter the IP address or computer name of the debugger. Remember that you must leave the utility running during the debugging session.

Click Done once you are finished debugging.

See Also:
Customizing Create Distribution Kit Installers in LabWindows/CVI

Back to Top

5. The Debugging Process

The Remote Debugger accomplishes its tasks by communicating with the debuggee via TCP. With remote debugging enabled, the debuggee looks for the LabWindows/CVI debugger at a certain IP address. If it is unable to find the debugger, it continues without debugging.

Once you have setup the debugger and the debuggee, run the debugger by clicking on the ‘Debug Project’ button or pressing Shift+F5. If you specify your target settings as New RT Target on Network, LabWindows/CVI will automatically download the DLL to the RT Target and start running the code. You can debug the code as it is already running.

For the other target settings, instead of running the code, the debugger begins waiting for a connection from the debuggee. You will see a LabWindows/CVI Debugger window popup similar to the one below.


Now launch the debuggee executable or the application that calls the debuggee DLL. The debuggee connects to the debugger using the network address and port information provided. You can now control the application as though it were a regular debugging process, e.g. you can suspend execution on breakpoints, step through code, look at variables and examine watch points.
The LabWindows/CVI Debugger waits for further connections after the debuggee exits.

Note: When you debug a DLL for LabVIEW Real-Time and you are waiting for a connection, you’ll see a dialog (see below) when you load the corresponding VI in LabVIEW. This happens because when LabVIEW loads a VI, it also loads all the DLLs called by the VI. If you define DLLmain in your DLL, the DLL will connect to the CVI debugger and you’ll see this dialog. If you want to debug the DLL on your desktop machine, select Accept. If you want to debug the DLL on a real-time target instead, select Wait. The DLL tries to reconnect after you download your VI to the RT target.

Back to Top

6. Troubleshooting


  • Why do I get a message saying that my DLL is out of date?
    • The DLL or the application on the debuggee must match the version of that on the debugger. Otherwise LabWindows/CVI will give you a version mismatch error.
  • Is there an order in which the debugger and debuggee need to be started?
    • The debugger must always be started before the debuggee application. The debuggee only checks for the debugger once. If it cannot find the debugger, it continues like a normal application without looking for it again.
  • Why doesn’t my application connect to the CVI debugger?
    • Check the connection parameters.
    • Verify both machines are connected to the network.
    • Include the domain name in the network address: mytest02.mydomain.com
    • Use IP addresses (e.g. 130.255.108.15) instead of machine names in case name resolution doesn’t work.
    • If you installed your application through a distribution kit verify that the distribution kit installed the debug version of your application. By default, the release version is used.
  • Why do we wait for additional connections?
    • Because we don’t know when you’re done debugging. For example, you might create an executable with VC++ that calls several CVI DLLs. These DLLs connect and disconnect to the CVI debugger in their entry point functions. CVI doesn’t know when the executable has finished using the CVI DLLs.

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit