Repository navigation
feat: debugging features - #1529
Conversation
- Improve step handling, including better management of step-next breakpoints. - Breakpoint states and cleanup more effectively. - Improved control flow handling to ensure breakpoints are triggered correctly. - Added tests for various scenarios in the debugger, including loops, conditionals, and function calls. - Updated text editor actions to reflect changes in debugging commands and states.
- Created XML documentation for the following debugger functions in English: - dbstop: Set breakpoints for debugging. - dbup: Move up the call stack in debug mode. - dbclear: Remove breakpoints during debugging. - dbcont: Resume execution after a breakpoint. - dbdown: Move down the call stack in debug mode. - dbquit: Exit debug mode. - dbstatus: List all breakpoints during debugging. - dbstep: Execute the next executable line during debugging. - Translated the above documentation into French. - Added a test case for dbup and dbdown functionality to ensure proper workspace context switching during debugging. - Updated existing test case for while_cli to include debugging instructions.
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive debugger support to Nelson with integrated text editor debugging features. The changes introduce breakpoint management, step execution controls, call stack inspection, and real-time visual debugging feedback in the text editor.
Changes:
- Added core debugger builtin commands:
dbstop,dbstep,dbcont,dbquit,dbclear,dbdown,dbup,dbstatus - Implemented visual debugging UI in text editor with breakpoint panel, call stack panel, and line highlighting
- Extended evaluator and interpreter with breakpoint tracking, debug state management, and step execution logic
- Updated comment/uncomment to use
%(MATLAB-style) instead of//(C++-style)
Reviewed changes
Copilot reviewed 79 out of 84 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| modules/types/src/include/ArrayOf.hpp | Added const qualifiers to vector constructor parameters for better const-correctness |
| modules/types/src/cpp/*.cpp | Implemented const-qualified vector constructor methods |
| modules/text_editor/src/include/TextEditorPreferences.hpp | Added debug line color preference storage |
| modules/text_editor/src/cpp/TextEditorPreferences.cpp | Implemented save/load of debug line color setting |
| modules/text_editor/src/cpp/QtTextEditor.* | Added debug menu, toolbar buttons, panels, and state tracking timer |
| modules/text_editor/src/cpp/QtTextEdit.* | Implemented debug line highlighting with configurable colors |
| modules/text_editor/src/cpp/QtEditPane.* | Added breakpoint area and debug state management |
| modules/text_editor/src/cpp/QtDebugStackPanel.* | New panel for displaying call stack during debugging |
| modules/text_editor/src/cpp/QtBreakpointPanel.* | New panel for managing breakpoints |
| modules/text_editor/src/cpp/QtBreakpointArea.* | Visual breakpoint indicators and execution arrow in editor margin |
| modules/text_editor/CMakeLists.txt | Added debugger module dependency |
| modules/interpreter/src/include/*.hpp | Extended Evaluator with breakpoint management, debug states, and step logic |
| modules/interpreter/src/cpp/EvaluatorDebug.cpp | Implemented comprehensive breakpoint and stepping functionality |
| modules/interpreter/src/cpp/EvaluatorControlFlow.cpp | Added breakpoint checks in control flow statements |
| modules/interpreter/src/cpp/Evaluator.cpp | Enhanced prompt display and debug CLI loop |
| modules/interpreter/src/cpp/Context.cpp | Added scope restoration for debug navigation |
| modules/debugger/builtin/cpp/*.cpp | Implemented all debugger command builtins |
| modules/debugger/help//xml/.xml | Added documentation for all debugger commands in English and French |
| modules/debugger/tests/*.m | Added test cases for debugger functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…and workflow documentation
… single and multi-step execution
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 81 out of 88 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 2. We have a step breakpoint but the current filename is empty (not in any file) | ||
| // 3. Step mode is active but we're at base scope with no file | ||
| bool noExecutionFrame = callstack.size() <= 1; | ||
| bool notInFile = context->getCurrentScope()->getFilename().empty(); |
Check notice
Code scanning / CodeQL
Unused local variable Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 months ago
To fix an unused local variable, either remove the declaration or start using the variable in a meaningful way. Since there is no existing logic referencing notInFile, introducing new behavior to “use” it would change semantics; therefore, the best fix that preserves behavior is simply to delete the declaration.
Concretely, in modules/interpreter/src/cpp/Evaluator.cpp, within the loop handling command input, remove the line declaring bool notInFile = context->getCurrentScope()->getFilename().empty();. No additional methods, imports, or definitions are needed, as this only eliminates dead code.
| @@ -419,7 +419,6 @@ | ||
| // 2. We have a step breakpoint but the current filename is empty (not in any file) | ||
| // 3. Step mode is active but we're at base scope with no file | ||
| bool noExecutionFrame = callstack.size() <= 1; | ||
| bool notInFile = context->getCurrentScope()->getFilename().empty(); | ||
| // If there is no execution frame, always leave debug mode; this runs after scripts | ||
| // finish. | ||
| if (bpActive && noExecutionFrame) { |
dbstop,dbstep,dbcont,dbquit,dbclear,dbdown,dbup,dbstatus