0

how to debug Tough3 in vscode

Hi all,

When configuring, I changed the -- build type to debug, which can generate an executable file called tough3-eco2n in the tough3-install folder. Then, I opened the source code in the src folder in vscode and set breakpoints. However, when running the codes, there was no interruption at the breakpoint. What is the reason for this?  Thank you very much.

Yong

The following is the lauch.json in vscode:

{

"version":"2.0.0",

"configurations":[

{

"name":"toughGDB",

"type": "cppdbg",

"request":"launch",

"program": "${workspaceRoot}/src/test/tough3-eco2n",

"args": [],

"stopAtEntry": false,

"cwd": "${workspaceRoot}/src/test",

"externalConsole": false,

"MIMode": "gdb",

"targetArchitecture": "x86",

},

{

"name": "Intel Debug Attach",

"type": "cppvsdbg",

"request": "attach",

"processId": "${command:pickProcess}"

}

]

}

4 replies

null
    • kenny
    • 1 yr ago
    • Reported - view

    If you want to debug the tough3, you need 

    (1) change the compilation type to DEBUG type.

    (2) edit the tough3.fi to uncomment the module you are going to compile (tough3.fi provided in V1.1)

    (3) compile it.

    (4) rename the input file to "INFILE" and copy it to the VS default working folder  (the default working folder could be the folder where the  project file *.vfproj located, not sure. If you put the input file in wrong folder, you will always get the file fort.36 in default working folder.)

    (5) set a breakingpoint (F9), and then start debugging (F5)

      • Yong.1
      • 1 yr ago
      • Reported - view

       Thank you kenny. This is the way to debug the serial mode of tough3 in Windows. But how to debug the parallel mode in VSCODE in Ubuntu?  I compiled the code using the following command: ./configure.sh --build-type=DEBUG --eos=eco2n --no-x11 --petsc-dir=/home/yong/petsc-3.17.0 

      I successfully generated the executable file, but when using VSCODE to set breakpoints and call the executable file for debugging, the program will not pause at the breakpoint. 

      • kenny
      • 1 yr ago
      • Reported - view

       I do not know any easy way to do the parallel debugging. I always debug the parallel TOUGH codes by writing out the variables thar are interested from different MPI tasks.

      • Yong.1
      • 1 yr ago
      • Reported - view

       Thank you, Kenny. I will debug it by the same way.

Content aside

  • 1 yr agoLast active
  • 4Replies
  • 48Views
  • 2 Following