gud-next and gud-stepi implemented
This commit is contained in:
parent
b73bfa3311
commit
076c96a331
1 changed files with 32 additions and 6 deletions
38
gudap.el
38
gudap.el
|
@ -76,7 +76,10 @@
|
||||||
:accessor gudap-current-thread)
|
:accessor gudap-current-thread)
|
||||||
(current-frame
|
(current-frame
|
||||||
:initform nil
|
:initform nil
|
||||||
:accessor gudap-current-frame)))
|
:accessor gudap-current-frame)
|
||||||
|
(stopped
|
||||||
|
:initform t
|
||||||
|
:accessor gudap-stopped)))
|
||||||
|
|
||||||
(defvar gudap-server-programs-and-launch
|
(defvar gudap-server-programs-and-launch
|
||||||
'(((c++-mode c-mode rust-mode) "lldb-vscode" (lambda ()
|
'(((c++-mode c-mode rust-mode) "lldb-vscode" (lambda ()
|
||||||
|
@ -163,6 +166,24 @@
|
||||||
:breakpoints source-breakpoints))))
|
:breakpoints source-breakpoints))))
|
||||||
(gudap--message "No breakpoints at location!")))))
|
(gudap--message "No breakpoints at location!")))))
|
||||||
|
|
||||||
|
(defun gudap--gud-next ()
|
||||||
|
(interactive)
|
||||||
|
(gudap-with-initialized gudap-active-server
|
||||||
|
(if (gudap-stopped server)
|
||||||
|
(gudap-send-request
|
||||||
|
server
|
||||||
|
'next
|
||||||
|
(list :threadId (gudap-current-thread server))))))
|
||||||
|
|
||||||
|
(defun gudap--gud-stepi ()
|
||||||
|
(interactive)
|
||||||
|
(gudap-with-initialized gudap-active-server
|
||||||
|
(if (gudap-stopped server)
|
||||||
|
(gudap-send-request
|
||||||
|
server
|
||||||
|
'stepIn
|
||||||
|
(list :threadId (gudap-current-thread server))))))
|
||||||
|
|
||||||
(defun gudap--dap-type-source (file-path)
|
(defun gudap--dap-type-source (file-path)
|
||||||
(list :path file-path))
|
(list :path file-path))
|
||||||
|
|
||||||
|
@ -179,6 +200,8 @@
|
||||||
(defalias 'gud-cont 'gudap--gud-cont)
|
(defalias 'gud-cont 'gudap--gud-cont)
|
||||||
(defalias 'gud-run 'gudap--gud-run)
|
(defalias 'gud-run 'gudap--gud-run)
|
||||||
(defalias 'gud-remove 'gudap--gud-remove)
|
(defalias 'gud-remove 'gudap--gud-remove)
|
||||||
|
(defalias 'gud-next 'gudap--gud-next)
|
||||||
|
(defalias 'gud-stepi 'gudap--gud-stepi)
|
||||||
|
|
||||||
(setq gdb-first-prompt t)
|
(setq gdb-first-prompt t)
|
||||||
(setq gud-running nil)
|
(setq gud-running nil)
|
||||||
|
@ -313,8 +336,6 @@
|
||||||
:command (symbol-name command)
|
:command (symbol-name command)
|
||||||
:arguments arguments)))
|
:arguments arguments)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; RESPONSES
|
;;; RESPONSES
|
||||||
|
|
||||||
(cl-defgeneric gudap-handle-response (server command success body err-msg)
|
(cl-defgeneric gudap-handle-response (server command success body err-msg)
|
||||||
|
@ -332,6 +353,9 @@
|
||||||
(cl-defmethod gudap-handle-response (server (type (eql evaluate)) _success _body err-msg)
|
(cl-defmethod gudap-handle-response (server (type (eql evaluate)) _success _body err-msg)
|
||||||
(gudap-gud-output server err-msg))
|
(gudap-gud-output server err-msg))
|
||||||
|
|
||||||
|
(cl-defmethod gudap-handle-response (server (type (eql continue)) (success (eql t)) _body err-msg)
|
||||||
|
(setf (gudap-stopped server) nil))
|
||||||
|
|
||||||
(cl-defmethod gudap-handle-response (server command success body err-msg)
|
(cl-defmethod gudap-handle-response (server command success body err-msg)
|
||||||
(gudap--message "unknown response: %s" body))
|
(gudap--message "unknown response: %s" body))
|
||||||
|
|
||||||
|
@ -353,7 +377,8 @@
|
||||||
(setf (gudap-initialized server) t))
|
(setf (gudap-initialized server) t))
|
||||||
|
|
||||||
(cl-defmethod gudap-handle-event (server (event (eql terminated)) body)
|
(cl-defmethod gudap-handle-event (server (event (eql terminated)) body)
|
||||||
(setf (gudap-initialized server) nil))
|
(setf (gudap-initialized server) nil
|
||||||
|
(gudap-stopped server) t))
|
||||||
|
|
||||||
(defun gudap-gud-goto-frame-from-stack-trace (server success stack-trace-body)
|
(defun gudap-gud-goto-frame-from-stack-trace (server success stack-trace-body)
|
||||||
(when success
|
(when success
|
||||||
|
@ -369,8 +394,9 @@
|
||||||
(cl-destructuring-bind (&key reason threadId &allow-other-keys) body
|
(cl-destructuring-bind (&key reason threadId &allow-other-keys) body
|
||||||
(cond
|
(cond
|
||||||
( ;; breakpoint
|
( ;; breakpoint
|
||||||
(equal reason "breakpoint")
|
(or (equal reason "breakpoint") (equal reason "step"))
|
||||||
(setf (gudap-current-thread server) threadId)
|
(setf (gudap-current-thread server) threadId
|
||||||
|
(gudap-stopped server) t)
|
||||||
(gudap-send-request server
|
(gudap-send-request server
|
||||||
'stackTrace
|
'stackTrace
|
||||||
(list :threadId threadId
|
(list :threadId threadId
|
||||||
|
|
Loading…
Add table
Reference in a new issue