From CFD-Wiki
Debugging a Fluent udf using gdb
1. build libudf using GUI
2. open with a text editor the file libudf/src/makefile
3. search for CFLAGS_LNAMD64 (or your appropriate platform)
4. change the option "-O" with "-O0 -g" and save the file
5. go to the libudf directory "cd libudf"
6. "make clean"
7. "make; cd ../"
8. load the new libudf in fluent and start running the udf
9. Identify the process id of fluent "ps -e | grep fluent.12.0.16"
10. start the debugger "gdb"
11. attach to the fluent process "attach 10304"; now fluent is interrupted
12. "backtrace" or "frame" to see where we are in the code
13. "break filename.c:line_nr" - put a break point in your udf source at a specified line
14. "continue" - now fluent gets alive again until it hits your breakpoint
15. once the breakpoint is hit, use "print/step/next..." to follow your code step by step
16. if the bug is found or you got bored, then is time for a detach: "detach"
17. "quit"