本文介绍了不受管理的堆栈溢出:IP:0x26eb76,故障地址:0xbf808ffc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Mono应用程序在Mac上崩溃,并显示以下消息( 完整日志):

My Mono application crashes on Mac with this message (Full log):

$ mono --debug bin/Debug/SparkleShare.app/Contents/MonoBundle/SparkleShare.exe
[...]
Stack overflow in unmanaged: IP: 0x26eb76, fault addr: 0xbf808ffc
[...]

处于非托管状态"表示堆栈溢出不是在我的代码中(我只有托管代码),而是在我嵌入的库中( SQLite,DotCmis,NewtonSoft.Json )或使用Mono的代码.

"in unmanaged" implies that the stack overflow is not in my code (I only have managed code) but rather in a library I embed (SQLite, DotCmis, NewtonSoft.Json) or in Mono's code.

即使我在Debug模式下编译并运行,我得到的还是这两个十六进制数.

Even though I compile and run in Debug mode, all I get is these two hexadecimals.

问题::如何调查此堆栈溢出?有什么把戏吗?

QUESTION: How can I investigate this stack overflow? Any trick?

注意:相同的库(几乎相同的代码)在Linux和Windows上运行良好.

推荐答案

处理堆栈溢出是非常棘手的(对于mono),因此很有可能是堆栈溢出实际上是您的.问题在于找出堆栈跟踪.

Handling stack overflow is quite tricky (for mono), so it might very well be that the stack overflow is actually yours. The problem lies in figuring out the stack trace.

我通常与gdb一起运行:

I usually run with gdb:

gdb --args mono --debug bin/Debug/SparkleShare.app/Contents/MonoBundle/SparkleShare.exe

然后尝试在堆栈开始增长之后但实际上没有溢出之前按Ctrl + C(gdb与堆栈溢出严重混淆,通常必须在发生这种情况时退出gdb,这就是为什么您需要赶快行动起来吧.

And then try to hit Ctrl+C after the stack has begun to grow, but before it has actually overflown (gdb gets seriously confused with stack overflows, and you'll usually have to exit gdb when that happens, which is why you'll need to catch the overflow in action).

按Ctrl + C后,执行thread apply all backtrace,您将知道堆栈是否即将发生溢出(一个线程将具有数千帧).

After hitting Ctrl+C, do a thread apply all backtrace, and you'll know if a stack overflow is about to happen (one thread will have thousands of frames).

一旦gdb中有大量堆栈跟踪,就需要确定循环.仅通过查看堆栈跟踪的地址,这通常非常容易.一旦获得了这些数据,就可以像下面这样获得托管框架:

Once you have an enormous stack trace in gdb, you need to identify the cycle. This is usually quite easy just by looking at the addresses of the stack trace. Once you have this data, you can get the managed frame like this:

(gdb) p mono_pmip (0xdeaddead)
$1 = 0x0000dead  "Managed frame information shows up here"

然后对找到的循环中的所有帧都执行相同操作.

Then just do the same for all the frames in the cycle you found.

在gdb 此处中,有更多有关调试Mono的提示.

There are more tips for debugging mono with gdb here.

这篇关于不受管理的堆栈溢出:IP:0x26eb76,故障地址:0xbf808ffc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 06:44