# HG changeset patch # User David Bateman # Date 1222258138 -7200 # Node ID eff8ac793dbf6dc756cf26db9fbc46334143f86d # Parent 24d26caa095b5cf4856729e7ab799a830db5ee4f clear breakpoints is function found to be out of date diff -r 24d26caa095b -r eff8ac793dbf src/ChangeLog --- a/src/ChangeLog Wed Sep 24 09:06:04 2008 +0200 +++ b/src/ChangeLog Wed Sep 24 14:08:58 2008 +0200 @@ -4,6 +4,21 @@ 2008-09-19 David Bateman + * debug.cc (static octave_user_function *get_user_function + (const std::string&)): Function lookup to force out of date check. + (bp_table::intmap bp_table::do_remove_all_breakpoints_in_file + (const std::string&, bool)): Add flag to silence the error message + from this function if a user code with breakpoints is not found. + (bp_table::fname_line_map bp_table::do_get_breakpoint_list (const + octave_value_list&)): Do an out of date check on the function + before checking the breakpoints. + * debug.h (do_remove_all_breakpoints_in_file, + remove_all_breakpoints_in_file): Add flag to silence error + message. + * variables.cc (static bool symbol_out_of_date (symbol_record*)): + If symbol out of date clear breakpoints. + + * data.cc (SINGLE_TYPE_CONCAT, DO_SINGLE_TYPE_CONCAT): New macros (do_cat): Special case single type concatenations for speed. * pt.mat.cc (std::string get_concat_class (const std::string&, diff -r 24d26caa095b -r eff8ac793dbf src/debug.cc --- a/src/debug.cc Wed Sep 24 09:06:04 2008 +0200 +++ b/src/debug.cc Wed Sep 24 14:08:58 2008 +0200 @@ -75,6 +75,10 @@ if (ptr && ptr->is_user_function ()) { + // Do a lookup on the symbol record to force an + // out of date check on the function + lookup (ptr); + octave_value tmp = ptr->def (); dbg_fcn = dynamic_cast (tmp.function_value ()); } @@ -241,7 +245,8 @@ bp_table::intmap -bp_table::do_remove_all_breakpoints_in_file (const std::string& fname) +bp_table::do_remove_all_breakpoints_in_file (const std::string& fname, + bool silent) { intmap retval; @@ -264,7 +269,7 @@ if (it != bp_map.end ()) bp_map.erase (it); } - else + else if (! silent) error ("remove_all_breakpoint_in_file: " "unable to find the function requested\n"); @@ -310,16 +315,30 @@ if (fname_list.length () == 0 || do_find_bkpt_list (fname_list, it->first) != "") { - octave_value_list bkpts = it->second->body ()->list_breakpoints (); + if (! fcn_out_of_date (it->second, it->second->fcn_file_name (), + it->second->time_parsed (). unix_time())) + { + octave_value_list bkpts = + it->second->body ()->list_breakpoints (); - octave_idx_type len = bkpts.length (); + octave_idx_type len = bkpts.length (); + + if (len > 0) + { + bp_table::intmap bkpts_vec; - bp_table::intmap bkpts_vec; + for (int i = 0; i < len; i++) + bkpts_vec[i] = bkpts (i).double_value (); - for (int i = 0; i < len; i++) - bkpts_vec[i] = bkpts (i).double_value (); - - retval[it->first] = bkpts_vec; + retval[it->first] = bkpts_vec; + } + } + else + { + symbol_record *sr = fbi_sym_tab->lookup (it->first); + if (sr && sr->is_function ()) + lookup (sr); + } } } diff -r 24d26caa095b -r eff8ac793dbf src/debug.h --- a/src/debug.h Wed Sep 24 09:06:04 2008 +0200 +++ b/src/debug.h Wed Sep 24 14:08:58 2008 +0200 @@ -85,10 +85,11 @@ } // Remove all the breakpoints in a specified file. - static intmap remove_all_breakpoints_in_file (const std::string& fname) + static intmap remove_all_breakpoints_in_file (const std::string& fname, + bool silent = false) { return instance_ok () - ? instance->do_remove_all_breakpoints_in_file (fname) : intmap (); + ? instance->do_remove_all_breakpoints_in_file (fname, silent) : intmap (); } // Remove all the breakpoints registered with octave. @@ -124,7 +125,8 @@ int do_remove_breakpoint (const std::string&, const intmap& lines); - intmap do_remove_all_breakpoints_in_file (const std::string& fname); + intmap do_remove_all_breakpoints_in_file (const std::string& fname, + bool silent); void do_remove_all_breakpoints (void); diff -r 24d26caa095b -r eff8ac793dbf src/variables.cc --- a/src/variables.cc Wed Sep 24 09:06:04 2008 +0200 +++ b/src/variables.cc Wed Sep 24 14:08:58 2008 +0200 @@ -58,6 +58,7 @@ #include "unwind-prot.h" #include "utils.h" #include "variables.h" +#include "debug.h" // Should Octave always check to see if function files have changed // since they were last compiled? @@ -1091,6 +1092,11 @@ else retval = true; } + + // If the function has been replaced then clear any + // breakpoints associated with it + if (retval) + bp_table::remove_all_breakpoints_in_file (nm, true); } } }