From 627e4077fec79059bce211956e1fbbc3905fb8b6 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Wed, 1 Dec 2010 10:43:36 +0000 Subject: Allow Tcl_Panic() to enter the debugger on win32 --- ChangeLog | 3 ++- generic/tclCkalloc.c | 14 +++----------- generic/tclPanic.c | 7 ++++++- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 450b2ca..1a0f605 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ * generic/tclThreadTest.c: * generic/tclStrToD.c: fix gcc(-4.5.2) warning: 'static' is not at beginning of declaration. + * generic/tclPanic.c: Allow Tcl_Panic() to enter the debugger on win32 + * generic/tclCkalloc.c: use Tcl_Panic() in stead of duplicating the code. 2010-11-30 Jeff Hobbs @@ -22,7 +24,6 @@ ("injects") arbitrary code to a suspended coro's future resumption. Neat for debugging complex coros without heavy instrumentation. ->>>>>>> 1.5314 2010-11-29 Kevin B. Kenny * generic/tclInt.decls: diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 872053b..dbd999e 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -14,7 +14,7 @@ * * This code contributed by Karl Lehenbauer and Mark Diekhans * - * RCS: @(#) $Id: tclCkalloc.c,v 1.40 2010/11/08 09:02:50 ferrieux Exp $ + * RCS: @(#) $Id: tclCkalloc.c,v 1.41 2010/12/01 10:43:36 nijtmans Exp $ */ #include "tclInt.h" @@ -453,11 +453,7 @@ Tcl_DbCkalloc( if (break_on_malloc && (total_mallocs >= break_on_malloc)) { break_on_malloc = 0; (void) fflush(stdout); - fprintf(stderr,"reached malloc break limit (%d)\n", - total_mallocs); - fprintf(stderr, "program will now enter C debugger\n"); - (void) fflush(stderr); - abort(); + Tcl_Panic("reached malloc break limit (%d)", total_mallocs); } current_malloc_packets++; @@ -546,11 +542,7 @@ Tcl_AttemptDbCkalloc( if (break_on_malloc && (total_mallocs >= break_on_malloc)) { break_on_malloc = 0; (void) fflush(stdout); - fprintf(stderr,"reached malloc break limit (%d)\n", - total_mallocs); - fprintf(stderr, "program will now enter C debugger\n"); - (void) fflush(stderr); - abort(); + Tcl_Panic("reached malloc break limit (%d)", total_mallocs); } current_malloc_packets++; diff --git a/generic/tclPanic.c b/generic/tclPanic.c index b3a5ed6..9aa0627 100644 --- a/generic/tclPanic.c +++ b/generic/tclPanic.c @@ -12,7 +12,7 @@ * 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 2009/07/22 19:54:50 nijtmans Exp $ + * RCS: @(#) $Id: tclPanic.c,v 1.15 2010/12/01 10:43:36 nijtmans Exp $ */ #include "tclInt.h" @@ -90,7 +90,12 @@ Tcl_PanicVA( arg8); fprintf(stderr, "\n"); fflush(stderr); +#ifdef _WIN32 + DebugBreak(); + ExitProcess(1); +#else abort(); +#endif } } -- cgit v0.12