dpigen how to generate *.so objects with debug symbols

3 次查看(过去 30 天)
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