Skip to content

Commit

Permalink
Add watch command to repl
Browse files Browse the repository at this point in the history
  • Loading branch information
svaante committed Dec 10, 2024
1 parent 0a7eaa8 commit 0238a63
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions dape.el
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ left-to-right display order of the properties."
("sources" . dape-list-sources)
("breakpoints" . dape-list-breakpoints)
("scope" . dape-list-scope)
("watch" . dape-list-watch)
("restart" . dape-restart)
("kill" . dape-kill)
("disconnect" . dape-disconnect-quit)
Expand Down Expand Up @@ -2643,6 +2644,11 @@ When SKIP-UPDATE is non nil, does not notify adapter about removal."
(interactive)
(dape--repl-insert-info-buffer 'dape-info-scope-mode 0))

(defun dape-list-watch ()
"List watched variables for active debug session."
(interactive)
(dape--repl-insert-info-buffer 'dape-info-watch-mode))

(defun dape-watch-dwim (expression &optional skip-add skip-remove)
"Add or remove watch for EXPRESSION.
Watched symbols are displayed in *`dape-info' Watch* buffer.
Expand Down Expand Up @@ -2671,8 +2677,9 @@ Optional argument SKIP-REMOVE limits usage to only adding watched vars."
(unless skip-add
(push (list :name expression)
dape--watched)
;; FIXME Remove dependency on ui in core commands
(dape--display-buffer (dape--info-get-buffer-create 'dape-info-watch-mode))))
(when (called-interactively-p 'interactive)
;; FIXME Remove dependency on ui in core commands
(dape--display-buffer (dape--info-get-buffer-create 'dape-info-watch-mode)))))
(run-hooks 'dape-update-ui-hook))

(defun dape-evaluate-expression (conn expression)
Expand Down Expand Up @@ -4158,9 +4165,7 @@ current buffer with CONN config."
(plist-get dape--info-variable :name))
(eq major-mode 'dape-info-watch-mode)
(eq major-mode 'dape-info-scope-mode))
(when (derived-mode-p 'dape-info-parent-mode)
(gdb-set-window-buffer
(dape--info-get-buffer-create 'dape-info-watch-mode) t)))
(revert-buffer))

(dape--buffer-map dape-info-variable-name-map dape-info-scope-watch-dwim)

Expand Down

0 comments on commit 0238a63

Please sign in to comment.