dpigen how to generate *.so objects with debug symbols

조회 수: 1 (최근 30일)
Ronald
Ronald 2025년 6월 5일
댓글: Ronald 2025년 6월 12일
we should be able to generate *.so with something like this
dpigen -d MyDPIProject -testbench fun_tb.m fun.m -args {double(0),int8(0)} -launchreport
I'd like to generate the *.so files with debug symbols to be able to debug with GDB or the simulator
How to achieve this?

채택된 답변

Marc Erickson
Marc Erickson 2025년 6월 11일
You can gain more control on the codegen process by using a configuration object. Here's how you can create a debug build:
cfg = svdpiConfiguration;
cfg.CoderConfiguration.BuildConfiguration = 'Debug';
dpigen -config cfg -d MyDPIProject -testbench fun_tb.m fun.m -args {double(0),int8(0)} -launchreport
Here's the resulting compilation commands from the codegen report (with the mingw toolchain):
### Using toolchain: MinGW64 | gmake (64-bit Windows)
### Creating 'C:\dpigen_debug_mode\MyDPIProject\fun_rtw.mk' ...
### Building 'libfun_dpi': "$(MINGW_ROOT)\mingw32-make.exe" -j 6 -l 6 -Oline -f fun_rtw.mk all
"C:\Mingw64\bin/gcc" -c -fwrapv -m64 -O0 -g -msse2 -fno-predictive-commoning -D__USE_MINGW_ANSI_STDIO=1 -DMODEL=libfun_dpi @fun_rtw_comp.rsp -o "fun.obj" "C:/dpigen_debug_mode/MyDPIProject/fun.c"
"C:\Mingw64\bin/gcc" -c -fwrapv -m64 -O0 -g -msse2 -fno-predictive-commoning -D__USE_MINGW_ANSI_STDIO=1 -DMODEL=libfun_dpi @fun_rtw_comp.rsp -o "fun_dpi.obj" "C:/dpigen_debug_mode/MyDPIProject/fun_dpi.c"
"### Creating dynamic library "./libfun_dpi.dll" ..."
"C:\Mingw64\bin/g++" -shared -Wl,--no-undefined -g -Wl,--out-implib,./libfun_dpi.lib fun.def -o ./libfun_dpi.dll @fun_rtw.rsp -lws2_32
"### Created: ./libfun_dpi.dll"
"### Successfully generated all binary outputs."
You could also hand-edit the "fun_rtw.mk" makefile and reinvoke the "all" target if you are comfortable doing that.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Generated Code Compilation에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by