CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   SU2 (https://www.cfd-online.com/Forums/su2/)
-   -   How you debug SU2? (https://www.cfd-online.com/Forums/su2/181404-how-you-debug-su2.html)

paulzhang December 13, 2016 22:31

How you debug SU2?
 
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

SangeethCFD February 7, 2017 07:44

How to compile SU2 with a -g (debugger) flag?
 
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 February 7, 2017 20:23

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 (Post 636241)
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,


mlooti February 8, 2017 00:10

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 February 26, 2019 17:16

Issues in running Xcode debugger for SU2 code..
 
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 (Post 636334)
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


ralviani March 21, 2019 14:59

Quote:

Originally Posted by monika2019 (Post 726126)
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, I’d say look into your environment variables and make sure they are set correctly.

Amirkb May 3, 2019 08:34

Quote:

Originally Posted by paulzhang (Post 629559)
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


All times are GMT -4. The time now is 23:44.