FLUENT - How to debug User-Defined Functions (UDF)?
How can I debug my User-Defined Function (UDF)? This solution is for the LINUX SERIAL version of FLUENT only. First, compile your UDF as usual. This will not compile with the debug flag, but does create the directory structure for you. % cd libudf/src Now, edit "makefile" and change the flag uder CFLAGS_LNX86 from -O to -g. Then, go back to libudf Type "make FLUENT_ARCH=lnx86 clean" This will remove the old library. Type "make FLUENT_ARCH=lnx86" This will rebuild it with compile flag for debug turned on. Now, a typical LINUX installation has "gdb" installed. If it doesn't exist, have your system administrator install it on your machine. It is available for free. Load the following Scheme command. Alternatively, save this in your ".fluent" file in your HOME directory and FLUENT will autoload it every time you launch FLUENT. ;; BEGIN SCHEME FILE ;; Save this in your .fluent file (define debug (lambda () (system (string-append "xterm -e gdb program " (number->string (cx-client-id)))))) ;; END OF SCHEME DEBUG Then, when you start FLUENT, the (debug) command is defined which will pop up gdb and attach to the FLUENT process. In the text interface (TUI), just type (debug) to start the debugger. |
||
|