diff --git a/emacs.d/dev.el b/emacs.d/dev.el index 263b73e..49c0e80 100644 --- a/emacs.d/dev.el +++ b/emacs.d/dev.el @@ -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 + ("" . 'gud-start) + ("S-" . 'gud-kill) + ("" . 'gud-cont) + ("" . 'gud-step-into) + ("" . 'gud-step-over) + ("S-" . '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)) +