您好,登錄后才能下訂單哦!
小編給大家分享一下gdb如何調試ceph的radosgw,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
#gdb調試 rgw
修改gdb配置,設置為保存歷史命令,p變量美化輸出等
[root@ceph04 src]# cat ~/.gdbinit set history save on set print pretty on set pagination off set 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 ceph root 10486 1.5 0.1 404376 201076 pts/2 Sl 11:40 1:22 ./ceph-mon -i a -c /home/yuliyang/ceph/src/ceph.conf root 10501 0.9 0.1 413592 202224 pts/2 Sl 11:40 0:54 ./ceph-mon -i b -c /home/yuliyang/ceph/src/ceph.conf root 10520 0.9 0.1 413592 201968 pts/2 Sl 11:40 0:51 ./ceph-mon -i c -c /home/yuliyang/ceph/src/ceph.conf root 10854 0.6 0.1 899744 226972 ? Ssl 11:40 0:35 ./ceph-osd -i 0 -c /home/yuliyang/ceph/src/ceph.conf root 11067 0.6 0.1 899748 226280 ? Ssl 11:40 0:34 ./ceph-osd -i 1 -c /home/yuliyang/ceph/src/ceph.conf root 11304 0.5 0.1 898720 222624 ? Ssl 11:40 0:31 ./ceph-osd -i 2 -c /home/yuliyang/ceph/src/ceph.conf root 11634 0.0 0.1 351560 157888 ? Ssl 11:40 0:01 ./ceph-mds -i a -c /home/yuliyang/ceph/src/ceph.conf root 11723 0.0 0.1 383336 164808 ? Ssl 11:40 0:03 ./ceph-mds -i b -c /home/yuliyang/ceph/src/ceph.conf root 11826 0.0 0.1 351556 158000 ? Ssl 11:40 0:01 ./ceph-mds -i c -c /home/yuliyang/ceph/src/ceph.conf root 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=1 root 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_request Breakpoint 1 at 0x7f465253ea20: file rgw/rgw_process.cc, line 37. (gdb) b rgw/rgw_process.cc:38 Breakpoint 2 at 0x7f465253ea2f: file rgw/rgw_process.cc, line 38. (gdb) b rgw/rgw_process.cc:39 Breakpoint 3 at 0x7f465253ea39: file rgw/rgw_process.cc, line 39.
運行
(gdb) c Continuing. [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) c Continuing. [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:37 37 { (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) list 56 s->obj_ctx = &rados_ctx; 57 58 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; 61 62 req->log_format(s, "initializing for trans_id = %s", s->trans_id.c_str()); 63 64 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' <repeats 20 times>, "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”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。