gdb如何调试ceph的radosgw
发表于:2025-01-23 作者:千家信息网编辑
千家信息网最后更新 2025年01月23日,小编给大家分享一下gdb如何调试ceph的radosgw,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!#gdb调试 rgw修改gdb配置,设置为保存历史命令,p变量美化输出等[roo
千家信息网最后更新 2025年01月23日gdb如何调试ceph的radosgw
小编给大家分享一下gdb如何调试ceph的radosgw,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
#gdb调试 rgw
修改gdb配置,设置为保存历史命令,p变量美化输出等
[root@ceph04 src]# cat ~/.gdbinitset history save on set print pretty onset pagination offset confirm off
切换到ceph04(10.254.3.81)的/home/yuliyang/ceph/src [root@ceph04 src]# pwd /home/yuliyang/ceph/src 使用vstart方式启动一个集群
./vstart.sh -d -n -X -r --short
创建admin用户
./radosgw-admin user create --uid=admin --display-name=admin --access-key=admin --secret=admin
rgw在8000端口 ps查看进程号
[root@ceph04 src]# ps aux|grep cephroot 10486 1.5 0.1 404376 201076 pts/2 Sl 11:40 1:22 ./ceph-mon -i a -c /home/yuliyang/ceph/src/ceph.confroot 10501 0.9 0.1 413592 202224 pts/2 Sl 11:40 0:54 ./ceph-mon -i b -c /home/yuliyang/ceph/src/ceph.confroot 10520 0.9 0.1 413592 201968 pts/2 Sl 11:40 0:51 ./ceph-mon -i c -c /home/yuliyang/ceph/src/ceph.confroot 10854 0.6 0.1 899744 226972 ? Ssl 11:40 0:35 ./ceph-osd -i 0 -c /home/yuliyang/ceph/src/ceph.confroot 11067 0.6 0.1 899748 226280 ? Ssl 11:40 0:34 ./ceph-osd -i 1 -c /home/yuliyang/ceph/src/ceph.confroot 11304 0.5 0.1 898720 222624 ? Ssl 11:40 0:31 ./ceph-osd -i 2 -c /home/yuliyang/ceph/src/ceph.confroot 11634 0.0 0.1 351560 157888 ? Ssl 11:40 0:01 ./ceph-mds -i a -c /home/yuliyang/ceph/src/ceph.confroot 11723 0.0 0.1 383336 164808 ? Ssl 11:40 0:03 ./ceph-mds -i b -c /home/yuliyang/ceph/src/ceph.confroot 11826 0.0 0.1 351556 158000 ? Ssl 11:40 0:01 ./ceph-mds -i c -c /home/yuliyang/ceph/src/ceph.confroot 12282 0.1 0.1 12470764 209416 ? Ssl 11:40 0:05 /home/yuliyangceph/src/.libs/lt-radosgw -c /home/yuliyang/ceph/src/ceph.conf --log-file=/home/yuliyang/ceph/src/out/rgw.log --debug-rgw=20 --debug-ms=1root 22717 0.0 0.0 112648 952 pts/2 S+ 13:11 0:00 grep --color=auto ceph
attach进程
gdb attach 12282
打断点
(gdb) b process_requestBreakpoint 1 at 0x7f465253ea20: file rgw/rgw_process.cc, line 37.(gdb) b rgw/rgw_process.cc:38Breakpoint 2 at 0x7f465253ea2f: file rgw/rgw_process.cc, line 38.(gdb) b rgw/rgw_process.cc:39Breakpoint 3 at 0x7f465253ea39: file rgw/rgw_process.cc, line 39.
运行
(gdb) cContinuing.[New Thread 0x7f462c7f8700 (LWP 23422)][Thread 0x7f463c1ae700 (LWP 21983) exited][Thread 0x7f463c5b2700 (LWP 21980) exited][New Thread 0x7f465c472700 (LWP 23425)]
卡住在此。。。 执行创建100个桶,间隔1000s
for i in `seq 1 100`;do s3cmd -c yuliyang.s3cfg mb s3://test-$i ;sleep 1000 ;done;
在断点处停住
(gdb) cContinuing.[New Thread 0x7f462c7f8700 (LWP 23422)][Thread 0x7f463c1ae700 (LWP 21983) exited][Thread 0x7f463c5b2700 (LWP 21980) exited][New Thread 0x7f465c472700 (LWP 23425)][Switching to Thread 0x7f453affd700 (LWP 12363)]Breakpoint 1, process_request (store=0x7f465dd42840, rest=0x7ffd760c17e0, req=0x7f453affa800, client_io=0x7f453affa940, olog=0x0) at rgw/rgw_process.cc:3737 {(gdb)
ctr x a 打开tui 发现停在断点处
n下一步,继续若干n后
查看userinfo
(gdb) p userinfo$2 = { auid = 0, user_id = { tenant = "", id = "" }, display_name = "", user_email = "", access_keys = std::map with 0 elements, swift_keys = std::map with 0 elements, subusers = std::map with 0 elements, suspended = 0 '\000', max_buckets = 1000, op_mask = 7, caps = { caps = std::map with 0 elements }, system = 0 '\000', default_placement = "", placement_tags = empty std::list, bucket_quota = { max_size_kb = -1, max_objects = -1, enabled = false, max_size_soft_threshold = -1, max_objs_soft_threshold = -1 }, temp_url_keys = std::map with 0 elements, user_quota = { max_size_kb = -1, max_objects = -1, enabled = false, max_size_soft_threshold = -1, max_objs_soft_threshold = -1 }}
list查看当前断点处周围的代码
(gdb) list56 s->obj_ctx = &rados_ctx;5758 s->req_id = store->unique_id(req->id);59 s->trans_id = store->unique_trans_id(req->id);60 s->host_id = store->host_id;6162 req->log_format(s, "initializing for trans_id = %s", s->trans_id.c_str());6364 RGWOp* op = NULL;65 int init_error = 0;
继续n执行,查看*s变量
(gdb) p *s$3 = { cct = 0x7f465dcc5e10, cio = 0x0, req = 0x6, op = OP_UNKNOWN, op_type = RGW_OP_UNKNOWN, content_started = false, format = 0, formatter = 0x0, decoded_uri = "", relative_uri = "", length = 0x0, content_length = 0, generic_attrs = std::map with 0 elements, err = { http_ret = 200, ret = 0, s3_code = "", message = "" }, expect_cont = false, header_ended = false, obj_size = 0, enable_ops_log = false, enable_usage_log = false, defer_to_bucket_acls = 0 '\000', perm_mask = 0, header_time = { tv = { tv_sec = 0, tv_nsec = 0 } }, account_name = "", bucket_tenant = "", bucket_name = "", bucket = { tenant = "", name = "", data_pool = "", data_extra_pool = "", index_pool = "", marker = "", bucket_id = "", oid = "" }, object = { name = "", instance = "" }, src_tenant_name = "", src_bucket_name = "", src_object = { name = "", instance = "" }, bucket_owner = { id = { tenant = "", id = "" }, display_name = "" }, owner = { id = { tenant = "", id = "" }, display_name = "" }, zonegroup_name = "", zonegroup_endpoint = "", bucket_instance_id = "", bucket_instance_shard_id = -1, redirect = "", bucket_info = { bucket = { tenant = "", name = "", data_pool = "", data_extra_pool = "", index_pool = "", marker = "", bucket_id = "", oid = "" }, owner = { tenant = "", id = "" }, flags = 0, zonegroup = "", creation_time = { __d = { __r = 0 } }, placement_rule = "", has_instance_obj = false, objv_tracker = { read_version = { ver = 0, tag = "" }, write_version = { ver = 0, tag = "" } }, ep_objv = { ver = 0, tag = "" }, quota = { max_size_kb = -1, max_objects = -1, enabled = false, max_size_soft_threshold = -1, max_objs_soft_threshold = -1 }, num_shards = 0, bucket_index_shard_hash_type = 0 '\000', static NUM_SHARDS_BLIND_BUCKET = 4294967295, requester_pays = false, has_website = false, website_conf = { redirect_all = { protocol = "", hostname = "", http_redirect_code = 0 }, index_doc_suffix = "", error_doc = "", routing_rules = { rules = empty std::list } }, index_type = (unknown: 805334416), swift_versioning = false, swift_ver_location = "" }, bucket_attrs = std::map with 0 elements, bucket_exists = false, has_bad_meta = false, user = 0x7f453affa060, bucket_acl = 0x0, object_acl = 0x0, system_request = false, aws4_auth_needs_complete = false, aws4_auth = 0x0, canned_acl = "", has_acl_header = false, http_auth = 0x0, local_source = false, prot_flags = 0, os_auth_token = 0x0, swift_user = "", swift_groups = "", content_disp = { override = "", fallback = "" }, host_id = "", info = { env = 0x7f453affa950, args = { str = "", empty_str = "", val_map = std::map with 0 elements, sys_val_map = std::map with 0 elements, sub_resources = std::map with 0 elements, has_resp_modifier = false, admin_subresource_added = false }, x_meta_map = std::map with 0 elements, host = "127.0.0.1", method = 0x7f4530017e38 "PUT", script_uri = "/test-1/", 请求创建的桶名字 request_uri = "/test-1/", request_uri_aws4 = "", effective_uri = "", request_params = "", domain = "" }, init_state = { url_bucket = "", src_bucket = "" }, time = { tv = { tv_sec = 1470979550, tv_nsec = 592751627 } }, obj_ctx = 0x0, dialect = "", req_id = "", trans_id = ""}
查看结构体*s的其他信息
(gdb) p (*s).req_id$4 = "8e78e271-aa38-4121-bfc5-c9a74b816fc5.4115.9"(gdb) p (*s).trans_id$5 = "tx", '0', "9-0057ad5e60-1013-default"(gdb) p (*s).host_id $6 = ""
继续n,直到get_handler函数,按s进入函数
因为是put类型
直接break退出 查看op类型是create_bucket
查看当前线程
(gdb) thread
[Current thread is 106 (Thread 0x7f4538ff9700 (LWP 12367))]
q退出
看完了这篇文章,相信你对"gdb如何调试ceph的radosgw"有了一定的了解,如果想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!
断点
函数
变量
篇文章
类型
进程
代码
信息
历史
名字
命令
完了
方式
更多
用户
知识
端口
线程
结构
行业
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络安全基础知识
骑士精神2玩哪个服务器
php本地服务器
免费的服务器防护
为什么用mysql数据库
九台区品质网络技术口碑推荐
软件开发公司软件知识产权
大型网络服务器
电脑读取树莓派数据库
非法动用网络技术侦查
软件开发月度总结ppt
田野网络安全
宁夏银川oa软件开发贵吗
网络安全宣传的主要内容
软件开发小组名字
微信小程序如何解决数据库问题
php 数组 数据库
unix web服务器
什么文件可以导入当前数据库
网络安全实行什么保护
电视盒子做游戏服务器
南宁软件开发哪个公司好
网络安全产品类型
广州嵌入式软件开发流程费用
网络技术员提成制度
维护国家网络安全知识
微信红包软件开发大概多少钱
服务器硬件知识
unix web服务器
科技和互联网的发展对旅游的影响