[英]How do I debug exceptions in unknown code?
I have a program that uses external libraries. 我有一个使用外部库的程序。 One of the libraries (responsible for a camera hardware) starts a thread and crashes unpredictably.
其中一个库(负责相机硬件)启动一个线程并且无法预测崩溃。 Sometimes every 2 minutes, sometimes not for an hour.
有时每2分钟,有时不会持续一个小时。 There's no obvious trigger.
没有明显的触发因素。 The exception is not caught be the thread, which leads to a termination of the application.
线程没有捕获异常,导致应用程序终止。 :(
:(
Luckily I can stop the application in the moment the exception is raised by the RaiseException()
function from the kernel32.dll
. 幸运的是,我可以在
kernel32.dll
的RaiseException()
函数引发异常时停止应用程序。 There are no other functions on the call stack of which I know what they are for. 调用堆栈上没有其他函数,我知道它们的用途。
The debugger told me, that it's a std::bad_alloc exception. 调试器告诉我,这是一个std :: bad_alloc异常。 How does the debugger know that?
调试器如何知道? Can I get more information about the exception somehow?
我可以以某种方式获得有关异常的更多信息吗? If necessary, I would look into the Disassembly, but I don't know where to look to get the information.
如果有必要,我会查看反汇编,但我不知道从哪里获取信息。
I'm using Visual Studio C++ 2010, am well acquainted with assembler and have some understanding of the WINAPI. 我正在使用Visual Studio C ++ 2010,熟悉汇编程序并对WINAPI有所了解。 We want to release this software soon and this bug MUST dissappear.
我们想尽快发布这个软件,这个bug必须消失。
Use Windbg instead, that is a hard-core debugger that hides nothing and exposes things 'as they are'. 使用Windbg代替,这是一个硬核调试器,它不会隐藏任何东西,并且“按原样”暴露事物。 Using
sxe
syntax enable the desired exception (Windgb will enable to break at any SEH type, not only C++). 使用
sxe
语法启用所需的异常(Windgb将允许在任何SEH类型中断,而不仅仅是C ++)。 Windbg also has a clear distinction between first chance exception and second chance exception. Windbg还明确区分了第一次机会异常和第二次机会异常。 You should figure out then whether this is a C++ exception being raise or a more fundamental SEH type like perhaps an AV.
你应该弄清楚这是一个C ++异常被提升还是更基本的SEH类型,比如AV。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.