Fix conflict between matlab-shell debugging and C++ (or other language) debugging.
- matlab-shell debugging previously leveraged gud.el for debugging of *.m files.
- C++ debugging also leverages gud.el for debugging.
- Only one instance of a gud.el debugger can be active. If you run two, say
*.m debugging and C++ debugging. Then you get odd errors such as the
ebbreak not being recognized by gdb.
To fix these issue, I copied gud.el and made a new namespace "mlgud". I also
removed a lot of unused code from mlgud.el, though there's still more that can
be removed. Now one can debug *.m files and *.cpp files in one Emacs session.
(matlab-frame-init): Menu biding for ebstack now calls gud-list-breakpoints.
matlab-shell-gud.el:
Replace all bindings around mlg-show-breakpoints, and replace with
gud-list-breakpoints.
(gud-matlab-tool-bar-map): Add show stack and breakpoints.
Remove up/down.
Pull buttons from matlab-mode-map, not gud-minor-mode-map.
(matlab-shell-mode-gud-enable-bindings):
Bind stop-subjob to C-q
Finish is now dbstep out.
(matlab-shell-gud-minor-mode-map):
q now bound to stop-subjob.
(matlab-shell-mode-gud-enable-bindings): Update bindings.
Change remove breakpoint to be C-x.
Add ebstatus, ebstack on C-v, C-w.
(matlab-shell-gud-minor-mode-map): Update bindings.
change gud-remove to be x
Add SPC to be gud-step
show-stack is now w.
show breakpoints is now v.
show symbol value is now e
Remove e binding to "edit" - leave as C-x C-q only.
(define-minor-mode): Resort bindings in help to be
same as in MATLAB->Debug menu.
(matlab-shell-gud-menu): Delete
matlab.el:
(matlab-frame-init): Improve Debug menu.
Add exit gud debug mode.
Rename various items to be clearer.
Add list breakpoints and show stack.
(mlg-breakpoint): New slot: name.
(mlg-breakpooints::mlg-print): New method to print in a buffer.
(mlg-add-breakpoint): Add 'fcn' input - put in name slot.
(mlg-del-breakpoint): Add 'fcn' input - then ignore. Needed to line up w/ add.
(mlg-refresh-breakpoint-buffer, mlg-show-breakpoints): New
Manage contents of a buffer listing all the breakpoints.
(mlg-breakpoint-mode-map, mlg-breakpoint-mode-syntax-table): New.
(mlg-breakpoint-mode): New mode.
(mlg-breakpoint-quit, mlg-breakpoint-next, mlg-breakpoint-prev)
(mlg-breakpoint-click, mlg-breakpoint-choose):
New commands for breakpoint mode.
(matlab-shell-gud-minor-mode-map): Add 'w' to show breakpoints.
(easy-menu-define): Add Show Breakpoints menu item.
toolbox/ebstatus.m:
Always show the breakpoint buffer in emacs when called.
toolbox/+emacs/@Breakpoints/Breakpoints.m:
(updateEmacs): Add show input arg.
This forces breakpoints to show.
If not showing, update breakpoint buffer.
(gud-matlab-marker-filter): Remove old hotlink url output scanning.
Replace with evaluating forms sent from MATLAB.
When exiting debug mode, also find and close the stack window.
(mlg-set-stack-frame-via-gud): New, called from MATLAB.
(mlg-stack-quit): New for stack mode. Replaces 'delete-window which
sometimes fails.
(matlab-shell-gud-minor-mode-map): Add 'v' binding to view stack frame
window.
(easy-menu-define): Add "Show Stack" menu item to show stack window.
toolbox/+emacs/@Stack/Stack.m:
Add `StackPending' and `FramePending' flags for when that part changes.
(captureStack): New method - uses what was in updateEmacs for computing
the part of the stack we will use.
(updateEmacs): Remove chunk, put in above.
Always post the request to show, as this is used from ebstack, and it should
always do something.
(updateForHotLinks): New method, called from dbhotlinks.
Sends over stack only if needed.
(stackEqual): Rename output arg to better indicate what it is.
toolbox/dbhotlink.m:
Remove most of the content.
Replace with use of EmacsStack object, using updateForHotLinks method.
Enable dbstack display and navigation feature.
(mlg-stack-frame): New class.
(mlg-stack-frame::mlg-print): New method
(mlg-stack, mlg-frame): New variables.
(mlg-set-stack, mlg-set-stack-frame): New commands run from ML.
(mlg-show-frame, mlg-refresh-stack-buffer)
(mlg-show-stack): New commands to setup and display the stack.
(mlg-stack-mode-map, mlg-stack-mode-syntax-table): New
(mlg-stack-mode): New mode.
(mlg-stack-next, mlg-stack-prev, mlg-stack-click)
(mlg-stack-choose): New mode commands.
New compat macros for cl-defmethod, pulse, and font-lock stuff.
linemark.el, mlint.el, matlab-shell-gud.el, semanticdb-matlab.el:
Replace defmethod with cl-defmethod.
Replace call-next-method with cl-call-next-method.
linemark.el:
Also require matlab-compat.el
tests/Makefile:
Allow EMACS to be overridable
Enable debug commands via netshell.
(matlab-at-fcn): New macro, dispatch to netshell if active.
(matlab-gud-fcn): Revise doc, it was wrong.
Use matlab-at-fcn internally.
(matlab-shell-mode-gud-enable-bindings): Use matlab-at-fcn for
dbstop/dbclear.
(gud-matlab-tooltip-tips): Fix bug for events from the shell
buffer, which seem to generate events with a window that has no
buffer.
Add support for visible breakpoints.
(matlab-shell-mode-gud-enable-bindings): Use ebstop,ebclear instead
of dbstop,dbclear.
(mlg-breakpoint): New class.
(matlab-gud-visible-breakpoints): New variable.
(mlg-reset-breakpoints, mlg-add-breakpoints, mlg-del-breakpoint): New.
Manage list of breakpoints.
On first add, add matlab-mode-hook to activate breakpoints when a
new ML buffer is pulled into a buffer.
(mlg-breakpoint-face): New face.
(mlg-breakpoint::mlg-activate): New method.
Creates an overlay at the loction of the breakpoint.
(mlg-breakpoint::mlg-deactivate)
(mlg-breakpoint-activate-buffer-opened-hook): New
(mlg-breakpoint-flush-and-reactivate): New command for debugging.
(matlab-shell-gud-minor-mode): Fix bug - want to make-local-variable,
not make it buffer local.
Refine some of the debugging environment.
(matlab-shell-mode-gud-enable-bindings): Remove extra /
from stop/clear commands.
Don't provide a print.
(matlab-shell-gud-minor-mode-map): Add C-xC-q binding
to disable the minor mode. (like e)
(matlab-shell-gud-menu): Change text for exiting the minor mode.
Add show symbol value option.
(define-minor-mode): Replace the gud toolbar with our own.
Disable toolbar with our mode.
matlab.el:
Re-enable debug mode if it is available.
(matlab-mode-map): Replace `toggle-read-only' with
a matlab version.
(matlab-toggle-read-only): New command.
If the debugger is active, turn on matlab-shell-gud-minor-mode.
Otherwise do read-only-mode.
(matlab-shell-gud-minor-mode): Make buffers in this mode read only.
Restore read only state by asking file if it is writable.
Do not change read only state for buffers w/out files.
(matlab-gud-fcn): New macro for controlling when gud commands are active.
(matlab-shell-mode-gud-enable-bindings): change gud commands to use
above macro.
Set gud-minor-mode to 'matlab
(gud-matlab-tool-bar-map): New.
(matlab-shell-mode-gud-enable-bindings): Disable gud toolbar.
(gud-matlab-debug-tracker): enable and disable gud toolbar only when K>> prompt is around.
Add debugging tooltips.
(matlab-shell-gud-startup): Remove `gud-overload-functions' code.
It doesn't seem to exist anymore.
(matlab-shell-gud-show-symbol-value): Use improved region query.
Don't show help if there was an error. Instead note the
error in minibuffer.
(gud-matlab-tooltip-tips): Use new fcn below to compute tip.
Use emacstipstring ML command to compute text to show.
(matlab-shell-gud-find-tooltip-expression): New.
Compute the expression to send to ML to display.
Add support for data tooltips when debugging.
(matlab-shell-gud-startup): Add matlab-mode to list of gud tooltip supported modes.
(matlab-shell-gud-minor-mode): Add enable/disable of gud-toolti-mode,
and our special hook.
(gud-matlab-tooltip-tips): New. Fcn for displaying a tooltip via the help of
gud-tooltip-mode, and tooltip-mode.
Add fancy debugging mode for MATLAB buffers.
(matlab-shell-gud-startup): Add a debug tracker hook.
(gud-matlab-marker-regexp-k>>): Rename from borig -1
(gud-matlab-marker-regexp->>): New
(gud-matlab-marker-regexp-2): Delete
(gud-matlab-marker-filter): Use renamed or new vars from above.
(gud-matlab-debug-active): New
(gud-matlab-debug-activate-hook, *-deactivate-hook): New
(gud-matlab-debug-tracker): New fcn to activate and deactivate
our special debug features.
(matlab-shell-gud-minor-mode-map)
(matlab-shell-god-menu)
(matlab-shell-gud-minor-mode)
(global-matlab-shell-gud-minor-mode)
(matlab-shell-gud-mode-edit)
(matlab-shell-gud-mode-help-notice)
(matlab-shell-gud-mode-help): New minor mode that provides
direct access to gud comands w/out prefix keys.
New, content copied from matlab-shell, includes
all the GUD specific support, including the process filter.
Makefile, Project.ede:
Include matlab-shell-gud.el