简体   繁体   中英

Program execution continues after procdump created a dump on an exception

I am throwing an exception throw std::exception("dummy") (as a test) which is not being caught anywhere.
Without ProcDump attached this immediately crashes the process as it should.

When I attach ProcDump with -e to a debug build, ProcDump properly detects the unhandled exception, creates a crash dump, and exits. But the program continues executing as if the exception has never been thrown.

I could manually crash the process after ProcDump exits but I really don't like the idea that code continues to run after a crash that is supposed to be fatal even if it is just for a few ms.

What causes this? How can I make sure that my program crashes (and the crash dump properly represents the point of the crash)? Is this an issue with ProcDump or with how I am using it?

Here is a minimal example to reproduce this:

#include <iostream>

int main() {
    char c;
    std::cin >> c;
    if (c == 'e')
        throw std::exception("dummy");
    std::cout << "clean exit" << std::endl;
    return 0;
}

I've tried it with m$ clang-cl and msvc. I've tried every single ProcDump switch even vaguely relevant to my issue in all possible combinations with multiple binaries.

I don't have a good answer, unfortunately. It looks that there is a bug in procdump. You may report it on theSysinternals forum or contact Mark Russinovich (@markrussinovich) or Andrew Richards (@arichardmsft). I can confirm that it happens when you attach to the process, for example, procdump -e prog . It behaves as expected when you run the app under procdump ( procdump.exe -e -x. prog.exe ). Procdump runs as a debugger attached to a process, so it might 'swallow' exceptions. Of course, it should not, but the API allows it to do so.

As an alternative, before procdump gets fixed, you may consider using minidumper (I contributed to it in the past). It does not have as many command-line options as procdump, but the -e option works as expected, for example, MiniDumper.exe -ma -e2 12824 .

Internally, minidumper has a very similar design to procdump and also implements a debugger engine. Here is the line handling the exception event: https://github.com/goldshtn/minidumper/blob/master/MiniDumper/Debugger.cs#L106 .

Try using the -k option on ProcDump.

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