add gdb debugger mode configuration and keybinds

This commit is contained in:
Gered 2024-12-07 17:40:32 -05:00
parent c0bd2e28bd
commit 8cc53dbc31

View file

@ -13,3 +13,62 @@
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode))
(defun gud-quit ()
"Quits out of the current GDB session."
(interactive)
(gud-basic-call "quit"))
(defun gud-start ()
"Starts execution of the program in GDB."
(interactive)
(gud-basic-call "start"))
(defun gud-kill ()
"Terminates execution of the running program in GDB."
(interactive)
(gud-basic-call "kill"))
(defun gud-step-into ()
"Steps execution to the next line."
(interactive)
(gud-step 1))
(defun gud-step-over ()
"Steps execution to the next line, skipping over functions."
(interactive)
(gud-next 1))
(defun gud-step-out ()
"Steps execution out of the current function."
(interactive)
(gud-finish 1))
(defun gud-set-breakpoint ()
"Sets a debugger breakpoint on the current line."
(interactive)
(gud-break 1))
(defun gud-remove-breakpoint ()
"Removes a debugger breakpoint from the current line."
(interactive)
(gud-remove 1))
(use-package gdb-mi
:bind
( :map gud-minor-mode-map
("<f5>" . 'gud-start)
("S-<f5>" . 'gud-kill)
("<f9>" . 'gud-cont)
("<f7>" . 'gud-step-into)
("<f8>" . 'gud-step-over)
("S-<f8>" . 'gud-step-out)
("C-c b" . 'gud-set-breakpoint)
("C-c B" . 'gud-remove-breakpoint)
("C-q" . 'gud-quit))
:config
(setq gdb-many-windows t)
(setq gdb-restore-window-configuration-after-quit 'if-gdb-many-windows)
(setq gdb-debuginfod-enable-setting nil)
(gud-tooltip-mode t))