# HG changeset patch # User paulo # Date 1696757542 -7200 # Sun Oct 08 11:32:22 2023 +0200 # Node ID d0ca798d32ad01bc933ed3cc9123b1486d5219a8 # Parent f98e7a26f7118b7f5b32373d2c0b55b4c98f1743 dbclear: Support clearing breakpoint by method name (bug #46451). * libinterp/parse-tree/bp-table.h (remove_breakpoint_from_function, remove_all_breakpoints_from_function): Add class name to input arguments. * libinterp/parse-tree/bp-table.cc (remove_breakpoint_from_function, remove_all_breakpoints_from_function): Optionally, get handle to method in classdef from evaluator. * libinterp/corefcn/debug.cc (Fdbclear): Pass class name when remove breakpoints. * libinterp/corefcn/fcn-info (out_of_date_check): Adapt for changed function prototype. diff -r f98e7a26f711 -r d0ca798d32ad libinterp/corefcn/debug.cc --- a/libinterp/corefcn/debug.cc Sun Oct 08 12:57:19 2023 +0200 +++ b/libinterp/corefcn/debug.cc Sun Oct 08 11:32:22 2023 +0200 @@ -321,7 +321,7 @@ else { if (symbol_name != "") - bptab.remove_breakpoints_from_function (symbol_name, lines); + bptab.remove_breakpoints_from_function (symbol_name, class_name, lines); } // If we remove a breakpoint, we also need to reset debug_mode. diff -r f98e7a26f711 -r d0ca798d32ad libinterp/corefcn/fcn-info.cc --- a/libinterp/corefcn/fcn-info.cc Sun Oct 08 12:57:19 2023 +0200 +++ b/libinterp/corefcn/fcn-info.cc Sun Oct 08 11:32:22 2023 +0200 @@ -644,7 +644,7 @@ bp_table& bptab = __get_bp_table__ (); bptab.remove_all_breakpoints_from_function (canonical_nm, - true); + "", true); } } } diff -r f98e7a26f711 -r d0ca798d32ad libinterp/parse-tree/bp-table.cc --- a/libinterp/parse-tree/bp-table.cc Sun Oct 08 12:57:19 2023 +0200 +++ b/libinterp/parse-tree/bp-table.cc Sun Oct 08 11:32:22 2023 +0200 @@ -899,28 +899,30 @@ } int -bp_table::remove_breakpoint_from_function (const std::string& fname, int line) +bp_table::remove_breakpoint_from_function (const std::string& fname, + const std::string& cname, int line) { bp_lines line_info; line_info.insert (line); - return remove_breakpoints_from_function (fname, line_info); + return remove_breakpoints_from_function (fname, cname, line_info); } int bp_table::remove_breakpoints_from_function (const std::string& fname, + const std::string& cname, const bp_table::bp_lines& lines) { int retval = 0; if (lines.empty ()) { - bp_lines results = remove_all_breakpoints_from_function (fname); + bp_lines results = remove_all_breakpoints_from_function (fname, cname); retval = results.size (); } else { - octave_user_code *dbg_fcn = m_evaluator.get_user_code (fname); + octave_user_code *dbg_fcn = m_evaluator.get_user_code (fname, cname); user_code_provider user_code (fname, dbg_fcn); if (user_code.is_valid ()) @@ -994,11 +996,12 @@ bp_table::bp_lines bp_table::remove_all_breakpoints_from_function (const std::string& fname, + const std::string& cname, bool silent) { bp_lines retval; - octave_user_code *fcn = m_evaluator.get_user_code (fname); + octave_user_code *fcn = m_evaluator.get_user_code (fname, cname); user_code_provider user_code (fname, fcn); if (user_code.is_valid ()) @@ -1043,7 +1046,7 @@ if (! info.ok ()) return 0; - return remove_breakpoint_from_function (info.fcn (), line); + return remove_breakpoint_from_function (info.fcn (), "", line); } int @@ -1058,7 +1061,7 @@ if (! info.ok ()) return 0; - return remove_breakpoints_from_function (info.fcn (), lines); + return remove_breakpoints_from_function (info.fcn (), "", lines); } bp_table::bp_lines @@ -1073,7 +1076,7 @@ if (! info.ok ()) return bp_lines (); - return remove_all_breakpoints_from_function (info.fcn (), silent); + return remove_all_breakpoints_from_function (info.fcn (), "", silent); } void bp_table::remove_all_breakpoints () diff -r f98e7a26f711 -r d0ca798d32ad libinterp/parse-tree/bp-table.h --- a/libinterp/parse-tree/bp-table.h Sun Oct 08 12:57:19 2023 +0200 +++ b/libinterp/parse-tree/bp-table.h Sun Oct 08 11:32:22 2023 +0200 @@ -107,14 +107,17 @@ // Remove a breakpoint from the given line in file. int remove_breakpoint_from_function (const std::string& fname = "", + const std::string& cname = "", int line = 1); // Remove a set of breakpoints from the given lines in file. int remove_breakpoints_from_function (const std::string& fname = "", + const std::string& cname = "", const bp_lines& lines = bp_lines ()); // Remove all the breakpoints in a specified function. bp_lines remove_all_breakpoints_from_function (const std::string& fname, + const std::string& cname = "", bool silent = false); // Remove a breakpoint from the given line in file.