gdb:无符号“ i”;在当前情况下 [英] gdb: No symbol "i" in current context

查看:107
本文介绍了gdb:无符号“ i”;在当前情况下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gdb中调试C程序时,我在for循环中有一个断点。我无法打印 i的值(我得到:在当前上下文中没有符号 i。)。我可以打印所有其他变量的值。

While debugging a C program in gdb I have a breakpoint in a for loop. I cannot print the value of "i" ( I get : No symbol "i" in current context.). I can print the value of all the other variables. Is it normal?

这是循环吗?

for (i=0; i < datasize; i++){  
    if ( feature_mask[i] > 0 ){  
        k = feature_mask[i] - 1;  
        if (neighbors[k][nmax-1] != 0){
            neighbors[k][nmax-1] = bvalue;  
            feature_mask[i] = -feature_mask[i];
        }
    }
}


推荐答案

它可能已从编译代码中进行了优化,因为您在循环中仅使用 feature_mask [i]

It has probably been optimised out of your compiled code as you only use feature_mask[i] within the loop.

调用编译器时是否指定了优化级别?如果您使用的是gcc,则只需忽略任何 -O 选项,然后重试。

Did you specify an optimization level when you called your compiler? If you were using gcc, then just omit any -O options and try again.

这篇关于gdb:无符号“ i”;在当前情况下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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