1.配置WSL
Windows Subsystem for Linux入门:安装+配置图形界面+中文环境+vscode · wu-kan
2.获取源码
找个位置Git Bash然后拉取代码
git clone https://github.com/oceanbase/miniob.git
3.安装相关依赖
https://gitee.com/liangcha-xyy/source/blob/master/how_to_build.md
4.vscode配置
在WSL中执行以下命令,WSL注意用管理员方式运行
cd miniob
code .
安装下三个插件
在工程的.vscode目录下新建tasks.json ,有了就直接在上面改
{
"options": {
"cwd": "${workspaceFolder}/build"
},
"tasks": [
{
"label": "cmake",
"command": "cmake",
"args": [
"-DDEBUG=ON",
".."
]
},
{
"label": "make",
"command": "make"
},
{
"label": "CMake Build",
"dependsOn": [
"cmake",
"make"
]
}
],
"version": "2.0.0"
}
在工程的.vscode目录下新建launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/observer",
"args": ["-f", "../../etc/observer.ini"],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "CMake Build"
}
]
}
重新使用vscode打开,打开后会自动运行tasks的cmake
5.设置断点调试