Dear Sirs, After migrating f
After migrating from Foam to OpenFoam, a strange thing happened: a new library that used to run nice in old Foam, is presenting a segmentation fault when it is called. Can anyone help me with this?
My library is a v2f model (kev2f.C), under directory $WM_PROJECT_USER_DIR/run/myturbmodels/kev2f/kev2f.C
My Make/files under this directory (.../kev2f) is:
LIB = $(FOAM_USER_LIBBIN)/libmyturbmodels
My Make/options in the same directory is:
EXE_INC = \
LIB_LIBS = \
As suggested in User Guide, I copied the foamUser dir to my applications dir ($WM_PROJECT_USER_DIR/applications), and there, in the foamUser/Make, my files and options looks like this:
LIB = $(FOAM_LIBBIN)/libfoamUser
LIB_LIBS = \
There was no problem in compilation, but I get a segmentation fault when I tried to run.
Can anyone help me?
It's very hard to know what i
It's very hard to know what is going wrong from what you have written without having the code to play with. Probably the best thing would be finish it off, pack it up and send it over and I will have a play with it when I get a moment.
Here's what I do when I have
Here's what I do when I have this problem. It will probably help u 2.
1. make sure you get a core-dump: i.e. unlimit
2. setenv SIGFPE 1
3. run the case to produce the 'core'-file
4. analyze the core with gdb: gdb whateverFoam core, where 'whateverFoam' is the name of your code
5. in gdb type 'where'
it should tell you which line it crashed, it's also a good idea when you write new code to use the Debug setup, instead of the Opt, since this will give you alot more info.
This is what I usually do whe
This is what I usually do when debugging memory faults:
Add in Make/options to the EXE_INC variable
-DFULLDEBUG -g -O0
The FULLDEBUG switch causes all the containers to compile with index checking. (This works only for those files that are being recompiled)
Try to produce a core file, see which routine is the culprit and copy its source file(s) into the local directory and add them to the Make/files list.
Also valgrind can be very useful.
|All times are GMT -4. The time now is 04:28.|