Win32: call an existing debugger if a DissectorError is thrown. This preserves the call stack of the bug making debugging much easier.

This can't be done in every error throwing case, as e.g. throwing a ReportedBoundsError might happen a lot even if no bugs are involved. Anyway, extending this to other errors can be done manually while debugging.

svn path=/trunk/; revision=17072
This commit is contained in:
Ulf Lamping 2006-01-22 16:32:45 +00:00
parent 35dd233580
commit 6f2c4c84c1
1 changed files with 13 additions and 0 deletions

View File

@ -33,6 +33,13 @@
#include <limits.h>
#include "except.h"
#ifdef _WIN32
/* IsDebuggerPresent() needs this #define! */
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "exceptions.h"
#endif
#define XCEPT_BUFFER_SIZE 1024
#ifdef KAZLIB_RCSID
@ -268,6 +275,12 @@ void except_throw(long group, long code, const char *msg)
except.except_message = msg;
except.except_dyndata = 0;
#ifdef _WIN32
if (code == DissectorError && IsDebuggerPresent()) {
DebugBreak();
}
#endif
do_throw(&except);
}