CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Wiki > Udf debug

Udf debug

From CFD-Wiki

(Difference between revisions)
Jump to: navigation, search
(Debugging a Fluent udf using gdb)
(Debugging a Fluent udf using gdb)
Line 14: Line 14:
  13. "break filename.c:line_nr" - put a break point in your udf source at a specified line
  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
  14. "continue" - now fluent gets alive again until it hits your breakpoint
-
  15. onece the breakpoint is hit, use "print/step/next..." to follow your code step by step
+
  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"
  16. if the bug is found or you got bored, then is time for a detach: "detach"
  17. "quit"
  17. "quit"

Revision as of 08:48, 16 October 2009

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"
My wiki