环境准备
- 安装vscode插件: CodeLLDB
编译项目
编译时设置变量开启debug模式
mkdir build && cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=YES -DCMAKE_BUILD_TYPE=Debug .
设置 launch.json
菜单选择 Run -> start Debugging, 弹出窗口选择LLDB
生成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": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "/workspace/llama.cpp/examples/batched/build/batched",
// exe程序路径
"args": ["/models/SUS-Chat-34B/ggml-model-q4_0.gguf","i am", "4"],
// 输入参数
"cwd": "${workspaceFolder}"
}
]
}
Debug
然后就可以run debug
了