详细参考
https://www.jianshu.com/p/b4c34ee9e411
Mac补充关于libevent的安装
brew install libevent
编写编译脚本
#!/bin/bash
# 显示执行该指令及所下的参数。
set -x
# clean 整个工程
make clean
OUTPUT=$(pwd)/bin
# 编译函数
function build
{
# 编译前清理数据
make clean
./configure \
--prefix=$OUTPUT/ \
--CPPFLAGS='-lldb'
# 编译。
make -j8
#安装
make install
echo -e "\033[32m build successful \033[0m"
}
#执行编译命令
build
调试memcached
调试脚本
{
// 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": "debug memcached",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/bin/memcached",
"args": ["-p", "11211", "-m", "64m", "-d"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
}
]
}
调试效果
memcached.jpg