当前位置:网站首页>redis源码学习-01_Clion中调试redis源码
redis源码学习-01_Clion中调试redis源码
2022-06-09 17:52:00 【飞奔的屎壳郎】
cygwin搭建
Cygwin只是提供了类似于Linux的环境,实际使用上还是有一些差异的。不过已经能满足我们基本的需求。
下载
官网地址:https://cygwin.com/install.html
安装
- 选择默认

- 选择安装目录,点击下一步;

- 选择“direct connection(直接连接)“;如果你有用代理,请选择对应的设置;

4.选择在线下载安装的镜像站,修改成国内的镜像源:http://mirrors.163.com/cygwin/
- 在这一步,选择需要安装的包;
安装时选择要的包:gcc-core、gcc-g++、make、gdb、binutils
如图示所

- 点击下一步安装开始,并等待安装完毕,安装时间根据网速与选择的包而定;

- 等待完成

Clion配置
其实只要打开Clion它就会自动寻找Cmake,c的编译环境,但是找到后还是需要自己手工设置一下,设置入口在setting中的toolchian里
克隆redis 代码
源码地址:https://gitee.com/gy297879328/redis_3.0_study
打开工程后,大家要注意上面的CMakeList.txt,其中,已经默认给我们配置了几个target:
其中,库应该是不能独立运行的,我们可以运行下面的三个,其中:
- redis-cli,redis客户端
- redis-server,服务端
- redis-example,这个是我自己加的,主要是希望:可以像在java中那样,启动一个main方法,去测试一些工具类啊或者啥的,不然的话,就得写到redis-server的代码中,然后用redis-cli去访问,去触发我们的测试代码。主要是类似于一个测试用的入口。
redis-example,我还多说一点,仔细看CmakeList.txt,可能就理解了:
如何调试
拿redis-example举例:
不过这里的debug,有一点问题,就是会开一个单独的cmd窗口,而不是直接在Console中输出;printf也有点问题。
但是,使用run方式运行,则没有任何问题。
附录
找不到cygwin1.dll
需要从window入口进入,当你双击他执行时他会报缺失cywin的错误,这里有个临时的办法可以解决,
那就是去Cygwin的bin目录下复制出来cygwin1.dll,此时你如果放在了刚redis-cli的目录,就会发现Clion会编译失败,
解决办法就是另外建一个execute的目录,把redis-cli和cygwin1都复制进去,这时你就可以愉快的开始玩转redis源码了

边栏推荐
- c语言解决爬楼梯问题
- Who says redis can't save big keys
- Moco -Momentum Contrast for Unsupervised Visual Representation Learning
- MySQL Community Server 8.0.29安装配置方法图文教程
- 10分钟快速入门RDS【华为云至简致远】
- AI首席架构师4-AICA-百度CV技术应用及产业落地心得
- Gesture interaction across the space, performing "handy" in the real world
- Why do SQL statements use indexes but still slow queries?
- Abbexa DUT ELISA 试剂盒测定原理
- Real topic of the 13th provincial competition of the Blue Bridge Cup in 2022 - block painting
猜你喜欢
随机推荐
Why do SQL statements use indexes but still slow queries?
OpenCV中的带参数宏定义CV_Assert()的作用
Moco -Momentum Contrast for Unsupervised Visual Representation Learning
14届数独-真题标准数独-Day 5-20220120
Walkthrough - combined use of grouping and aggregation functions
入驻快讯|欢迎XCHARGE智充科技正式入驻 InfoQ 写作平台!
Abbexa 质粒 MiniPrep 试剂盒检测程序
MySQL 8.0.29 decompressed version installation and configuration method graphic tutorial
刷脸认证如何实现人脸又快又准完成校验?
NLP-RNN
二叉树遍历与线索化
Redis知识点&面试题总结
Gesture interaction across the space, performing "handy" in the real world
Differences between gtf/gff documents and their mutual conversion (Reprint)
About concurrency and parallelism, are the fathers of go and Erlang wrong?
充电桩的B面是......不只公众号?还有智充小程序!
[long time series prediction] time series decomposition of [2] model components for detailed explanation of aotoformer code
Epigentek染色质可及性检测试剂盒原则与程序
Construction of sheep (rare species) bsgenome reference genome
AI chief architect 3-aica-ai application practice in smart city









