CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

how to use gdb to debug openfoam?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 15, 2012, 07:15
Default how to use gdb to debug openfoam?
  #1
Member
 
HouKen
Join Date: Jul 2011
Posts: 67
Rep Power: 14
houkensjtu is on a distinguished road
HI foamers!
Since I want to implement energy equation to original interFoam solver, I started from test the interFoam by debug tool--gdb.

For example, in order to read the value of rho1 and rho2, I break interFoam in gdb like:

b alphaEqn.H:26

and it do stops at that point. However if I try to output the the value of rho1 by "disp rho1", or other variable, usually the result was:

rho1 = (const Foam::dimensionedScalar &) @0x7fffffff8cd0: {
name_ = {<Foam::string> = {<std::basic_string<char, std::char_traits<char>, std::allocator<char> >> = {
static npos = <optimized out>,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x8a5048 "rho"}}, static typeName = 0x7ffff550c960 "string", static debug = 0,
static null = {<std::basic_string<char, std::char_traits<char>, std::allocator<char> >> = {
static npos = <optimized out>,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x7ffff4d784d8 ""}}, static typeName = 0x7ffff550c960 "string", static debug = 0,
static null = <same as static member of an already seen type>}},
static typeName = 0x7ffff550cb92 "word", static debug = 2,
static null = {<Foam::string> = {<std::basic_string<char, std::char_traits<char>, std::allocator<char> >> = {static npos = <optimized out>,
..................

and it seems it's endless and I am totally confused both because I can't find the value of rho1 also I don't understand what these output I got means.

Can someone help?
Thanks in advance!
houkensjtu is offline   Reply With Quote

Old   October 15, 2012, 10:08
Default
  #2
Member
 
Meindert de Groot
Join Date: Jun 2012
Location: Netherlands
Posts: 34
Rep Power: 13
meindert is on a distinguished road
Try

p rho1.v_

You may find it useful to look into gdbOF (http://openfoamwiki.net/index.php/Contrib_gdbOF) aswell.
meindert is offline   Reply With Quote

Old   October 16, 2012, 02:05
Default
  #3
Member
 
HouKen
Join Date: Jul 2011
Posts: 67
Rep Power: 14
houkensjtu is on a distinguished road
Quote:
Originally Posted by meindert View Post
Try

p rho1.v_

You may find it useful to look into gdbOF (http://openfoamwiki.net/index.php/Contrib_gdbOF) aswell.
Thanks !
I think I need to learn more c++ before debugging source code ...
houkensjtu is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM 1.5.x package - CentOS 5.3 x86_64 linnemann OpenFOAM Installation 7 July 30, 2009 03:14
Summer School on Numerical Modelling and OpenFOAM hjasak OpenFOAM 5 October 12, 2008 13:14
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07
OpenFOAM Debian packaging current status problems and TODOs oseen OpenFOAM Installation 9 August 26, 2007 13:50
OpenFOAM Training and Workshop Zagreb 2628Jan2006 hjasak OpenFOAM 1 February 2, 2006 21:07


All times are GMT -4. The time now is 20:47.