octave-maintainers
[Top][All Lists]
Advanced

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

Improved behavior debug mode exit [patch]


From: Judd Storrs
Subject: Improved behavior debug mode exit [patch]
Date: Sat, 26 Dec 2009 13:10:15 -0500

I sent this patch to the help@ list a week ago instead of the
maintainers@ list by accident.
http://old.nabble.com/When-I-use-keyboard-octave-crashes-td26795617.html

Briefly, things like

octave <<EOF
keyboard
EOF

and

octave --eval keyboard

cause octave to enter an infinite loop consuming 100% CPU. jwe's
solution was to disallow debug mode altogether if there was no tty
attached to octave
http://hg.savannah.gnu.org/hgweb/octave/rev/653716f3d976

I poked around and what seems to be happening now is that debug mode
recycles the last command when it hits EOF instead of exiting debug
mode. This leads to the infinite loop.

The attached diff causes an empty command in debug mode to be
converted to "dbquit". This does not affect the regular debug "hit
return to repeat last command" behavior because the returns key yields
"\n" not an empty string. This also allows "ctrl-d" to end debug
mode--it surprised me that ctrl-d already exit debug mode.

The diff also allows the --interactive command line parameter to
override the new tty restriction.


--judd



diff -r 6918d86add73 src/input.cc
--- a/src/input.cc      Fri Dec 18 13:26:05 2009 -0500
+++ b/src/input.cc      Sat Dec 26 12:45:19 2009 -0500
@@ -298,8 +298,13 @@
        }
       else if (Vdebugging)
        {
-         retval = last_debugging_command;
-         history_skip_auto_repeated_debugging_command = true;
+          if ( retval.empty () )
+            retval = "dbquit" ;
+          else
+            {
+              retval = last_debugging_command;
+              history_skip_auto_repeated_debugging_command = true;
+            }
        }
     }
   else
@@ -691,7 +696,7 @@
   unwind_protect::protect_var (VPS1);
   VPS1 = prompt;

-  if (stdin_is_tty)
+  if (stdin_is_tty || forced_interactive)
     {
       if (! (interactive || forced_interactive)
           || (reading_fcn_file

Attachment: patchset
Description: Binary data


reply via email to

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