diff options
| author | Kevin B Kenny <kennykb@acm.org> | 2011-03-01 04:16:27 (GMT) |
|---|---|---|
| committer | Kevin B Kenny <kennykb@acm.org> | 2011-03-01 04:16:27 (GMT) |
| commit | b153d7d08398bacf50287f086acee27748d21799 (patch) | |
| tree | fe0d74fb715de8a7a2d9ae7bfd47e54e1114fc38 /generic/tclPanic.c | |
| parent | 7c4049a13f83930bf6a57ef889abc9e49fa414ec (diff) | |
| parent | cd34f84f42b4e64866a9177553e91417ded252a0 (diff) | |
| download | tcl-b153d7d08398bacf50287f086acee27748d21799.zip tcl-b153d7d08398bacf50287f086acee27748d21799.tar.gz tcl-b153d7d08398bacf50287f086acee27748d21799.tar.bz2 | |
merge trunk
Diffstat (limited to 'generic/tclPanic.c')
| -rw-r--r-- | generic/tclPanic.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/generic/tclPanic.c b/generic/tclPanic.c index e8c1257..3a48afa 100644 --- a/generic/tclPanic.c +++ b/generic/tclPanic.c @@ -12,10 +12,13 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPanic.c,v 1.14.4.2 2010/12/16 01:42:18 kennykb Exp $ + * RCS: @(#) $Id: tclPanic.c,v 1.21 2011/01/12 20:17:03 nijtmans Exp $ */ #include "tclInt.h" +#ifdef _WIN32 + MODULE_SCOPE void tclWinDebugPanic(const char *format, ...); +#endif /* * The panicProc variable contains a pointer to an application specific panic @@ -44,6 +47,10 @@ void Tcl_SetPanicProc( Tcl_PanicProc *proc) { +#ifdef _WIN32 + /* tclWinDebugPanic only installs if there is no panicProc yet. */ + if ((proc != tclWinDebugPanic) || (panicProc == NULL)) +#endif panicProc = proc; } @@ -84,6 +91,10 @@ Tcl_PanicVA( if (panicProc != NULL) { panicProc(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); +#ifdef _WIN32 + } else if (IsDebuggerPresent()) { + tclWinDebugPanic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); +#endif } else { fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); @@ -91,7 +102,20 @@ Tcl_PanicVA( fflush(stderr); } /* In case the users panic proc does not abort, we do it here */ +#ifdef _WIN32 +# if defined(__GNUC__) + __builtin_trap(); +# elif defined(_WIN64) + __debugbreak(); +# elif defined(_MSC_VER) + _asm {int 3} +# else + DebugBreak(); +# endif + ExitProcess(1); +#else abort(); +#endif } /* |
