# HG changeset patch # User John W. Eaton # Date 1417727191 18000 # Node ID c1ce43276b8616108a8eefe0eec599fc6cc8de54 # Parent f7ccd02bc06054e152f0ae6c68701f8a8b7a83e0 avoid printing debug location in cmd window when using GUI to step * pt-eval.cc, pt-eval.h (tree_evaluator::quiet_breakpoint_flag): New member variable. * debug.cc (Fdb_next_breakpoint_quiet): New function. * main-window.cc (main_window::execute_debug_callback): Call Fdb_next_breakpoint_quiet prior to Fdbstep and Fdbcont. * input.cc, input.h (get_debug_input): Don't print debug location if tree_evaluator::quiet_breakpoint_flag is true. Reset it after checking. * lex.ll (octave_lexer::fill_flex_buffer, octave_push_lexer::fill_flex_buffer): Don't abort if input_buf is empty. diff -r f7ccd02bc060 -r c1ce43276b86 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Thu Dec 04 15:56:49 2014 -0500 +++ b/libgui/src/main-window.cc Thu Dec 04 16:06:31 2014 -0500 @@ -2198,13 +2198,22 @@ _dbg_queue_mutex.unlock (); if (debug == "step") - Fdbstep (); + { + Fdb_next_breakpoint_quiet (); + Fdbstep (); + } else if (debug == "cont") - Fdbcont (); + { + Fdb_next_breakpoint_quiet (); + Fdbcont (); + } else if (debug == "quit") Fdbquit (); else - Fdbstep (ovl (debug.toStdString ())); + { + Fdb_next_breakpoint_quiet (); + Fdbstep (ovl (debug.toStdString ())); + } command_editor::interrupt (true); } diff -r f7ccd02bc060 -r c1ce43276b86 libinterp/corefcn/debug.cc --- a/libinterp/corefcn/debug.cc Thu Dec 04 15:56:49 2014 -0500 +++ b/libinterp/corefcn/debug.cc Thu Dec 04 16:06:31 2014 -0500 @@ -1485,3 +1485,38 @@ return retval; } + +DEFUN (db_next_breakpoint_quiet, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} db_next_breakpoint_quiet ()\n\ +@deftypefnx {Built-in Function} {} db_next_breakpoint_quiet (@var{flag})\n\ +Disable line info printing at the next breakpoint. With a logical\n\ +argument, set the state on or off.\n\ +@end deftypefn") +{ + octave_value retval; + + int nargin = args.length (); + + if (nargin == 0 || nargin == 1) + { + bool state = true; + + if (nargin == 1) + { + state = args(0).bool_value (); + + if (error_state) + { + gripe_wrong_type_arg ("db_next_breakpoint", args(0), true); + return retval; + } + } + + tree_evaluator::quiet_breakpoint_flag = state; + } + else + print_usage (); + + return retval; +} diff -r f7ccd02bc060 -r c1ce43276b86 libinterp/corefcn/input.cc --- a/libinterp/corefcn/input.cc Thu Dec 04 15:56:49 2014 -0500 +++ b/libinterp/corefcn/input.cc Thu Dec 04 16:06:31 2014 -0500 @@ -184,10 +184,13 @@ eof = false; std::string retval = command_editor::readline (s, eof); - + if (! eof && retval.empty ()) retval = "\n"; + if (command_editor::interrupt (false)) + retval = ""; + return retval; } @@ -508,6 +511,9 @@ { unwind_protect frame; + bool silent = tree_evaluator::quiet_breakpoint_flag; + tree_evaluator::quiet_breakpoint_flag = false; + octave_user_code *caller = octave_call_stack::caller_user_code (); std::string nm; int curr_debug_line; @@ -544,10 +550,13 @@ // that we are stopped on the no-op command that marks the // end of a function or script. - buf << "stopped in " << nm; + if (! silent) + { + buf << "stopped in " << nm; - if (curr_debug_line > 0) - buf << " at line " << curr_debug_line; + if (curr_debug_line > 0) + buf << " at line " << curr_debug_line; + } if (have_file) { @@ -558,15 +567,21 @@ frame.add_fcn (execute_in_debugger_handler, std::pair (nm, curr_debug_line)); - std::string line_buf - = get_file_line (nm, curr_debug_line); + if (! silent) + { + std::string line_buf + = get_file_line (nm, curr_debug_line); - if (! line_buf.empty ()) - buf << "\n" << curr_debug_line << ": " << line_buf; + if (! line_buf.empty ()) + buf << "\n" << curr_debug_line << ": " << line_buf; + } } } } + if (silent) + command_editor::erase_empty_line (true); + std::string msg = buf.str (); if (! msg.empty ()) @@ -595,7 +610,7 @@ if (command_editor::interrupt (false)) break; - else + else { if (retval == 0 && curr_parser.stmt_list) { @@ -910,6 +925,7 @@ octave_call_stack::goto_frame_relative (0); tree_evaluator::debug_mode = true; + tree_evaluator::quiet_breakpoint_flag = false; tree_evaluator::current_frame = octave_call_stack::current_frame (); diff -r f7ccd02bc060 -r c1ce43276b86 libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Thu Dec 04 15:56:49 2014 -0500 +++ b/libinterp/parse-tree/lex.ll Thu Dec 04 16:06:31 2014 -0500 @@ -3398,12 +3398,7 @@ if (! input_buf.empty ()) status = input_buf.copy_chunk (buf, max_size); else - { - status = YY_NULL; - - if (! input_buf.at_eof ()) - fatal_error ("octave_base_lexer::fill_flex_buffer failed"); - } + status = YY_NULL; return status; } @@ -3419,12 +3414,7 @@ if (! input_buf.empty ()) status = input_buf.copy_chunk (buf, max_size); else - { - status = YY_NULL; - - if (! input_buf.at_eof ()) - fatal_error ("octave_base_lexer::fill_flex_buffer failed"); - } + status = YY_NULL; return status; } diff -r f7ccd02bc060 -r c1ce43276b86 libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc Thu Dec 04 15:56:49 2014 -0500 +++ b/libinterp/parse-tree/pt-eval.cc Thu Dec 04 16:06:31 2014 -0500 @@ -57,6 +57,8 @@ bool tree_evaluator::debug_mode = false; +bool tree_evaluator::quiet_breakpoint_flag = false; + tree_evaluator::stmt_list_type tree_evaluator::statement_context = tree_evaluator::other; diff -r f7ccd02bc060 -r c1ce43276b86 libinterp/parse-tree/pt-eval.h --- a/libinterp/parse-tree/pt-eval.h Thu Dec 04 15:56:49 2014 -0500 +++ b/libinterp/parse-tree/pt-eval.h Thu Dec 04 16:06:31 2014 -0500 @@ -149,6 +149,8 @@ static bool debug_mode; + static bool quiet_breakpoint_flag; + // Possible types of evaluation contexts. enum stmt_list_type {