FAQ 557: Debugging Virtual Artifacts in VEOS
Question
How do I attach the debugger to a running VEOS simulation?
Solution
The source code debugging during SIL simulation is useful. You can set break points, inspect variables, and step through the code. The V-ECU workflow allows you to integrate ECU code into a simulated artifact and identify errors early in development. During the integration process, it is often advantageous to use a debugger to investigate faults and errors in more detail. VEOS allows external debuggers to be attached to VPUs that are built with the Debug configuration.
If a VPU is built with the Visual Studio Compiler (MSVC) and Debug is enabled, then it is easy to debug the code.
To debug source code in a SIL simulation:
- Load the offline simulation application (OSA) to VEOS
- Start Microsoft® Visual Studio®.
- In the Debug menu in Microsoft® Visual Studio®, select Attach to Process. Microsoft® Visual Studio® opens the Attach to Process dialog.
- In the Attach to Process dialog, click Select. This opens the Select Code Type dialog.
- In the Select Code Type dialog, select ‘Debug these code types’ and then ‘Native’.
- Click OK to close the Select Code Type dialog.
In the Attach to Process dialog, select the VPU process to debug in the Available Processes list. - The illustration below shows the debugging of one VPU process (with the PID 28716) as an example.
- Click Attach.
- In Microsoft® Visual Studio®, load all the code files to debug. (The code files are in the \ExtractedData subdirectory of the build directory.)
- Set a breakpoint, see the example below.
- Start the offline simulation application in VEOS.
The debugger stops at the specified breakpoint. You can now use the debugger as usual. - Enabling debugging: To debug the source code of a V-ECU, you must enable source code debugging while importing the related V-ECU implementation to an offline simulation application.
To configure VSCode for debugging SWC code:
Ensure that the Native Debugger C/C++ (GDB/LLDB) extension is installed with VSCode and the simulation (OSA) is loaded into the VEOS simulator.
- Start VSCode and open the Codes folder.
- Open the source file that needs to be debugged.
- On the Run and Debug tab, click on create a launch.json file and press Enter.
The launch.json file opens. This file contains all debug configurations for the project.
- Click on the Add Configuration button on the bottom right and select C/C++ (gdb): Attach.
- Modify the configuration to point to the VeosVpuHost.exe as a target program and specify the path to the GDB debugger. Save and close the launch.json file.
VeosVpuHost.exe à C:\\Program Files\\dSPACE VEOS 2024- B\\bin\\VeosVpuHost.exe
gdb.exe à C:\\Program Files\\Common Files\\dSPACE\\GCC\\13.2\\x86_64\\bin\\gdb.exe
- Set a breakpoint at any line in the FuelsysController.C by clicking to the left of the line number in VSCode.
- In the Run and Debug pane, click on the run icon or press F5 to attach to the VEOS process. A dialog will open at the top. Search for the VeosVpuHost.exe process.
- Select the process that corresponds to the V-ECU. When correctly attached, VSCode will open a copy of the FuelsysController.c in the VEOS_Build folder, as this is the actual file used during the compilation process.
- Execution will break at the corresponding line in this file.
For more details, refer to the information in the VEOS Manual, ‘Debugging Source Code During SIL Simulation’ in the Running SIL Simulations section.
Tags
| Date | 2026-10-16 |
| Produit | SystemDesk, VEOS |
| Type d’information | Foire Aux Questions (FAQ) |
| Catégorie d’information | Phase de débogage |
| Keywords | SIL Support Central |