gdb 0x00000000 in 错误处理

这篇博客讨论了在使用gdb调试时遇到的'0x00000000 in'错误,属于clug社区讨论的一部分。文章提到了错误处理的上下文,并分享了相关资源,包括一个人工智能教程,旨在帮助初学者理解并解决此类问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

               

[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 thereis no stack history available because the stack pointer is also zero.In general, there are only three ways to make the program counter do somethingother 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 above3 is return.So, you are looking for a function that wrote zeroes over its stack frame andthen tried to return, setting both the program counter and stack frame pointerto zero.The function that did the zeroising is not necessarily at fault: you can callmemset 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 "infothreads" will tell you. Anyway, you could try "n"ext through your toplevel untilyou find the function call containing the problem. Then breakpoint that functionand 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

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.youkuaiyun.com/jiangjunshow

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值