gdb 0x00000000 in ?? () 错误处理

[clug] gdb output

Duncan Roe duncan_roe at acslink.net.au 
Mon Mar 8 04:15:56 GMT 2004

Hi Jim,

Gdb is telling you that the thread is executing at location zero, and that there
is no stack history available because the stack pointer is also zero.

In general, there are only three ways to make the program counter do something
other than move on to the next instruction in sequence: jump, call, and return.

With the displayed symptoms, I would say the most likely candidate of the above
3 is return.

So, you are looking for a function that wrote zeroes over its stack frame and
then tried to return, setting both the program counter and stack frame pointer
to zero.

The function that did the zeroising is not necessarily at fault: you can call
memset to produce the exact scenario for instance:-

 int main(int argc,char**argv)
 {
   int i;
   memset(&i,0,16);
   return 0;
 }

will fail when run under gdb:-

 Program received signal SIGSEGV, Segmentation fault.
 0x00000000 in ?? ()
 (gdb) bt
 #0  0x00000000 in ?? ()
 (gdb)

It wrote 12 bytes beyond the end of "i" and zapped the stack.

I suspect thread 16384 is your initial thread (but I'm not sure). Perhaps "info
threads" will tell you. Anyway, you could try "n"ext through your toplevel until
you find the function call containing the problem. Then breakpoint that function
and repeat the process.

Or maybe if you just audit you memset calls you'll find the problem.

Cheers ... Duncan.

On Fri, Mar 05, 2004 at 08:44:09PM +1100, Jim Watson wrote:
> how would i interpret this output from gdb?
> m received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 16384 (LWP 17669)]
> 0x00000000 in ?? ()
> (gdb) where
> #0  0x00000000 in ?? ()
> (gdb)
>
> jim

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值