This will be a long shot, but I would like to know if anyone in the community has the .json setting for running PETSc in VScode (for debbuging).
Best Regards
This will be a long shot, but I would like to know if anyone in the community has the .json setting for running PETSc in VScode (for debbuging).
Best Regards
This is how you can start a PETSc program, pause it for the debugger, and attach the VS Code debugger.
launch.json
"version": "0.2.0",
"configurations": [
"name": "Attach to process",
"type": "cppdbg",
"request": "attach",
"processId": "${command:pickProcess}",
"program": "/dev/null",
"linux": {
"MIMode": "gdb"
},
"osx": {
"MIMode": "lldb"
}
}
]
}
Start the program and have it sleep for 20 seconds so you can attach the debugger:
myprogram -stop_for_debugger -pause_debugger=20
The -stop_for_debugger
option will cause the program to print the process id to stdout.
Attach to process
.myprogram
that matches the process id printed to stdout when you started the program.VS Code cppdbg requires a "program", but the value does not matter as long as it exists on the filesystem.
For the time being I am using example 19 from /petsc/src/snes/tutorials as a case.
I made a makefile with:
Inside I placed:
in the
.json
files of vscodelaunch.json
And in tasks.json
This creates the executable and runs the script. But I cannot attach the debugger.
Would appreciate some help.
Best Regards