aboutsummaryrefslogtreecommitdiffstats
path: root/epan/except.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2006-01-22 16:32:45 +0000
committerUlf Lamping <ulf.lamping@web.de>2006-01-22 16:32:45 +0000
commit6f2c4c84c14b7c56d72abd648378ef6b3a9cc4da (patch)
treee8c0f5e85921d3f99e99103845a314bfa3e2ec14 /epan/except.c
parent35dd233580b699562636e2f870d59d66cddc68b9 (diff)
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
Diffstat (limited to 'epan/except.c')
-rw-r--r--epan/except.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/epan/except.c b/epan/except.c
index 692127fa16..103f6e94e2 100644
--- a/epan/except.c
+++ b/epan/except.c
@@ -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);
}