petsc - 在 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
在.json
vscode 的文件中
启动.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"
}
这将创建可执行文件并运行脚本。但我无法附加调试器。
将不胜感激一些帮助。
此致
推荐阅读
- python - Django Rest Framework get_queryset() 未将完整结果发送到 TestCase
- amazon-web-services - Route 53 域名上的路径映射?
- api - 托管我的简单 Flask API 的最佳地点在哪里?
- python - Python:文件写入和从dict迭代re.sub只写最后一次出现
- bash - 在 Bash 中运行最后一个命令已损坏(!!)
- node.js - 如何使用节点js在本地机器上下载aws S3文件夹中的所有文件
- pandas - 将列值更改为评级和总和
- android-studio - Android Studio 4+ 对所有文件的文本搜索消失了吗?
- visual-studio-code - 如何为 VSCode 工作区创建任务
- excel - 将 VLookup 循环中的 #NA 值包含在 If 条件中