gdb 堆栈溢出
假设我正常运行一个程序,它调用某个函数(比如 A() ),该函数递归地调用自身,直到堆栈溢出(这发生在 A() 被调用大约 10 次之后)。如果我在gdb下运行同一个程序,即使递归调用A()超过20次,堆栈也不会溢出。是因为我在gdb下运行它才发生这种情况,还是有其他原因?
编辑:我将复制粘贴我获得的回溯,有任何迹象表明为什么会发生段错误吗?更大的问题是我如何找到它?
Assume I run a program normally, it calls a certain function (say A() ) which calls itself recursively until the stack overflows (This happened after A() got called for some 10 times) . If I run the same program under gdb, even after A() was called for more than 20 times recursively, the stack did not overflow. Is it because that I ran it under gdb that this happened, or is there any other reason?
EDIT: I'll copy paste the backtrace i obtained, Any indications to why the seg fault occured? And the bigger question is how do I locate it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
允许的递归调用数量不取决于编译器或调试器。它受到堆栈大小的限制。假设程序在同一操作系统上运行,我不确定递归调用的数量在您的情况下有所不同。
Number of recursive calls allowed doesn't depend on compiler or the debugger. It is limited to the size of the stack. Assuming the program is run on same operating system, I amn't sure though about the number of recursive calls differs in your case.