dpigen how to generate *.so objects with debug symbols

8 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Marc Erickson
Marc Erickson il 11 Giu 2025
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.

Più risposte (0)

Categorie

Scopri di più su Generated Code Compilation in Help Center e File Exchange

Tag

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by