CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > SU2

How you debug SU2?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 13, 2016, 22:31
Default How you debug SU2?
  #1
Member
 
Paul Zhang
Join Date: Feb 2011
Posts: 44
Rep Power: 12
paulzhang is on a distinguished road
The question is how you guys debug your code, like which platform Windows/Linux/Mac, and what kind of tool you use?

I use to set a breakpoint in the code, but it seems not quite efficient. Any suggestions will be appreciated.

Thanks,
Paul
paulzhang is offline   Reply With Quote

Old   February 7, 2017, 07:44
Post How to compile SU2 with a -g (debugger) flag?
  #2
New Member
 
Sangeeth
Join Date: Jul 2015
Posts: 7
Rep Power: 7
SangeethCFD is on a distinguished road
Dear Paul,

I encountered the same problem recently. I was trying to use Valgrind tool to map out the function calls in SU2. But to be able to use this tool, one has to compile SU2 with a -g flag ( a debugger flag). I am not sure how to do this?

Since you mentioned that you used a breakpoint feature to debug the code, I presume you must have already done this? Can you please detail as what and which files you changed to compile the whole SU2 code in a debugger version?

Any help is highly appreciated.


Regards,
SangeethCFD is offline   Reply With Quote

Old   February 7, 2017, 20:23
Default
  #3
Member
 
Paul Zhang
Join Date: Feb 2011
Posts: 44
Rep Power: 12
paulzhang is on a distinguished road
Dear SangeethCFD,

I haven't found a good way yet. The breakpoint feature I mentioned is just that I add a piece of code in a way when SU2 runs to this place, it exits. I also output some information to check if my variable or array is functional.

Best,
Paul


Quote:
Originally Posted by SangeethCFD View Post
Dear Paul,

I encountered the same problem recently. I was trying to use Valgrind tool to map out the function calls in SU2. But to be able to use this tool, one has to compile SU2 with a -g flag ( a debugger flag). I am not sure how to do this?

Since you mentioned that you used a breakpoint feature to debug the code, I presume you must have already done this? Can you please detail as what and which files you changed to compile the whole SU2 code in a debugger version?

Any help is highly appreciated.


Regards,
paulzhang is offline   Reply With Quote

Old   February 8, 2017, 00:10
Default
  #4
Member
 
Tom
Join Date: Oct 2015
Posts: 67
Rep Power: 7
mlooti is on a distinguished road
Hi guys


I think the best way to read or debug the code is with help of Xcode

If you use windows you can install mac on VMWare and then install xcode on that

with Xcode one can track the run process line by line

it is also possible to connect the Xcode to the GitHub and try branching
mlooti is offline   Reply With Quote

Old   February 26, 2019, 17:16
Default Issues in running Xcode debugger for SU2 code..
  #5
New Member
 
monika chauhan
Join Date: Feb 2019
Location: Blacksburg, VA
Posts: 2
Rep Power: 0
monika2019 is on a distinguished road
Hi Guys,
Help me how you connect Xcode to GitHub and branching? I am getting this error in Xcode while running the SU2 code.

Error in "void CConfig::SetConfig_Parsing(char *)":
-------------------------------------------------------------------------
The configuration file (.cfg) is missing!!
------------------------------ Error Exit -------------------------------


Program ended with exit code: 1

I am new to SU2 as well as to Xcode to be used, appreciate your help


Quote:
Originally Posted by mlooti View Post
Hi guys


I think the best way to read or debug the code is with help of Xcode

If you use windows you can install mac on VMWare and then install xcode on that

with Xcode one can track the run process line by line

it is also possible to connect the Xcode to the GitHub and try branching
monika2019 is offline   Reply With Quote

Old   March 21, 2019, 14:59
Default
  #6
New Member
 
Robert Alviani
Join Date: Mar 2019
Posts: 3
Rep Power: 4
ralviani is on a distinguished road
Quote:
Originally Posted by monika2019 View Post
Hi Guys,
Help me how you connect Xcode to GitHub and branching? I am getting this error in Xcode while running the SU2 code.

Error in "void CConfig::SetConfig_Parsing(char *)":
-------------------------------------------------------------------------
The configuration file (.cfg) is missing!!
------------------------------ Error Exit -------------------------------


Program ended with exit code: 1

I am new to SU2 as well as to Xcode to be used, appreciate your help

Well first make sure you have a configuration file, and are calling it correctly when you run SU2:

SU2_CFD {file.cfg}

If you are already doing this and SU2 is not finding your configuration file, Id say look into your environment variables and make sure they are set correctly.
ralviani is offline   Reply With Quote

Old   May 3, 2019, 08:34
Default
  #7
New Member
 
Amir Bagheri
Join Date: Feb 2019
Location: Southampton, UK
Posts: 11
Rep Power: 4
Amirkb is on a distinguished road
Quote:
Originally Posted by paulzhang View Post
The question is how you guys debug your code, like which platform Windows/Linux/Mac, and what kind of tool you use?

I use to set a breakpoint in the code, but it seems not quite efficient. Any suggestions will be appreciated.

Thanks,
Paul


Hi Paul,


You need to add the "-g" flag when you're compiling SU2. Simply add the following in your configuration command:

CXXFLAGS="-g"


Then you make and install as usual. When you want to run SU2, prefix your run command with gdb:


"gdb SU2_CFD"


You don't need to specify the configuration file just yet. You do that when gdb starts and you want to run the code by typing:


"run path_to_config_file"


You also would have access to all the gdb commands such as setting breakpoints and watching variables. A good place to start for more info is:


https://www.cprogramming.com/gdb.html


Hope that helps,
Amir
Amirkb is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
SU2 debug mode. neetin SU2 4 June 5, 2014 14:48
Pointwise-SU2 joint webinar (April 29th) and SU2 v3.1.0 new release fpalacios SU2 News & Announcements 1 April 30, 2014 02:40
Official release of SU2 V3.0 and SU2 Educational V1.0 fpalacios SU2 News & Announcements 2 January 22, 2014 05:28
SU2 suite has moved to GitHub! fpalacios SU2 News & Announcements 0 August 12, 2013 02:07
Welcome to the Stanford University Unstructured (SU2) forum! economon SU2 0 January 7, 2013 02:48


All times are GMT -4. The time now is 18:14.