You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/04/02 13:16:39 UTC

svn commit: r930239 - /subversion/trunk/subversion/libsvn_subr/cmdline.c

Author: rhuijben
Date: Fri Apr  2 11:16:39 2010
New Revision: 930239

URL: http://svn.apache.org/viewvc?rev=930239&view=rev
Log:
Following up upon r930191, also redirect CRT messages to STDERR
on Windows when compiling in _DEBUG modes, to allow continuing the
testsuite on this class of errors.

* subversion/libsvn_subr/cmdline.c
  (includes): Include crtdbg.h on Windows.
  (svn_cmdline_init): Set all crt error handlers to log to stderr and the
     debugger instead of to a dialog.

Modified:
    subversion/trunk/subversion/libsvn_subr/cmdline.c

Modified: subversion/trunk/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cmdline.c?rev=930239&r1=930238&r2=930239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cmdline.c Fri Apr  2 11:16:39 2010
@@ -31,6 +31,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#else
+#include <crtdbg.h>
 #endif
 
 #include <apr_errno.h>          /* for apr_strerror */
@@ -126,12 +128,22 @@ svn_cmdline_init(const char *progname, F
   SetUnhandledExceptionFilter(svn__unhandled_exception_filter);
 
 #if _MSC_VER >= 1400
-  /* ### Does this work for older MSC versions? */
+  /* ### This should work for VC++ 2002 (=1300) and later */
   /* Show the abort message on STDERR instead of a dialog to allow
      scripts (e.g. our testsuite) to continue after an abort without
      user intervention. Allow overriding for easier debugging. */
   if (!getenv("SVN_CMDLINE_USE_DIALOG_FOR_ABORT"))
-    _set_error_mode(_OUT_TO_STDERR);
+    {
+      /* In release mode: Redirect abort() errors to stderr */
+      _set_error_mode(_OUT_TO_STDERR);
+
+      /* In _DEBUG mode: Redirect all debug output (E.g. assert() to stderr.
+         (Ignored in releas builds) */
+      _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR);
+      _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+      _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+      _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    }
 #endif /* _MSC_VER >= 1400 */
 
 #endif /* SVN_USE_WIN32_CRASHHANDLER */