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 路径(可选)
        }
    ]
}
相关推荐
承渊政道8 分钟前
【从零开始大模型开发与微调:基于PyTorch与ChatGLM】(开源大模型ChatGLM高级定制化应用实战)
人工智能·pytorch·python·llm·模型微调·glm
Smoothcloud润云6 小时前
PyTorch大模型权重加载与启动耗时优化实战:定位磁盘、内存与显存瓶颈
人工智能·pytorch·python·深度学习·gpu算力
databook7 小时前
从循环到向量化:NumPy提速的7个关键思维
python·数据分析·numpy
别动我齐刘海7 小时前
Linux 系统调试学习1
linux·运维·服务器·c++·学习·机器学习·机器人
棉猴7 小时前
玩游戏学Python1-Python和pgzero库的安装
python·pygame·玩游戏·pgzero·pgzrun
诺伦8 小时前
GEO优化数据实证:78%引用流向官网的机制拆解与小品牌三步管线实战教程 | RiseClaw玄策
python·seo·geo·内容营销·ai搜索
oooost8 小时前
pytorch学习笔记1
python·学习方法
数字融合8 小时前
透明化视频孪生虚实映射一体化融合技术
人工智能·python·数码相机
jack186898 小时前
Lovable.Dev 全栈应用快速落地实战指南
python
华研前沿标杆游学9 小时前
【标杆研学】走进茅台集团|对标学习长期主义与匠心精神
python