diff --git a/Emacs/.config/emacs/.config/gdb-window-config b/Emacs/.config/emacs/.config/gdb-window-config new file mode 100644 index 0000000..4b40c63 --- /dev/null +++ b/Emacs/.config/emacs/.config/gdb-window-config @@ -0,0 +1 @@ +(((min-height . 8) (min-width . 20) (min-height-ignore . 6) (min-width-ignore . 8) (min-height-safe . 2) (min-width-safe . 4) (min-pixel-height . 144) (min-pixel-width . 160) (min-pixel-height-ignore . 108) (min-pixel-width-ignore . 64) (min-pixel-height-safe . 36) (min-pixel-width-safe . 32)) hc (pixel-width . 1910) (pixel-height . 1009) (total-width . 239) (total-height . 56) (normal-height . 1.0) (normal-width . 1.0) (combination-limit . t) (vc (pixel-width . 1184) (pixel-height . 1009) (total-width . 148) (total-height . 56) (normal-height . 1.0) (normal-width . 0.6198952879581152) (combination-limit) (leaf (pixel-width . 1184) (pixel-height . 682) (total-width . 148) (total-height . 38) (normal-height . 0.6778989098116948) (normal-width . 1.0) (parameters (context) (gdb-buffer-type . command)) (buffer " *gdb-placeholder*" (selected . t) (hscroll . 0) (fringes 10 0 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 1) (start . 1))) (leaf (last . t) (pixel-width . 1184) (pixel-height . 327) (total-width . 148) (total-height . 18) (normal-height . 0.32210109018830524) (normal-width . 1.0) (parameters (context) (gdb-buffer-type . gdb-breakpoints-buffer)) (buffer " *gdb-placeholder*" (selected) (hscroll . 0) (fringes 10 0 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated . t) (point . 1) (start . 1)))) (vc (last . t) (pixel-width . 726) (pixel-height . 1009) (total-width . 91) (total-height . 56) (normal-height . 1.0) (normal-width . 0.38010471204188484) (combination-limit) (leaf (pixel-width . 726) (pixel-height . 776) (total-width . 91) (total-height . 43) (normal-height . 0.7670961347869177) (normal-width . 1.0) (parameters (context) (gdb-buffer-type . source)) (buffer " *gdb-placeholder*" (selected) (hscroll . 0) (fringes 10 0 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 1) (start . 1))) (leaf (last . t) (pixel-width . 726) (pixel-height . 233) (total-width . 91) (total-height . 13) (normal-height . 0.23290386521308226) (normal-width . 1.0) (parameters (gdb-buffer-type . gdb-inferior-io)) (buffer " *gdb-placeholder*" (selected) (hscroll . 0) (fringes 10 0 nil nil) (margins nil) (scroll-bars nil 0 t nil 0 t nil) (vscroll . 0) (dedicated . t) (point . 1) (start . 1))))) \ No newline at end of file diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index a8f5d97..67da539 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -2519,15 +2519,11 @@ playing. ("SomaFM - The Trip" . "http://www.somafm.com/thetrip.pls")))) #+end_src ** Grand Unified Debugger (GUD) -GUD is a system for debugging, hooking into processes and -providing an interface to the user all in Emacs. Here I define a -hydra which provides a ton of the useful =gud= keybindings that exist -in an Emacs-only map. +GUD is a system for debugging, hooking into processes and providing an +interface to the user all in Emacs. Here I define a hydra for the +various =gud= keybindings, to make debugging a bit less painful. #+begin_src emacs-lisp (use-package gud - :config - (evil-set-initial-state 'gdb-disassembly-mode 'motion) - (evil-set-initial-state 'gdb-registers-mode 'motion) :after hydra :hydra (gud-hydra @@ -2563,8 +2559,66 @@ in an Emacs-only map. ("TAB" #'gud-stepi "Stepi" :column "Control Flow")) :general - (code-leader "d" #'gud-hydra/body - "D" #'gdb)) + (code-leader + "d" #'gud-hydra/body)) +#+end_src +** GDB +GDB is a little wrapper on top of GUD for GDB specific functionality. +#+begin_src emacs-lisp +(use-package gud + :after hydra + :init + (setopt gdb-default-window-configuration-file + (no-littering-expand-etc-file-name "gdb-window-config") + gdb-restore-window-configuration-after-quit t) + :config + (evil-set-initial-state 'gdb-disassembly-mode 'motion) + (evil-set-initial-state 'gdb-registers-mode 'motion) + (evil-set-initial-state 'gdb-locals-mode 'motion) + (evil-set-initial-state 'gdb-frames-mode 'motion) + (evil-set-initial-state 'gdb-threads-mode 'motion) + (evil-set-initial-state 'gdb-breakpoints-mode 'motion) + + (defun +gdb/switch-buffer (type) + (interactive) + (gdb-set-window-buffer + (gdb-get-buffer-create type gdb-thread-number) + t)) + + (cl-loop for type in '(gdb-locals-buffer + gdb-registers-buffer + gdb-stack-buffer + gdb-breakpoints-buffer + gdb-threads-buffer) + for name = (intern (concat "+gdb/--switch-" (symbol-name type))) + do (eval `(defun ,name () + (interactive) + (+gdb/switch-buffer ',type)))) + :hydra + (gdb-buffer-hydra + () "Hydra for the various buffers GDB generates" + ("l" #'+gdb/--switch-gdb-locals-buffer "locals") + ("r" #'+gdb/--switch-gdb-registers-buffer "registers") + ("f" #'+gdb/--switch-gdb-stack-buffer "frames") + ("b" #'+gdb/--switch-gdb-breakpoints-buffer "breakpoints") + ("t" #'+gdb/--switch-gdb-threads-buffer "threads") + ("ESC" nil "Exit" :exit t)) + :general + (code-leader + "g" #'gdb) + (local-leader + :keymaps 'gud-mode-map + "m" #'gdb-many-windows) + (nmmap + :keymaps 'gdb-frames-mode-map + "RET" #'gdb-select-frame) + (nmmap + :keymaps '(gdb-locals-mode-map + gdb-registers-mode-map + gdb-frames-mode-map + gdb-breakpoints-mode-map + gdb-threads-mode-map) + "TAB" #'gdb-buffer-hydra/body)) #+end_src ** Jira #+begin_src emacs-lisp