Mercurial > jwe > octave
changeset 27011:e93b8887fedf
remove additionally added breakpoint when stepping into a file (bug #44728)
* file-editor-tab.cc (file_editor_tab): initialize new struct with info on
breakpoints;
(run_file): before adding breakpoint at very first line, store position
of already existing first breakpoint and set flag to remove next
breakpoint reached;
(add_breakpoint_callback): if remove_next in structure is set, store
real line of the new breakpoint and reset remove_next flag;
(insert_debugger_pointer) if the current line number is the same as
a possible line number where a breakpoint has to be removed and there
wasn't a breakpoint berfore adding it, remove this breakpoint
* file-editor-tab.h: new structure for storing all required information
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Sat, 30 Mar 2019 16:39:17 +0100 |
parents | dd31206c87c0 |
children | b6d826339138 |
files | libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h |
diffstat | 2 files changed, 46 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc Fri Mar 29 21:01:43 2019 -0700 +++ b/libgui/src/m-editor/file-editor-tab.cc Sat Mar 30 16:39:17 2019 +0100 @@ -113,6 +113,9 @@ _bp_conditions.clear (); m_bp_restore_count = 0; + m_breakpoint_info.remove_next = false; + m_breakpoint_info.remove_line = -1; + // Initialize last modification date to now m_last_modified = QDateTime::currentDateTimeUtc(); @@ -938,7 +941,20 @@ } if (step_into) - handle_request_add_breakpoint (1, QString ()); + { + // Get current first breakpoint and set breakpoint waiting for + // the returned line number. Store whether to remove this breakpoint + // afterwards. + int first_bp_line + = _edit_area->markerFindNext (0, (1 << marker::breakpoint)) + 1; + + // Set flag for storing the line number of the breakpoint + m_breakpoint_info.remove_next = true; + m_breakpoint_info.do_not_remove_line = first_bp_line; + + // Add breakpoint, storing its line number + handle_request_add_breakpoint (1, QString ()); + } QFileInfo info (_file_name); emit run_file_signal (info); @@ -1026,7 +1042,16 @@ { bp_table& bptab = __get_bp_table__ ("octave_qt_link::file_in_path"); - bptab.add_breakpoint (info.function_name, "", line_info, info.condition); + bp_table::intmap bpmap + = bptab.add_breakpoint (info.function_name, "", line_info, info.condition); + + // Store some info breakpoint + if (m_breakpoint_info.remove_next && (bpmap.size() > 0)) + { + bp_table::intmap::iterator bp_it = bpmap.begin(); + m_breakpoint_info.remove_line = bp_it->second; + m_breakpoint_info.remove_next = false; + } } } @@ -2830,7 +2855,18 @@ } } else - dp = new marker (_edit_area, line, marker::debugger_position); + { + dp = new marker (_edit_area, line, marker::debugger_position); + + // In case of a not modified file we might have to remove + // a breakpoint here if we have stepped into the file + if (line == m_breakpoint_info.remove_line) + { + m_breakpoint_info.remove_line = -1; + if (line != m_breakpoint_info.do_not_remove_line) + handle_request_remove_breakpoint (line); + } + } connect (this, SIGNAL (remove_position_via_debugger_linenr (int)), dp, SLOT (handle_remove_via_original_linenr (int)));
--- a/libgui/src/m-editor/file-editor-tab.h Fri Mar 29 21:01:43 2019 -0700 +++ b/libgui/src/m-editor/file-editor-tab.h Sat Mar 30 16:39:17 2019 +0100 @@ -321,6 +321,13 @@ bool _lines_changed; bool _highlight_all_occurrences; int m_bp_restore_count; + + struct + { + bool remove_next; + int remove_line; + int do_not_remove_line; + } m_breakpoint_info; }; }