最近总是要看看memcached的代码,虽然以前也是作c/c++的,可是这几年用惯eclipse,已经不习惯用vi看代码了。研究一下,用eclipse-cdt debug memcached,现在方便多了。
[img]http://www.iteye.com/upload/attachment/44572/791e23b6-cf31-34d4-bbe6-6ff8d3c30002.png[/img]
1. 解压代码
2. configure
3. 新建一个C project
[img]http://uniseraph.iteye.com/upload/attachment/44658/0b395de8-8a0f-324d-83e3-501905856c39.png[/img]
4. import 代码到project中
[img]http://uniseraph.iteye.com/upload/attachment/44674/f3c29ec5-c36a-36b3-8df1-0616e39a8f84.png[/img]
[img]http://uniseraph.iteye.com/upload/attachment/44668/088941c8-927e-39fb-bb1f-aa3b547ee3c1.png[/img]
5. 创建一个target : all
[img]http://uniseraph.iteye.com/upload/attachment/44660/6ea84b8b-a770-3c44-9dfe-bcd97fe99488.png[/img]
6. 配置编译参数HAVE_CONFIG_H
[img]http://uniseraph.iteye.com/upload/attachment/44662/9c62d5fb-efec-325a-b26f-0a111accf0d6.png[/img]
7. 配置include
[img]http://uniseraph.iteye.com/upload/attachment/44670/6162f146-0860-33b1-9bb1-70290c505805.png[/img]
8. 配置libraryies
[img]http://uniseraph.iteye.com/upload/attachment/44672/f01feb7d-3a85-3a19-b7af-8445ce5674f0.png[/img]
9. 在memcached.c的main函数中加一个断点,选择“local c/c++ application” debug
[img]http://uniseraph.iteye.com/upload/attachment/44664/fd81cddc-bdc5-30cb-bdaa-dd886a7a3c3b.png[/img]
[img]http://www.iteye.com/upload/attachment/44572/791e23b6-cf31-34d4-bbe6-6ff8d3c30002.png[/img]
1. 解压代码
cd dev
tar zxvf memcached-1.2.6-tar.gz
2. configure
cd memcached-1.2.6
./configure --enable-threads
3. 新建一个C project
[img]http://uniseraph.iteye.com/upload/attachment/44658/0b395de8-8a0f-324d-83e3-501905856c39.png[/img]
4. import 代码到project中
[img]http://uniseraph.iteye.com/upload/attachment/44674/f3c29ec5-c36a-36b3-8df1-0616e39a8f84.png[/img]
[img]http://uniseraph.iteye.com/upload/attachment/44668/088941c8-927e-39fb-bb1f-aa3b547ee3c1.png[/img]
5. 创建一个target : all
[img]http://uniseraph.iteye.com/upload/attachment/44660/6ea84b8b-a770-3c44-9dfe-bcd97fe99488.png[/img]
6. 配置编译参数HAVE_CONFIG_H
[img]http://uniseraph.iteye.com/upload/attachment/44662/9c62d5fb-efec-325a-b26f-0a111accf0d6.png[/img]
7. 配置include
[img]http://uniseraph.iteye.com/upload/attachment/44670/6162f146-0860-33b1-9bb1-70290c505805.png[/img]
8. 配置libraryies
[img]http://uniseraph.iteye.com/upload/attachment/44672/f01feb7d-3a85-3a19-b7af-8445ce5674f0.png[/img]
9. 在memcached.c的main函数中加一个断点,选择“local c/c++ application” debug
[img]http://uniseraph.iteye.com/upload/attachment/44664/fd81cddc-bdc5-30cb-bdaa-dd886a7a3c3b.png[/img]