如何解决在 VScode 中为 PETSc 配置调试设置
这将是一个漫长的过程,但我想知道社区中是否有人拥有在 VScode 中运行 PETSc 的 .json 设置(用于调试)。
最好的问候
解决方法
目前我使用 /petsc/src/snes/tutorials 中的示例 19 作为案例。
我制作了一个makefile:
touch makefile
里面我放了:
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
example19: example19.o chkopts
-${CLINKER} -o example19 example19.o ${PETSC_LIB}
${RM} example19.o
在 vscode 的 .json
文件中
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information,visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0","configurations": [
{
"name": "(gdb) Launch","type": "cppdbg","request": "launch","program": "${fileDirname}/${fileBasenameNoExtension}","args": [],"stopAtEntry": false,"cwd": "${fileDirname}","environment": [],"externalConsole": false,"MIMode": "gdb","preLaunchTask": "run petsc makefile","setupCommands": [
{
"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true
}
]
}
]
}
在tasks.json
{
"tasks": [
{
"type": "shell","label": "run petsc makefile","command": "make","args": [
"${fileBasenameNoExtension}"
],"options": {
"cwd": "${fileDirname}","env": {"PETSC_DEB": "/home/pc/petsc"}
},"problemMatcher": [
"$gcc"
],"group": "build",}
],"version": "2.0.0"
}
这将创建可执行文件并运行脚本。但我无法附加调试器。
希望得到一些帮助。
最好的问候
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。