简体   繁体   English

gdb stackoverflow

[英]gdb stackoverflow

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) . 假设我正常运行一个程序,它会调用某个函数(例如A()),该函数递归地调用自身,直到堆栈溢出(这在A()被调用10次之后发生)。 If I run the same program under gdb, even after A() was called for more than 20 times recursively, the stack did not overflow. 如果我在gdb下运行相同的程序,即使递归调用A()20次以上,堆栈也不会溢出。 Is it because that I ran it under gdb that this happened, or is there any other reason? 是因为我在gdb下运行了它,还是有其他原因?

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? 更大的问题是如何找到它?

在此处输入图片说明

Is it because that I ran it under gdb that this happened, or is there any other reason? 是因为我在gdb下运行了它,还是有其他原因?

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. 假设程序在同一操作系统上运行,我不确定递归调用的数量在您的情况下是否有所不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM