gdb,为什么“下一个”显示每个源代码行两次? [英] gdb,why "next" show each source line twice?

查看:140
本文介绍了gdb,为什么“下一个”显示每个源代码行两次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家,当在gdb中使用next指令时,我发现源代码的每行显示两次-----我确定这些代码不在任何循环中。这是现象:

 (gdb)frame 
#0 ap_get_client_block(r = 0x8560d48,
buffer = 0xb68501b7<?xml version = < Root>< OperCode> SMS101< / OperCode>< AppId> SMSMsgFilterReq< / AppId>< Req>< UserMobile> 13925237429< / UserMobile>< SENDMSG> ABC圲34圲23A露07\214圲21¢<237朲11东215圲10°<214朲27¥応227露07\214正常,浩?。 ...,bufsiz = 81920)at http_filters.c:1540
1540 if(r->剩余< 0 ||(!r-> read_chunked&& r->剩余== 0) ){
(gdb)n
1544 bb = apr_brigade_create(r-> pool,r-> connection-> bucket_alloc); (bb == NULL){
(gdb)
1544 bb = apr_brigade_create(r-> pool,r-> connection-> bucket_alloc);
(gdb)
1545 if(bb == NULL){

- ---- 1544,1545行不在任何循环中,但它们重复。
有人能给我什么启发吗?

解决方案



即使是最低级别的优化,也可能导致您的调试程序像编译器内联,重新排序以及通常使用您的代码一样疯狂地绕过源代码行。


everyone,when use "next" instruction within gdb,i found each line of sourcecode display twice-----i am quite sure,these code are not in any loop.this is the phenomenon:

(gdb) frame
#0  ap_get_client_block (r=0x8560d48, 
    buffer=0xb68501b7 "<?xml version=\"1.0\" encoding=\"utf-8\"?><Root><OperCode>SMS101</OperCode><AppId>SMSMsgFilterReq</AppId><Req><UserMobile>13925237429</UserMobile><SendMsg>abc圲34¨圲23a露07\214圲21¢<237朲11?东215圲10°<214朲27¥応227露07\214正常,hao"..., bufsiz=81920) at http_filters.c:1540
1540        if (r->remaining < 0 || (!r->read_chunked && r->remaining == 0)) {
(gdb) n
1544        bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
(gdb) 
1545        if (bb == NULL) {
(gdb) 
1544        bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
(gdb) 
1545        if (bb == NULL) {

-----the line 1544,1545 are not in any loop,but they got repeated. May anybody enlighten me?

解决方案

What level of optimisation did you have when you compiled this?

Even a minimal level of optimisation can cause your debugger to jump around the source lines like crazy as the compiler inlines, reorders and generally plays with your code.

这篇关于gdb,为什么“下一个”显示每个源代码行两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆