Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created August 12, 2015 18:15
Show Gist options
  • Save legumbre/65e3dbcbd0717f10107b to your computer and use it in GitHub Desktop.
Save legumbre/65e3dbcbd0717f10107b to your computer and use it in GitHub Desktop.
Toggle breakpoint command from a gud source buffer
(defun my-gud-toggle-breakpoint ()
"Enable/disable breakpoint at the current line of source buffer."
(interactive)
(save-excursion
(beginning-of-line)
(let* ((bol (point))
(ovl (overlay-get (car (overlays-in bol bol)) 'before-string))
(bptno (get-text-property 0 'gdb-bptno ovl))
(bpten (get-text-property 0 'gdb-enabled ovl)))
(if bpten (gud-basic-call (format "-break-disable %s" bptno))
(gud-basic-call (format "-break-enable %s" bptno))))))
;; Use M-: (overlay-get (car (overlays-in (point) (point))) 'before-string)
;; to see the rest of the text properties addded by gud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment