Browse Source

Add support for deactivating breakpoints

workspaces
Nicolas Petton 3 years ago
parent
commit
ce3f0963fc
Signed by: nico GPG Key ID: 233587A47C207910
5 changed files with 54 additions and 1 deletions
  1. +10
    -0
      indium-backend.el
  2. +14
    -1
      indium-interaction.el
  3. +14
    -0
      indium-v8-inspector.el
  4. +14
    -0
      indium-webkit.el
  5. +2
    -0
      sphinx-doc/code-evaluation.rst

+ 10
- 0
indium-backend.el View File

@ -164,6 +164,16 @@ A breakpoint is an alist with the keys `id', `file', and `line'."
(line . ,(map-nested-elt breakpoints `(,key line)))))
breakpoints)))
(cl-defgeneric indium-backend-deactivate-breakpoints (backend)
"Deactivate all breakpoints.
The runtime will not pause on any breakpoint."
)
(cl-defgeneric indium-backend-activate-breakpoints (backend)
"Deactivate all breakpoints.
The runtime will not pause on any breakpoint."
)
(defun indium-backend-get-breakpoints-in-file (file)
"Return all breakpoints in FILE."
(let ((breakpoints (indium-backend-get-breakpoints)))


+ 14
- 1
indium-interaction.el View File

@ -83,7 +83,6 @@ If PRINT is non-nil, print the output into the current buffer."
(insert description))
(indium-message "%s" description))))))))
(defun indium-reload ()
"Reload the page."
(interactive)
@ -120,6 +119,18 @@ If PRINT is non-nil, print the output into the current buffer."
(interactive)
(indium-breakpoint-remove-all))
(defun indium-deactivate-breakpoints ()
"Deactivate all breakpoints in all buffers.
Breakpoints are not removed, but the runtime won't pause when
hitting a breakpoint."
(interactive)
(indium-backend-deactivate-breakpoints (indium-backend)))
(defun indium-activate-breakpoints ()
"Activate all breakpoints in all buffers."
(interactive)
(indium-backend-activate-breakpoints (indium-backend)))
(defun indium-interaction-node-before-point ()
"Return the node before point to be evaluated."
(save-excursion
@ -164,6 +175,8 @@ If PRINT is non-nil, print the output into the current buffer."
(define-key map (kbd "C-c C-k") #'indium-update-script-source)
(define-key map (kbd "C-c b b") #'indium-toggle-breakpoint)
(define-key map (kbd "C-c b K") #'indium-remove-all-breakpoints-from-buffer)
(define-key map (kbd "C-c b a") #'indium-activate-breakpoints)
(define-key map (kbd "C-c b d") #'indium-deactivate-breakpoints)
map))
;;;###autoload


+ 14
- 0
indium-v8-inspector.el View File

@ -120,6 +120,20 @@ non-nil, evaluate it with the breakpoint's location and id."
(lambda (response)
(indium-backend-unregister-breakpoint id))))
(cl-defgeneric indium-backend-deactivate-breakpoints ((backend (eql v8-inspector)))
"Deactivate all breakpoints.
The runtime will not pause on any breakpoint."
(indium-v8-inspector--send-request
`((method . "Debugger.setBreakpointsActive")
(params . ((active . :json-false))))))
(cl-defgeneric indium-backend-activate-breakpoints ((backend (eql v8-inspector)))
"Deactivate all breakpoints.
The runtime will not pause on any breakpoint."
(indium-v8-inspector--send-request
`((method . "Debugger.setBreakpointsActive")
(params . ((active . t))))))
(cl-defmethod indium-backend-get-properties ((backend (eql v8-inspector)) reference &optional callback all-properties)
"Get the properties of the remote object represented by REFERENCE.
CALLBACK is evaluated with the list of properties.


+ 14
- 0
indium-webkit.el View File

@ -126,6 +126,20 @@ non-nil, evaluate it with the breakpoint's location and id."
(lambda (_response)
(indium-backend-unregister-breakpoint id))))
(cl-defgeneric indium-backend-deactivate-breakpoints ((backend (eql webkit)))
"Deactivate all breakpoints.
The runtime will not pause on any breakpoint."
(indium-webkit--send-request
`((method . "Debugger.setBreakpointsActive")
(params . ((active . :json-false))))))
(cl-defgeneric indium-backend-activate-breakpoints ((backend (eql webkit)))
"Deactivate all breakpoints.
The runtime will not pause on any breakpoint."
(indium-webkit--send-request
`((method . "Debugger.setBreakpointsActive")
(params . ((active . t))))))
(cl-defmethod indium-backend-get-properties ((backend (eql webkit)) reference &optional callback all-properties)
"Get the properties of the remote object represented by REFERENCE.
CALLBACK is evaluated with the list of properties.


+ 2
- 0
sphinx-doc/code-evaluation.rst View File

@ -39,6 +39,8 @@ You need to first make sure that Indium is set up correctly to use local files
- ``C-c b b``: Toggle a breakpoint
- ``C-u C-c b b``: Toggle a breakpoint with condition
- ``C-c b K``: Remove all breakpoints from the current buffer
- ``C-c b d``: Deactivate all breakpoints (the runtime won't pause when hitting a breakpoint)
- ``C-c b d``: Activate all breakpoints (it has no effect if breakpoints have not been deactivated)
Once a breakpoint is set, execution will stop when a breakpoint is hit, and the
Indium debugger pops up (see :ref:`debugger`).


Loading…
Cancel
Save