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!