Mercurial > octave
comparison libinterp/corefcn/debug.cc @ 22196:dd992fd74fce
put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
* oct-parse.in.yy, parse.h: Move parser classes to octave namespace.
* lex.ll, lex.h: Move lexer classes to octave namespace.
* pt-eval.h, pt-eval.cc: Move evaluator class to octave namespace.
Don't define global current evaluator pointer here.
* debug.cc, error.cc, input.cc, input.h, ls-mat-ascii.cc, pt-jit.cc,
sighandlers.cc, utils.cc, variables.cc, ov-usr-fcn.cc, pt-assign.cc,
pt-exp.h, pt-id.cc: Update for namespaces.
* interpreter.cc, interpreter.h (current_evaluator): New global var.
(interpreter::m_evaluator): New data member.
(interpreter::~interpreter): Delete evaluator.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 12 Jul 2016 14:28:07 -0400 |
parents | 5d4a286061c8 |
children | bac0d6f07a3e |
comparison
equal
deleted
inserted
replaced
22195:93ed9396f2c3 | 22196:dd992fd74fce |
---|---|
621 bool | 621 bool |
622 bp_table::condition_valid (const std::string& cond) | 622 bp_table::condition_valid (const std::string& cond) |
623 { | 623 { |
624 if (cond.length () > 0) | 624 if (cond.length () > 0) |
625 { | 625 { |
626 octave_parser parser (cond + " ;"); // ; to reject partial expr like "y==" | 626 octave::parser parser (cond + " ;"); // ; to reject partial expr like "y==" |
627 parser.reset (); | 627 parser.reset (); |
628 int parse_status = parser.run (); | 628 int parse_status = parser.run (); |
629 if (parse_status) | 629 if (parse_status) |
630 error ("dbstop: Cannot parse condition '%s'", cond.c_str ()); | 630 error ("dbstop: Cannot parse condition '%s'", cond.c_str ()); |
631 else | 631 else |
751 && do_add_breakpoint_1 (dbg_fcn, fname, line, condition, ret_one)) | 751 && do_add_breakpoint_1 (dbg_fcn, fname, line, condition, ret_one)) |
752 retval.insert (std::pair<int,int> (i, ret_one.find (i)->second)); | 752 retval.insert (std::pair<int,int> (i, ret_one.find (i)->second)); |
753 } | 753 } |
754 } | 754 } |
755 | 755 |
756 tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; | 756 octave::tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; |
757 | 757 |
758 return retval; | 758 return retval; |
759 } | 759 } |
760 | 760 |
761 int | 761 int |
849 retval += do_remove_breakpoint_1 (dbg_subfcn, fname, line); | 849 retval += do_remove_breakpoint_1 (dbg_subfcn, fname, line); |
850 } | 850 } |
851 } | 851 } |
852 } | 852 } |
853 | 853 |
854 tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; | 854 octave::tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; |
855 | 855 |
856 return retval; | 856 return retval; |
857 } | 857 } |
858 | 858 |
859 // Remove all breakpoints from a file, including those in subfunctions | 859 // Remove all breakpoints from a file, including those in subfunctions |
882 } | 882 } |
883 else if (! silent) | 883 else if (! silent) |
884 error ("remove_all_breakpoint_in_file: " | 884 error ("remove_all_breakpoint_in_file: " |
885 "unable to find function %s\n", fname.c_str ()); | 885 "unable to find function %s\n", fname.c_str ()); |
886 | 886 |
887 tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; | 887 octave::tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; |
888 | 888 |
889 return retval; | 889 return retval; |
890 } | 890 } |
891 | 891 |
892 void | 892 void |
899 { | 899 { |
900 ++it_next; | 900 ++it_next; |
901 remove_all_breakpoints_in_file (*it); | 901 remove_all_breakpoints_in_file (*it); |
902 } | 902 } |
903 | 903 |
904 tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; | 904 octave::tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; |
905 } | 905 } |
906 | 906 |
907 std::string | 907 std::string |
908 do_find_bkpt_list (octave_value_list slist, std::string match) | 908 do_find_bkpt_list (octave_value_list slist, std::string match) |
909 { | 909 { |
2094 if (arg == "in") | 2094 if (arg == "in") |
2095 { | 2095 { |
2096 Vdebugging = false; | 2096 Vdebugging = false; |
2097 Vtrack_line_num = true; | 2097 Vtrack_line_num = true; |
2098 | 2098 |
2099 tree_evaluator::dbstep_flag = -1; | 2099 octave::tree_evaluator::dbstep_flag = -1; |
2100 } | 2100 } |
2101 else if (arg == "out") | 2101 else if (arg == "out") |
2102 { | 2102 { |
2103 Vdebugging = false; | 2103 Vdebugging = false; |
2104 Vtrack_line_num = true; | 2104 Vtrack_line_num = true; |
2105 | 2105 |
2106 tree_evaluator::dbstep_flag = -2; | 2106 octave::tree_evaluator::dbstep_flag = -2; |
2107 } | 2107 } |
2108 else | 2108 else |
2109 { | 2109 { |
2110 int n = atoi (arg.c_str ()); | 2110 int n = atoi (arg.c_str ()); |
2111 | 2111 |
2113 error ("dbstep: invalid argument"); | 2113 error ("dbstep: invalid argument"); |
2114 | 2114 |
2115 Vdebugging = false; | 2115 Vdebugging = false; |
2116 Vtrack_line_num = true; | 2116 Vtrack_line_num = true; |
2117 | 2117 |
2118 tree_evaluator::dbstep_flag = n; | 2118 octave::tree_evaluator::dbstep_flag = n; |
2119 } | 2119 } |
2120 } | 2120 } |
2121 else | 2121 else |
2122 { | 2122 { |
2123 Vdebugging = false; | 2123 Vdebugging = false; |
2124 Vtrack_line_num = true; | 2124 Vtrack_line_num = true; |
2125 | 2125 |
2126 tree_evaluator::dbstep_flag = 1; | 2126 octave::tree_evaluator::dbstep_flag = 1; |
2127 } | 2127 } |
2128 | 2128 |
2129 return ovl (); | 2129 return ovl (); |
2130 } | 2130 } |
2131 | 2131 |
2145 print_usage (); | 2145 print_usage (); |
2146 | 2146 |
2147 Vdebugging = false; | 2147 Vdebugging = false; |
2148 Vtrack_line_num = true; | 2148 Vtrack_line_num = true; |
2149 | 2149 |
2150 tree_evaluator::reset_debug_state (); | 2150 octave::tree_evaluator::reset_debug_state (); |
2151 | 2151 |
2152 return ovl (); | 2152 return ovl (); |
2153 } | 2153 } |
2154 | 2154 |
2155 DEFUN (dbquit, args, , | 2155 DEFUN (dbquit, args, , |
2166 if (args.length () != 0) | 2166 if (args.length () != 0) |
2167 print_usage (); | 2167 print_usage (); |
2168 | 2168 |
2169 Vdebugging = false; | 2169 Vdebugging = false; |
2170 | 2170 |
2171 tree_evaluator::reset_debug_state (); | 2171 octave::tree_evaluator::reset_debug_state (); |
2172 | 2172 |
2173 octave_throw_interrupt_exception (); | 2173 octave_throw_interrupt_exception (); |
2174 | 2174 |
2175 return ovl (); | 2175 return ovl (); |
2176 } | 2176 } |
2205 bool state = true; | 2205 bool state = true; |
2206 | 2206 |
2207 if (nargin == 1) | 2207 if (nargin == 1) |
2208 state = args(0).bool_value (); | 2208 state = args(0).bool_value (); |
2209 | 2209 |
2210 tree_evaluator::quiet_breakpoint_flag = state; | 2210 octave::tree_evaluator::quiet_breakpoint_flag = state; |
2211 | 2211 |
2212 return ovl (); | 2212 return ovl (); |
2213 } | 2213 } |
2214 | 2214 |