summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2011-03-01 04:16:27 (GMT)
committerKevin B Kenny <kennykb@acm.org>2011-03-01 04:16:27 (GMT)
commitb153d7d08398bacf50287f086acee27748d21799 (patch)
treefe0d74fb715de8a7a2d9ae7bfd47e54e1114fc38 /win/tclWinFile.c
parent7c4049a13f83930bf6a57ef889abc9e49fa414ec (diff)
parentcd34f84f42b4e64866a9177553e91417ded252a0 (diff)
downloadtcl-b153d7d08398bacf50287f086acee27748d21799.zip
tcl-b153d7d08398bacf50287f086acee27748d21799.tar.gz
tcl-b153d7d08398bacf50287f086acee27748d21799.tar.bz2
merge trunk
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r--win/tclWinFile.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 0334ea6..bdf2b04 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinFile.c,v 1.112.2.4 2010/12/16 01:42:19 kennykb Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.121 2011/01/25 22:33:56 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -175,6 +175,7 @@ static int WinLink(const TCHAR *LinkSource,
const TCHAR *LinkTarget, int linkAction);
static int WinSymLinkDirectory(const TCHAR *LinkDirectory,
const TCHAR *LinkTarget);
+MODULE_SCOPE void tclWinDebugPanic(const char *format, ...);
/*
*--------------------------------------------------------------------
@@ -786,9 +787,10 @@ NativeWriteReparse(
/*
*----------------------------------------------------------------------
*
- * WishPanic --
+ * tclWinDebugPanic --
*
- * Display a message.
+ * Display a message. If a debugger is present, present it directly
+ * to the debugger, otherwise use a MessageBox.
*
* Results:
* None.
@@ -799,8 +801,8 @@ NativeWriteReparse(
*----------------------------------------------------------------------
*/
-static void
-PanicMessageBox(
+void
+tclWinDebugPanic(
const char *format, ...)
{
#define TCL_MAX_WARN_LEN 1024
@@ -809,7 +811,7 @@ PanicMessageBox(
WCHAR msgString[TCL_MAX_WARN_LEN];
va_start(argList, format);
- vsnprintf(buf, sizeof(buf), format, argList);
+ _vsnprintf(buf, sizeof(buf), format, argList);
msgString[TCL_MAX_WARN_LEN-1] = L'\0';
MultiByteToWideChar(CP_UTF8, 0, buf, -1, msgString, TCL_MAX_WARN_LEN);
@@ -820,19 +822,15 @@ PanicMessageBox(
if (msgString[TCL_MAX_WARN_LEN-1] != L'\0') {
memcpy(msgString + (TCL_MAX_WARN_LEN - 5), L" ...", 5 * sizeof(WCHAR));
}
+ if (IsDebuggerPresent()) {
+ OutputDebugStringW(msgString);
+ } else {
MessageBeep(MB_ICONEXCLAMATION);
MessageBoxW(NULL, msgString, L"Fatal Error",
MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND);
- /* try to trigger the debugger */
-# ifdef __GNUC__
- __builtin_trap();
-# endif
-# ifdef _MSC_VER
- DebugBreak();
-# endif
- ExitProcess(1);
+ }
}
-
+
/*
*---------------------------------------------------------------------------
*
@@ -862,7 +860,7 @@ TclpFindExecutable(
* create this process. Only if it is NULL, install a new panic handler.
*/
if (argv0 == NULL) {
- Tcl_SetPanicProc(PanicMessageBox);
+ Tcl_SetPanicProc(tclWinDebugPanic);
}
#ifdef UNICODE