我有一个问题,在调用第三方库例程期间,我的进程终止。我完全无法在调试器中捕捉到这一点。这可能与此问题有关:How can I debug a win32 process that unexpectedly terminates silently?。我如何确定为什么我的进程终止
当我将一个调用转入该库时,被调试的进程只是终止。如果这种终止是由于未处理的异常或内存访问冲突造成的,调试器就会发现它。所以我最好的猜测是这个过程以某种方式正常结束。
我曾尝试:
- 上
ExitThread
和设置断点ExitProcess
- 设置处理程序未处理的异常和无效paramters(
set_terminate
和_set_invalid_parameter_handler
) - 更改
_set_abort_behavior
和_set_error_mode
。 - 指示调试器停止对所有抛出的异常执行。
但无济于事,没有处理程序被调用,也没有触发任何断点。
我观察什么: 当进程崩溃,我看到在调试输出窗口两件事情:
没有关系(见下文更新)
我看到EEFileLoadException
被抛出。这个异常的快速谷歌并没有给我一个明确的答案,这个异常意味着什么。First-chance exception at 0x7656b9bc (KernelBase.dll) in Program.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0030b5ac.. First-chance exception at 0x7656b9bc (KernelBase.dll) in Program.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.. First-chance exception at 0x7656b9bc (KernelBase.dll) in Program.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.. First-chance exception at 0x7656b9bc (KernelBase.dll) in Program.exe: 0xE0434352: 0xe0434352.
终止时,所有的线程返回相同的错误代码(STATUS_INVALID_CRUNTIME_PARAMETER)。 就我所知,此错误代码表示其中一个c运行时函数已收到无效参数,并出于安全原因终止了该应用程序。
The thread 'Win32 Thread' (0x12c0) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0xe04) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x53c) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x116c) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x16e0) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x1420) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x13c4) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x40c) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0xc78) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0xd88) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x16c8) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0xcb8) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x584) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x1164) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x1550) has exited with code -1073740777 (0xc0000417). The thread 'Win32 Thread' (0x474) has exited with code -1073740777 (0xc0000417). The program '[5140] Program.exe: Native' has exited with code -1073740777 (0xc0000417).
我真的想知道是什么原因造成这一点,和可选;我怎么能在调试器中捕捉到这个?
更新 关于EEFileLoadException
,它实际上是在节目之前抛出,使导致它终止呼叫,所以它是不相关的进程的终止。
更新 我刚才读的set_terminate
不会在调试工作,所以这是不可能的。正如我在评论中指出的那样,处理程序是按照线程进行管理的,所以我无法访问相关的处理程序。
此外,该程序很可能会崩溃在我无法访问的工作线程中,所以很难设置任何断点/处理程序。
有没有更好的方法来找出哪里出了问题?
我意识到,终止处理程序不叫,因为它们被安装在每个线程的基础,我要崩溃线程的访问权限。 –
我遇到类似的情况,除了我的情况,TRACE消息也没有被传递到输出窗口。当我使用WinDebug进行连接时,发现有一个VS忽略的DebugBreak()调用,导致进程自己终止(),导致程序[0x2F74]'OUTLOOK.EXE'已退出与代码-1073740777(0xc0000417).'不幸的是,我不明白为什么Visual Studio忽略它应该调试的程序。 –