help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: octave forge packages with current CVS


From: John W. Eaton
Subject: Re: octave forge packages with current CVS
Date: Mon, 07 Jan 2008 14:32:19 -0500

On  7-Jan-2008, Ben Barrowes wrote:

| Would the right thing to do here be do disable debug_on_error within a try 
block? I'm not
| sure how hard that would be to do.

How about the following patch?  I checked it in on the cvs trunk and
3.0 branch.

I might have noticed this earlier if it had been reported as a bug on
the address@hidden list.

jwe


src/ChangeLog:

2008-01-07  John W. Eaton  <address@hidden>

        * src/pt-except.cc (tree_try_catch_command::eval):
        Set Vdebug_on_error and Vdebug_on_warning to false while executing
        try block.

        * error.cc (Vdebug_on_error, Vdebug_on_warning): No longer static.
        * error.h: Provide decls.


Index: src/error.cc
===================================================================
RCS file: /cvs/octave/src/error.cc,v
retrieving revision 1.130
diff -u -u -r1.130 error.cc
--- src/error.cc        28 Dec 2007 20:56:56 -0000      1.130
+++ src/error.cc        7 Jan 2008 19:28:37 -0000
@@ -53,11 +53,11 @@
 // TRUE means that Octave will try to enter the debugger when an error
 // is encountered.  This will also inhibit printing of the normal
 // traceback message (you will only see the top-level error message).
-static bool Vdebug_on_error = false;
+bool Vdebug_on_error = false;
 
 // TRUE means that Octave will try to enter the debugger when a warning
 // is encountered.
-static bool Vdebug_on_warning = false;
+bool Vdebug_on_warning = false;
 
 // TRUE means that Octave will try to display a stack trace when a
 // warning is encountered.
Index: src/error.h
===================================================================
RCS file: /cvs/octave/src/error.h,v
retrieving revision 1.44
diff -u -u -r1.44 error.h
--- src/error.h 12 Oct 2007 21:27:29 -0000      1.44
+++ src/error.h 7 Jan 2008 19:28:37 -0000
@@ -88,6 +88,15 @@
 extern OCTINTERP_API void disable_warning (const std::string& id);
 extern OCTINTERP_API void initialize_default_warning_state (void);
 
+// TRUE means that Octave will try to enter the debugger when an error
+// is encountered.  This will also inhibit printing of the normal
+// traceback message (you will only see the top-level error message).
+extern OCTINTERP_API bool Vdebug_on_error;
+
+// TRUE means that Octave will try to enter the debugger when a warning
+// is encountered.
+extern OCTINTERP_API bool Vdebug_on_warning;
+
 // Current error state.
 extern OCTINTERP_API int error_state;
 
Index: src/pt-except.cc
===================================================================
RCS file: /cvs/octave/src/pt-except.cc,v
retrieving revision 1.27
diff -u -u -r1.27 pt-except.cc
--- src/pt-except.cc    28 Dec 2007 20:56:57 -0000      1.27
+++ src/pt-except.cc    7 Jan 2008 19:28:37 -0000
@@ -96,7 +96,12 @@
   MAYBE_DO_BREAKPOINT;
 
   unwind_protect_int (buffer_error_messages);
+  unwind_protect_bool (Vdebug_on_error);
+  unwind_protect_bool (Vdebug_on_warning);
+
   buffer_error_messages++;
+  Vdebug_on_error = false;
+  Vdebug_on_warning = false;
 
   unwind_protect::add (do_catch_code, catch_code);
 
@@ -118,7 +123,10 @@
       // For clearing the do_catch_code cleanup function.
       unwind_protect::discard ();
 
-      // For restoring buffer_error_messages.
+      // For restoring Vdebug_on_warning, Vdebug_on_error, and
+      // buffer_error_messages.
+      unwind_protect::run ();
+      unwind_protect::run ();
       unwind_protect::run ();
 
       // Also clear the frame marker.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]