Mercurial > octave
changeset 20674:78b3e9868b67 stable
Fix segfault with 'dbclear all' (bug #41843).
* debug.cc (do_remove_all_breakpoints_in_file_1): Delete function.
* debug.cc (do_remove_all_breakpoints_in_file): Incorporate
do_remove_all_breakpoints_in_file_1 into function. Don't do a loop
over all subfcns since remove_all_breakpoints(file) already does that.
author | Lachlan Andrew <lachlanbis@gmail.com> |
---|---|
date | Sun, 01 Nov 2015 20:14:47 -0800 |
parents | 77b104cad58e |
children | 0d5d8db55790 8ba21392ea6d |
files | libinterp/corefcn/debug.cc |
diffstat | 1 files changed, 8 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/debug.cc Sat Oct 24 17:20:24 2015 -0400 +++ b/libinterp/corefcn/debug.cc Sun Nov 01 20:14:47 2015 -0800 @@ -474,28 +474,7 @@ return retval; } -bp_table::intmap -bp_table::do_remove_all_breakpoints_in_file_1 (octave_user_code *fcn, - const std::string& fname) -{ - intmap retval; - - std::string file = fcn->fcn_file_name (); - - tree_statement_list *cmds = fcn->body (); - - if (cmds) - { - retval = cmds->remove_all_breakpoints (file); - - bp_set_iterator it = bp_set.find (fname); - if (it != bp_set.end ()) - bp_set.erase (it); - } - - return retval; -} - +// Remove all breakpoints from a file, including those in subfunctions bp_table::intmap bp_table::do_remove_all_breakpoints_in_file (const std::string& fname, bool silent) @@ -506,24 +485,17 @@ if (dbg_fcn) { - retval = do_remove_all_breakpoints_in_file_1 (dbg_fcn, fname); - - // Order is not important here. + std::string file = dbg_fcn->fcn_file_name (); - typedef std::map<std::string, octave_value>::const_iterator - subfcns_const_iterator; - - std::map<std::string, octave_value> subfcns = dbg_fcn->subfunctions (); + tree_statement_list *cmds = dbg_fcn->body (); - for (subfcns_const_iterator p = subfcns.begin (); - p != subfcns.end (); p++) + if (cmds) { - octave_user_code *dbg_subfcn = p->second.user_code_value (); + retval = cmds->remove_all_breakpoints (file); - intmap tmp = do_remove_all_breakpoints_in_file_1 (dbg_subfcn, fname); - - // Merge new list with retval. - retval.insert (tmp.begin (), tmp.end ()); + bp_set_iterator it = bp_set.find (fname); + if (it != bp_set.end ()) + bp_set.erase (it); } } else if (! silent)