debug functions called using coder.ceval

6 visualizaciones (últimos 30 días)
Rodrigo Lopez Negrete
Rodrigo Lopez Negrete el 20 de Jun. de 2022
Comentada: Rodrigo Lopez Negrete el 6 de Oct. de 2023
Hi all,
I have a Simulink model that calls a Maltab Embedded Code block that includes coder.ceval('some_function',arg1,arg2...argN). I'm having issues when calling the c-code throwing some exception that causes matlab to crash. I have mex setup to use my installation of Msys/Mingw, and have access to gdb. However, after attaching Matlab to GDB, and adding breakpoints, the execution is not stopping at the breaks I have set. Note that I added "coder.updateBuildInfo('addCompileFlags', '-g');" within the embedded matlab code to try to force the debug symbols to be created.
The question is: how can I debug the code being called via coder.ceval if I'm using gdb? Is this possible?
thanks!
Rodrigo

Respuestas (1)

Githin George
Githin George el 6 de Oct. de 2023
Hello Rodrigo,
Kindly find attached a documentation link that provides the workflow for debugging generated code. You can debug your custom C function by placing an appropriate breakpoint in the ‘model_step’ function.
Please note that it also Requires installation of MATLAB Coder Interface for Visual Studio Code Debugging’ support package. See https://www.mathworks.com/matlabcentral/fileexchange/103555-matlab-coder-interface-for-visual-studio-code-debugging.
  1 comentario
Rodrigo Lopez Negrete
Rodrigo Lopez Negrete el 6 de Oct. de 2023
Thank you for the comments.
I ended up creating an external DLL and linked that to the mex being built. Then I was able to attach and debug properly using gdb.
I will look at this documentation nonetheless.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by