Skip to content

feat: debugging features - #1529

Merged
Nelson-numerical-software merged 13 commits into
masterfrom
debugger
Jan 16, 2026
Merged

Nelson-numerical-software merged 13 commits into
masterfrom
debugger

Conversation

@Nelson-numerical-software

@Nelson-numerical-software Nelson-numerical-software commented Jan 14, 2026 •

Copy link
Copy Markdown
Collaborator
  • 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

- 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread modules/text_editor/src/cpp/QtTextEditor.cpp Fixed
Comment thread modules/debugger/builtin/cpp/dbstepBuiltin.cpp Fixed
Comment thread modules/debugger/builtin/cpp/dbstopBuiltin.cpp Fixed
Comment thread modules/interpreter/src/cpp/Evaluator.cpp Fixed
Comment thread modules/interpreter/src/cpp/EvaluatorDebug.cpp Fixed
Comment thread modules/text_editor/src/cpp/QtBreakpointPanel.cpp Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread modules/text_editor/src/cpp/QtTextEditor.cpp
Comment thread modules/text_editor/src/cpp/QtDebugStackPanel.cpp
Comment thread modules/interpreter/src/cpp/EvaluatorDebug.cpp
Comment thread modules/interpreter/src/cpp/NelsonLexer.cpp
Comment thread modules/interpreter/src/include/Evaluator.hpp
// 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

Variable notInFile is not used.

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.

Suggested changeset 1
modules/interpreter/src/cpp/Evaluator.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/modules/interpreter/src/cpp/Evaluator.cpp b/modules/interpreter/src/cpp/Evaluator.cpp
--- a/modules/interpreter/src/cpp/Evaluator.cpp
+++ b/modules/interpreter/src/cpp/Evaluator.cpp
@@ -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) {
EOF
@@ -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) {
Copilot is powered by AI and may make mistakes. Always verify output.
@Nelson-numerical-software
Nelson-numerical-software merged commit 8539521 into master Jan 16, 2026
1 check passed
@Nelson-numerical-software Nelson-numerical-software moved this to DONE 1.17.0 in Nelson 2026 Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: DONE 1.17.0

Development

Successfully merging this pull request may close these issues.

3 participants