Freitag, 4. Mai 2012

debug shared library in IDL with DDD

How to debug a c program that was compiled as shared library and that is called by IDL via call_external in GNU DDD debugger? a) compile the shared library without optimization and with debugging information: Example: gcc -fPIC -O0 -ggdb3 -c fw_bw_loop_quick_xp.c && gcc -shared -o fw_bw_loop_quick_xp.so fw_bw_loop_quick_xp.o -lm b) call IDL inside DDD in the path where your data is like: LD_LIBRARY_PATH=/usr/local/rsi/idl/lib:/usr/local/rsi/idl/bin/bin.linux.x86_64 ddd /usr/local/rsi/idl/bin/bin.linux.x86_64/idl c) inside DDD type "run" This will start IDL inside DDD. Now you can restore your software and execute whatever you want. If it enteres the c-program, type CTRL-C or set somehow a breakpoint d) continue normal debugging. Open the source of your c-program by "open->source". Thanks a lot to my friend Fernando Silveira for this tip!!!!!!