Stack overflow in unmanaged: IP: 0x26eb76, fault addr: 0xbf808ffc

萝らか妹 提交于 2019-12-04 02:40:41

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.

I usually run with gdb:

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

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).

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).

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.

There are more tips for debugging mono with gdb here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!