vscode调试C++ python相关配置

settings.json

json 复制代码
{
    "cmake.sourceDirectory": "/workspace/KuiperLLama",
    "cmake.buildDirectory": "/workspace/KuiperLLama/vscode_build",
    "cmake.configureSettings": {
        "USE_CPM": "ON",
        "QWEN2_SUPPORT": "ON"
    },
    "testMate.cpp.test.executables":"/workspace/KuiperLLama/vscode_build/*/*",
    "testMate.cpp.test.workingDirectory": "${absDirpath}",
    "python-envs.defaultEnvManager": "ms-python.python:conda",
    "python-envs.defaultPackageManager": "ms-python.python:conda"
}

launch.json

json 复制代码
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "debug llama",
            "type": "cppdbg",
            // "type": "cuda-gdb",
            "request": "launch",
            "program": "/workspace/KuiperLLama/vscode_build/demo/llama_infer",
            // "program": "/workspace/KuiperLLama/build/demo/qwen_infer",
            "args": [
                // "/workspace/KuiperLLama/models/stories110M.bin",
                "/workspace/KuiperLLama/models/chat_myself_version0.bin",
                "/workspace/KuiperLLama/models/TinyLlama-1.1B-Chat-v1.0/tokenizer.model"
             ], // 可执行文件的命令行参数,如需要可添加
            //  "args": [
            //     // "/workspace/KuiperLLama/models/stories110M.bin",
            //     "/workspace/KuiperLLama/models/qwen25/Qwen2.5-0.5B_export0.bin",
            //     "/workspace/KuiperLLama/models/qwen25/Qwen2.5-0.5B/tokenizer.json"
            //  ], // 可执行文件的命令行参数,如需要可添加
            "stopAtEntry": false, // 是否在main函数入口暂停
            "cwd": "/workspace/KuiperLLama", // 工作目录,根据需要调整
            "environment": [], // 环境变量,例如 [{"name": "LD_LIBRARY_PATH", "value": "/usr/local/lib"}]
            "externalConsole": false, // 设为 true 可打开外部终端(已废弃,推荐用 integratedTerminal)
            "console": "integratedTerminal", // 推荐:在 VS Code 内部终端中运行
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 SIGINT 等信号启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设为 Intel",
                    "text": "set disassembly-flavor intel",
                    "ignoreFailures": true
                },
                {
                    "text": "-enable-pretty-printing\nskip -gfi /usr/include/c++/*/*/*\nskip -gfi /usr/include/c++/*/*\nskip -gfi /usr/include/c++/*\nskip -gfi /usr/local/include/gtest/*\nskip -gfi /workspace/KuiperLLama/vscode_build/_deps/*\nskip -gfi /workspace/KuiperLLama/vscode_build/_deps/*/*\nskip -gfi /workspace/KuiperLLama/vscode_build/_deps/*/*/*",
                    "ignoreFailures": true
                },
                {
                    "text": "-enable-pretty-printing\nskip -gfi /workspace/KuiperLLama/vscode_build/_deps/**",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb"
            // "miDebuggerPath": "/usr/local/cuda/bin/cuda-gdb"
        },
        
        {
        "name": "Debug aaa",
        "type": "cppdbg",
        "request": "launch",

        "program": "/workspace/a_study/cpp/vscode_build/aaabbb",
        "args": [],
        "stopAtEntry": false,
        "cwd": "/workspace/a_study/cpp",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "/usr/bin/gdb",

        "setupCommands": [
            {
            "description": "Enable pretty-printing",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
            }
        ]
        },

        {
        "name": "Debug CUDA (Nsight)",
        "type": "cuda-gdb",
        "request": "launch",
        "program": "/workspace/cuda_code/course2/reduce_smem",
        "miDebuggerPath": "/usr/local/cuda/bin/cuda-gdb",
        "env": {
            "CUDA_LAUNCH_BLOCKING": "1"
        },
        "setupCommands": [
            {
            "description": "Break on kernel launch",
            "text": "set cuda break_on_launch application",
            "ignoreFailures": true
            },
            {
            "description": "Disable source timestamp check",
            "text": "set check-source-file off",
            "ignoreFailures": true
            },
            {
            "description": "Enable pretty printing",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
            }
        ],
        },

        {
            "name": "Python: Debug Current File (Custom Interpreter)",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "cwd": "${workspaceFolder}",
            "env": {},
            "args": [],
            "justMyCode": false,
            "python": "/usr/local/miniconda3/envs/py312/bin/python"
        },
        {
            "name": "(gdb) Launch Python",
            "type": "cppdbg",
            "request": "launch",
            "program": "/usr/local/miniconda3/envs/py312/bin/python", // Python 解释器路径
            "args": [
                "/workspace/cuda_code/course10/ex_demo/demo.py"
            ], // Python 脚本参数
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}", // 工作目录
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb" // GDB 路径(可选)
        }
    ]
}
相关推荐
BK贝壳24 分钟前
bool-hybrid-array 的 GPU_opt 与 cjx:一个没显卡就报错的开关,一个把 800 字压到 96 字节的编码
python
BD_Marathon4 小时前
安装Jupyter notebook
ide·python·jupyter
Zlzxzw4 小时前
End-to-End Autonomous Generation of Human Assembly Plans
python
Wellijohn5 小时前
2000 个请求、30% 失败率:我把 Python 批量并发的限流和重试参数算了一遍
后端·python·性能优化
小飞在努力7 小时前
【实现负载均匀在线判题③】从零散模块到统一,编译运行全链路封装
c语言·开发语言·c++·笔记
Logintern097 小时前
deep agents 多智能体模式——规划与委派
python·langchain
2601_967980119 小时前
Python 办公自动化合集 ⑰:Excel自动计算——总和/平均分/最大值
python·pycharm·办公自动化·数据处理·excel自动计算
星恒随风11 小时前
从0实现C++ AI大模型接入SDK(四):大模型API接入、公共数据结构设计与日志库封装
linux·服务器·数据结构·c++·人工智能
炸膛坦客11 小时前
单片机/C/C++八股:(三十四)C 语言函数参数入栈顺序
c语言·开发语言·c++
databook11 小时前
时间序列预测,模型换了一圈为什么没变好
python·数据分析