简体   繁体   中英

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. 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 . 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. 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. We want to release this software soon and this bug MUST dissappear.

Use Windbg instead, that is a hard-core debugger that hides nothing and exposes things 'as they are'. Using sxe syntax enable the desired exception (Windgb will enable to break at any SEH type, not only C++). Windbg also has a clear distinction between first chance exception and second chance exception. You should figure out then whether this is a C++ exception being raise or a more fundamental SEH type like perhaps an AV.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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