Skip to content

Commit

Permalink
Move `dape-on-stopped-hooks' back to it's original place
Browse files Browse the repository at this point in the history
There is nothing in the manual that says that a thread needs to be
stopped so let's just use the last adapter for reading and writing
memory.  If that is the case we should revert the hook call point as
it makes more sense at the end of stopped event.
  • Loading branch information
svaante committed Feb 29, 2024
1 parent cb5e776 commit 8ef6b77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dape.el
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,6 @@ Sets `dape--thread-id' from BODY and invokes ui refresh with
(dape--update-threads conn
(plist-get body :threadId)
(plist-get body :allThreadsStopped))
(run-hooks 'dape-on-stopped-hooks)
(dape--update conn))
(if-let (((equal "exception" (plist-get body :reason)))
(texts
Expand All @@ -1740,7 +1739,8 @@ Sets `dape--thread-id' from BODY and invokes ui refresh with
(let ((str (mapconcat 'identity texts ":\n\t")))
(setf (dape--exception-description conn) str)
(dape--repl-message str 'dape-repl-error-face))
(setf (dape--exception-description conn) nil)))
(setf (dape--exception-description conn) nil))
(run-hooks 'dape-on-stopped-hooks))

(cl-defmethod dape-handle-event (conn (_event (eql continued)) body)
"Handle adapter CONN continued events.
Expand Down Expand Up @@ -2319,7 +2319,7 @@ Using BUFFER and STR."

(defun dape--memory-revert (&optional _ignore-auto _noconfirm _preserve-modes)
"Revert buffer function for `dape-memory-mode'."
(let* ((conn (dape--live-connection 'stopped))
(let* ((conn (dape--live-connection 'last))
(write-capable-p (dape--capable-p conn :supportsWriteMemoryRequest)))
(unless (dape--capable-p conn :supportsReadMemoryRequest)
(user-error "Adapter not capable of reading memory."))
Expand Down Expand Up @@ -2379,7 +2379,7 @@ Using BUFFER and STR."

(defun dape--memory-write ()
"Write buffer contents to stopped connection."
(let ((conn (dape--live-connection 'stopped))
(let ((conn (dape--live-connection 'last))
(buffer (current-buffer))
(start (point-min))
(end (point-max))
Expand Down

0 comments on commit 8ef6b77

Please sign in to comment.