2

Below is a code snippet where I deliberately cause 2 NullPointerException. The first one is handled. Whereas the second one goes unhandled. I want to create a crash dump on the second exception when a crash would occur.

int* nullPtr = NULL;
try{
    x = *nullPtr;
} 
catch(...) {
    QLOG_WARNING0(QTEXT("catching 1st null ptr exception."));
}
y = *nullPtr;

This does crash the process but the dump is not generated using -e option only. What options should I use to get the dump?

Or is there a way I could achieve this with debugDiag tool? If so, how?

This is only a sample code. The actual use case I am debugging has a process crashing but I am unable to take dumps for the crash. There are valid handled exceptions where the dump is getting triggerred in case I use the first chance option( - e 1). This is causing procdump to exit before the actual crash occurs.

Rajeev Ranjan
  • 3,588
  • 6
  • 28
  • 52
  • Are you required to use Procdump? There are other ways to collect a crash dump. – rrirower Oct 31 '16 at 14:51
  • No I am open to any other tool. I did find out "debugDiag" for instance, but unable to solve my purpose with this either(given my level of expertise). There could be a way out with these or maybe some other tool. – Rajeev Ranjan Oct 31 '16 at 16:05

1 Answers1

0

“No I am open to any other tool.”

Per your comment, there are other ways to trap a dump file. In my answer to Getting detailed crash dumps from a hooked exe, you’ll see that you can set some registry key settings to trap the dump from an unhandled exception. The settings assume you have Windows Error Reporting enabled. I’ve gone so far as to incorporate those settings into a small utility program that my company uses when debugging difficult customer crashes.

Community
  • 1
  • 1
rrirower
  • 4,338
  • 4
  • 27
  • 45