CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Announcements from Other Sources (
-   -   gdbOF: A debugging Tool for OpenFOAM (

nisi July 6, 2011 15:33

gdbOF: A debugging Tool for OpenFOAM
Hi Foamers,

We are glad to present our tool for debugging in FOAM with gdb, called gdbOF.

gdbOF is an attachable to GNU debugger (gdb) tool that includes macros to debug OpenFOAM's solvers and applications in an easier way.

Go to to download and to use it.

In the latest version (v1.00a) a new utility to dump vol*Fields in FOAM at debugging time is included (pexportfoamformat). It allows (using proper switches) to export the fields to VTK format and open a Paraview window to examine data, always at debugging time.

This utility is still under development. Currently there are no known bugs (but probably some unknown ones). Suggestions about new tools are welcome!!


(This post is an actualization of the post

santiagomarquezd February 22, 2012 09:44

gdbOF has been formally presented in Advances in Engineering Software:

gdbOF: A debugging tool for OpenFOAM®

if you want a copy of the paper, please e-mail me.


manju819 April 14, 2014 12:54

While installing gdbOF

i got this error

Installing gdbOF...
Making sure that you have all needed libraries
----------------------------------------------------- 32: pushd: not found

what to do??


nisi April 14, 2014 14:33


Are you using bash as a shell interpreter? The command "pushd" is a builtin function in bash.

A solution could be

$ export SHELL=/bin/bash

In the terminal you can test it:
$ pushd .
(don't forget the dot at the end) and that command must show the current directory on the screen.

manju819 April 14, 2014 14:48

Hiii Nisi
Thanks for your quick reply

ya I'm using shell only.

if I write pushd . on terminal it is showing cwd

where do I have to paste this
$ export SHELL=/bin/bash

Thanks again

MagnusZeus December 9, 2014 06:08

Hi everybody.

I have given the following command
$ export SHELL=/bin/bash

I have tested
$ pushd .
it has given me the path in which I am

..but when I give
$ sh
I always get the same message

Installing gdbOF...
Making sure that you have all needed libraries
----------------------------------------------------- 32: pushd: not found

Any ideas why?

nisi December 9, 2014 13:05


The problem is regarding to the enviromental variables. I think it can be solved running:

$ ./

which requires execution permission of the file (chmod +x), instead of

$ sh

Check out where the actual command is shown.


MagnusZeus December 11, 2014 06:18

Yes. You are right!
Actually I have another issue. I have created two alias for OpenFOAM:
- a classical one which can be called by of230
- a debug one which points a bashrc_debug file in which the parameter $WM_PROJECT_DIR is set to "Debug"

When the file is launched for the installation, it directly points the $WM_PROJECT_DIR/etc/bashrc in which the $WM_PROJECT_DIR is set to "Opt". As a consequence I get the error and the indication to set the $WM_PROJECT_DIR to "Debug".
What I have done: I set the $WM_PROJECT_DIR in the bashrc file to "Debug" and I called the alias of230. The gdbOF has been successfully installed. After that I turned back to "Opt" because I wanted to use the alias of230debug which points my bashrc_debug file
Proceeding in this way, should I expect any problems in using gdbOF?

nisi December 11, 2014 07:32

The error indication tries to ensure that you have a debug compilation of OpenFOAM (only in that compilation mode is possible to set breakpoints, examine variables and so).

If the installation was successful and if before each use you load the right "debug" alias, you will not have any problems to employ the tool.

Tings_ July 16, 2015 00:17

Hi nisi,

when i try to run 'wmake' in
tings@linux-7ev3:~/OpenFOAM/OpenFOAM-2.4.0/gdbOF_apps/findCell> ,
there is an error


SOURCE=findCell.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O0 -fdefault-inline -ggdb3 -DFULLDEBUG -DNoRepository -ftemplate-depth-100 -I/home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/tings/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude -I/home/tings/OpenFOAM/OpenFOAM-2.4.0/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linuxGccDPDebug/findCell.o
In file included from /home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/ddtScheme.C:30:0,
                from /home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/ddtScheme.H:325,
                from /home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcDdt.C:28,
                from /home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcDdt.H:199,
                from /home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvc.H:44,
                from /home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvCFD.H:8,
                from findCell.C:37:
/home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/cyclicAMIFvPatch.H:39:35:  Fatal error:cyclicAMILduInterface.H:No such file or directory
 #include "cyclicAMILduInterface.H"
compile interrupt.
findCell.dep:619: recipe for target 'Make/linuxGccDPDebug/findCell.o' failed
make: *** [Make/linuxGccDPDebug/findCell.o] Error 1

and after i put "cyclicAMILduInterface.H" into /home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude

there is also another error


/home/tings/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/cyclicAMILduInterface.H:39:42: Fatal error:AMIPatchToPatchInterpolation.H:No such file or directory                                                             
 #include "AMIPatchToPatchInterpolation.H"                                                                 
compile interrupt.                                                                                                 
findCell.dep:619: recipe for target 'Make/linuxGccDPDebug/findCell.o' failed
make: *** [Make/linuxGccDPDebug/findCell.o] Error 1

Every time I solve a problem but another problem comes out and it's always going on.

while i have run 'wmake' successfully in findFace and findFacesCell directiory

So please tell me what should i do ,Thank you!

Best regard!

Tings_ July 16, 2015 05:21

Hello nisi,

I have solved the errors by copy all the '*.H' files (by the prompt) into the $LIB_SRC/finiteVolume/lnInclude then i run './' successfully:D.

But , when i try to run gdb in /tutorails/cavity/ the error comes as below

tings@linux-7ev3:~/tutorails/cavity> gdb
GNU gdb (GDB; openSUSE 13.2) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word".

warning: /etc/gdbinit.d/ No such file or dirtectory

so please give me some advices to solve the error , thank you !

Best regards

WernerW August 11, 2015 13:16

gdbOF Installation issue
Hi OpenFoamers,

I'm sorry for going back a little bit in the instalation of gdbOF. I followed the instructions given in


Originally Posted by nisi (Post 523175)

The problem is regarding to the enviromental variables. I think it can be solved running:

$ ./

which requires execution permission of the file (chmod +x), instead of

$ sh

Check out where the actual command is shown.


And got this error in the command window


werner@werner-K45VD:~/OpenFOAM/gdbOF$ ./
Installing gdbOF...
Making sure that you have all needed libraries
~/OpenFOAM/gdbOF ~/OpenFOAM/gdbOF
making structure
cp: cannot stat ‘gdbOF.tar.gz’: No such file or directory
I do have the folder gdbOf.tar.gz in the directory and when I check the folder OpenFOAM, the directory gdbOF has been removed...

What may be the cause of this issue ?
I apreciate your help ;)


WernerW August 11, 2015 13:24

Got it!
Ok !

I realized that such procedure is part of the installation, I must extract the files to a different folder than gdbOF.

WernerW August 11, 2015 14:24

missing files in ~/lnInclude
1 Attachment(s)
Thank you Tings for sharing your process. I just followed your indications and got gdbOF running.

I made a collection of the libraries missing in src/finiteVolume/lnInclude and would like to share them. I have OpenFOAM 2.4.0.

I actually have your same problem with gdb that doesn't recognise the executable in the case directory ( in my case pimpleDyMFoam). I'll share my hints if I solve this issue.

best regards,

WernerW August 11, 2015 14:44

Since you are trying to debug icofoam's cavity the tutorial of Chalmers might help you. With OpenFoam 2.4.0 I had no issue with that case although i'm having the issue with pimpleDyMFoam.

satkinson August 20, 2015 09:02

I had the same issues with the missing files. After replacing them all as mentoned my new error is;

/home/user/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/AMIInterpolation.H:53:31: fatal error: searchableSurface.H: No such file or directory
#include "searchableSurface.H"

This file is in the directory stated.

Any idea's with this one?


WernerW August 20, 2015 10:29


To what stated directory are you refering ? I remember I missed to include some files in the folder I uploaded becuase I thought of the Idea after a while. Looking for the missing files src folder solves the issue ?

satkinson August 20, 2015 10:40

Hi WernerW,

I have the in OpenFOAM/OpenFOAM-2.4.x/GdbOF_v1.03a

This then was missing the directory OpenFOAM/user/gdbOF_apps so I made these directories and it worked before asking for the missing files, similar to Tings. After adding the files you mentioned to /OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/. It now asks for a file which is already in that directory in the form of #include "searchableSurface.H"


WernerW August 20, 2015 11:43

oook, If it's correctly spelled then I don't know what may be the issue :/ good luck with that.

In my experience debugging is not the best way to solve an issue because an Issue may be provoked by something totally unsuspected and/or unreported. If this doesn't help an alternative would be to revise your simulation parameters. In my case a solved a FPE problem just by setting the timeStep to 1e-5, what I had never guessed with the issues I was having with the speed U.

Cheers anyway !

All times are GMT -4. The time now is 04:24.