Debugging C++ Code Imported - Error setting breakpoints
6 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm trying to debug C++ code in a Simulink test. I've imported the code with "Code Importer" tool and generate the model in Library Browser. I've installed Matlab Coder Interface for Visual Studio Code Debugging too.
Finally, I've launched the simulation and some outputs are generated in this model (so it seems that is working fine).
The problem is that I want to debug the internal C++ code, set breakpoints and watch the internal variables, but I cant. When I select my model and "Set Breakpoints in Custom Code" the following error is showing up:
Error occurred when launching external debugger.
Caused by:
- Call to service method "load" failed. Not enough input arguments.
Visual studio is oppened and I can see "Established connection with Matlab" but after this error, if "RUN" button is pressed in Simulink, Visual Studio Reports de Errors:
- Execution of command "Attach" failed. Unable to attach debugger to application "${0}".
- "Unable to attach debugger. Missing application, debugger and/or PID details."
Thank you in advance,
Juan
0 个评论
回答(1 个)
Avadhoot
2023-11-9
Hi Adrian,
I understand that you have imported some code using the code importer tool and are facing an error trying to debug it in Visual Studio Code. I get that you have already confirmed that the model runs fine in Simulink and that you have also installed the MATLAB Coder Interface for debugging in Visual Studio.
The error you are facing could be due to a couple of reasons mentioned below:
1. Issue with MATLAB Coder interface:
The MATLAB Coder interface also requires the installation of some extensions in VSCode. Check whether you have fulfilled all the requirements mentioned in the installation instructions of MATLAB Coder interface.
Detailed information regarding this can be found at the following FileExchange link:
Verify that you have installed the C/C++ extension on VSCode and the appropriate compiler for your operating system.
2. Debugger Configuration:
This issue could be caused due to incorrect configuration of the debugger. Verify that you have configured the debugger correctly and that all the parameters are mentioned in the “launch.json” file in the “.vscode” folder of your project.
Ensure that the “program” field in “launch.json” contains the path to the executable and “processId” field contains the PID for the process. Usually the field is by default set to "${command:pickProcess}".
For more information on setting up the debugger in VSCode, refer the following documentation:
I hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dependency Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!