|
[Sponsors] |
November 28, 2022, 23:10 |
How can I debug a su program?
|
#1 |
Member
zhangqiang
Join Date: Nov 2022
Posts: 43
Rep Power: 3 |
Usually, I learn an algorithm by debug it. The SU2 tutorial show the usage of SU2 by: SU_CFD.exe xxx.cfg. In this way, how can I step into the original code?
Can I debug it by visual studio or VS code or other compilers? Could someone provide some instruction? Any suggestion is appreciated~~~ |
|
November 29, 2022, 15:20 |
|
#2 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 640
Rep Power: 19 |
Hi,
1. download the source code: https://github.com/su2code/SU2 2. compile su2 yourself, either in linux or windows: https://su2code.github.io/docs_v7/Bu...2-Linux-MacOS/ (recommended) https://su2code.github.io/docs_v7/Build-SU2-Windows/ Then install VScode and your favorite debugger, make sure you compile su2 in debugging mode and run it from withing VScode. |
|
December 1, 2022, 01:37 |
|
#3 |
Member
zhangqiang
Join Date: Nov 2022
Posts: 43
Rep Power: 3 |
Thank you very much for kindly reply.
I have compile su2 in my computer. I usually use visual studio and CMakeLists.txt to build project. The instruction of SU2 recommand command style to run code. I am confuzed about how to build su2 projection in visual studio. 1. Can I build projection in visual studio and include su2 library? Could you please give me more details about how to include su2 library in visual studio? 2. Could you please give me more details about how to include su2 in VScode? |
|
December 1, 2022, 06:06 |
|
#4 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 640
Rep Power: 19 |
Hi,
In vscode, it is sufficient to just open the main project folder called SU2 to start working with it. For debugging you only have to configure VScode such that it can find the debugger, and you'll have to create a configuration file that calls the SU2 executable and the config file. For more information, please have a look at one of the many VScode (or other) tutorials |
|
December 1, 2022, 11:41 |
|
#5 |
Member
zhangqiang
Join Date: Nov 2022
Posts: 43
Rep Power: 3 |
If VScode calls the SU2 executable, can I step into the source code?
|
|
December 2, 2022, 04:17 |
|
#6 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 640
Rep Power: 19 |
Yes, please go through a VSCode tutorial, and also go through the docs at
https://code.visualstudio.com/docs/languages/cpp https://code.visualstudio.com/docs/cpp/config-linux https://code.visualstudio.com/docs/cpp/config-mingw If you are not familiar yet with debugging, please start with the simple "Hello World" example on the visualstudio website to get familiar with the basics. |
|
December 5, 2022, 08:52 |
|
#7 |
Member
zhangqiang
Join Date: Nov 2022
Posts: 43
Rep Power: 3 |
Thank you very much for the kindly reply~~~ I will try it.
|
|
December 31, 2022, 01:14 |
|
#8 |
Member
zhangqiang
Join Date: Nov 2022
Posts: 43
Rep Power: 3 |
I have read some information about using vscode to debug code. In this webpage https://code.visualstudio.com/docs/languages/cpp, the steps to debug a c++ is:
1. Prepare a fold and c++ code, for example: HelloWorld.cpp 2. Terminal > Run Build Task In order to debug su2 program with vscode, I still some questions: 1. Is SU2/SU2_CFD/src/SU2_CFD.cpp the HelloWorld.cpp? 2. How should I set the tasks.json file? Any suggestion is appreciated~~~ |
|
January 1, 2023, 10:40 |
|
#9 |
Member
zhangqiang
Join Date: Nov 2022
Posts: 43
Rep Power: 3 |
Firstly, compile SU2 in debug: python ./meson.py build --buildtype=debugoptimized.
Then, implement a launch.json. Finally, I can debug into SU2 project. |
|
October 28, 2023, 11:08 |
|
#10 | |
New Member
Liming Yang
Join Date: Sep 2023
Posts: 29
Rep Power: 3 |
Quote:
1.I have compiled according to the method of the official website, do I need to debug again in VS code? 2.I understand that debugging must start with a certain part (class), so where should I debug and learn the code, or can I debug it as a whole? 3.Should I write the tasks.json file during my specific operation? Or is it automatically generated? 4.Since I am new to CFD, which part would you recommend to start reading and learning? Some of the questions may be obvious, but your advice will be of great importance to me, and I would be grateful if you could give me some experience. |
||
October 28, 2023, 11:13 |
|
#11 | |
New Member
Liming Yang
Join Date: Sep 2023
Posts: 29
Rep Power: 3 |
Quote:
I am very confused about how this works in VScode, I would appreciate it if you could explain in more detail. |
||
Tags |
debug |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] Extracting ParaView Data into Python Arrays | Jeffzda | ParaView | 30 | November 6, 2023 22:00 |
Finding the corresponding debug switch | Tobi | OpenFOAM Programming & Development | 8 | October 14, 2020 10:23 |
Recursive output of Foam::word in gdb print command | chengdi | OpenFOAM Programming & Development | 1 | July 19, 2017 21:19 |
Update boundary conditions calculated by an external program | CedricVH | OpenFOAM | 2 | January 15, 2010 12:55 |
debug program | zhujianguo | Phoenics | 0 | July 21, 2003 05:36 |