create debug layer

This commit is contained in:
CeleritasCelery 2017-07-18 15:54:00 -06:00 committed by syl20bnr
parent 1a5664e436
commit 6e684739cb
11 changed files with 159 additions and 56 deletions

View File

@ -14,7 +14,6 @@
- [[#rtags-configuration][RTags configuration]]
- [[#enable-google-set-c-style][Enable google-set-c-style]]
- [[#key-bindings][Key Bindings]]
- [[#debugging-realgud][Debugging (realgud)]]
- [[#formatting-clang-format][Formatting (clang-format)]]
- [[#rtags][RTags]]
@ -145,23 +144,6 @@ set that up like this:
*Note:* [[https://github.com/tuhdo/semantic-refactor][semantic-refactor]] is only available for Emacs 24.4+.
** Debugging (realgud)
| Key Binding | Description |
|-------------+-----------------|
| ~SPC m d d~ | open cmd buffer |
| ~SPC m d e~ | eval variable |
| ~s~ | step over |
| ~i~ | step into |
| ~b~ | set break |
| ~B~ | unset break |
| ~o~ | step out |
| ~c~ | continue |
| ~e~ | eval variable |
| ~r~ | restart |
| ~q~ | quit debug |
| ~S~ | goto cmd buffer |
** Formatting (clang-format)
| Key Binding | Description |

View File

@ -135,15 +135,6 @@ and the arguments for flyckeck-clang based on a project-specific text file."
(spacemacs//c-c++-get-standard-include-paths "c"))
idirafter-paths)))))
;; realgud
(defun spacemacs//short-key-state (modeon)
"Set evil-evilified-state explicitly."
(if modeon
(evil-evilified-state)
(evil-normal-state)))
;; rtags

View File

@ -201,32 +201,9 @@
"gX" 'rtags-fix-fixit-at-point
"gY" 'rtags-cycle-overlays-on-screen)))))
(defun c-c++/init-realgud()
(use-package realgud
:defer t
:commands (realgud:gdb)
:init
(progn
(dolist (mode c-c++-modes)
(spacemacs/set-leader-keys-for-major-mode mode
"dd" 'realgud:gdb
"de" 'realgud:cmd-eval-dwim))
(advice-add 'realgud-short-key-mode-setup
:before #'spacemacs//short-key-state)
(evilified-state-evilify-map realgud:shortkey-mode-map
:eval-after-load realgud
:mode realgud-short-key-mode
:bindings
"s" 'realgud:cmd-next
"i" 'realgud:cmd-step
"b" 'realgud:cmd-break
"B" 'realgud:cmd-clear
"o" 'realgud:cmd-finish
"c" 'realgud:cmd-continue
"e" 'realgud:cmd-eval
"r" 'realgud:cmd-restart
"q" 'realgud:cmd-quit
"S" 'realgud-window-cmd-undisturb-src))))
(defun c-c++/post-init-realgud()
(dolist (mode c-c++-modes)
(spacemacs/add-realgud-debugger mode "gdb")))
(defun c-c++/init-google-c-style ()
(use-package google-c-style

View File

@ -22,6 +22,7 @@ This layer adds support for the Perl5 language.
- Auto-completion using [[https://github.com/CeleritasCelery/company-plsense][company-plsense]]
- Format code with =perltidy=
- Jump to symbol definition
- Interactive debug via [[https://github.com/realgud/realgud][realgud]] with [[http://search.cpan.org/~rocky/Devel-Trepan-0.73/lib/Devel/Trepan.pm][trepan.pl]]
* Install
** Layer

View File

@ -15,6 +15,7 @@
(cperl-mode :location built-in)
flycheck
smartparens
realgud
))
(defun perl5/init-company-plsense ()
@ -22,8 +23,8 @@
:defer t
:init
(spacemacs|add-company-backends
:backends company-plsense
:modes cperl-mode)))
:backends company-plsense
:modes cperl-mode)))
(defun perl5/init-cperl-mode ()
(use-package cperl-mode
@ -116,7 +117,7 @@
"v" 'cperl-select-this-pod-or-here-doc)
(font-lock-add-keywords 'cperl-mode
'(("\\_<say\\_>" . cperl-nonoverridable-face))))))
'(("\\_<say\\_>" . cperl-nonoverridable-face))))))
(defun perl5/post-init-flycheck ()
(spacemacs/enable-flycheck 'cperl-mode))
@ -126,3 +127,6 @@
(with-eval-after-load 'cperl-mode
(add-hook 'smartparens-enabled-hook 'spacemacs//perl5-smartparens-enable)
(add-hook 'smartparens-disabled-hook 'spacemacs//perl5-spartparens-disable)))
(defun perl5/post-init-realgud()
(spacemacs/add-realgud-debugger 'cperl-mode "trepan.pl"))

View File

@ -0,0 +1,62 @@
#+TITLE: debug layer
[[file:img/debug.png]]
* Table of Contents :TOC_4_gh:noexport:
- [[#description][Description]]
- [[#features][Features:]]
- [[#install][Install]]
- [[#enable-additional-debuggers][Enable additional debuggers]]
- [[#key-bindings][Key bindings]]
- [[#major-mode][Major Mode]]
- [[#debugger][Debugger]]
* Description
This layer adds interactive debuggers for mulitple languages using [[https://github.com/realgud/realgud][realgud]].
** Features:
- Modern rewrite of the Emacs GUD debugger family
- Visual interface including breakpoint and line indicators
- Advanced features like stack frame navigation and mouse support
- Extensible framework for [[https://github.com/realgud/realgud/wiki/How-to-add-a-new-debugger][adding]] your own external debuggers
* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =debug= to the existing =dotspacemacs-configuration-layers= list in this
file.
** Enable additional debuggers
Language specific debuggers are added by the respective layers. If you want to
add additional debuggers, add them to the =debug-additional-debuggers= variable.
Make sure that your debugger is compatible by checking [[https://github.com/realgud/realgud/wiki/Debuggers-Supported][here]].
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers
'((debug :variables debug-additional-debuggers '("remake"))))
#+END_SRC
* Key bindings
** Major Mode
| Key Binding | Description |
|-------------+-----------------|
| ~SPC m d d~ | open cmd buffer |
** Debugger
| Key Binding | Description |
|-------------+----------------------|
| ~s~ | step over |
| ~i~ | step into |
| ~o~ | step out |
| ~c~ | continue |
| ~J~ | jump to current line |
| ~e~ | eval variable |
| ~r~ | restart |
| ~q~ | quit debug |
| ~S~ | goto cmd buffer |
| ~bb~ | set break |
| ~bc~ | clear break |
| ~bd~ | delete break |
| ~bs~ | disable break |
| ~be~ | enable break |

View File

@ -0,0 +1,13 @@
;;; config.el --- Debug Layer Configuration File for Spacemacs
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Troy Hinckley <troy.hinckley@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defvar debug-additional-debuggers '()
"Additional RealGUD debuggers to be autoloaded.")

View File

@ -0,0 +1,27 @@
;;; funcs.el --- Debug layer function file for Spacemacs.
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Troy Hinckley <troy.hinckley@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun debug-short-key-state (mode-on)
"Set evil-evilified-state explicitly."
(if mode-on
(evil-evilified-state)
(evil-normal-state)))
(defun debug-generate-symbol (debugger)
"Create RealGUD interactive function name from DEBUGGER."
(intern (concat "realgud:" debugger)))
(defun spacemacs/add-realgud-debugger (mode debugger)
"Add RealGUD DEBUGGER to MODE."
(let ((dbg-name (debug-generate-symbol debugger)))
(spacemacs/set-leader-keys-for-major-mode mode
"dd" dbg-name)
(autoload dbg-name "realgud" nil t)))

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,45 @@
;;; packages.el --- Debug Layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Troy Hinckley <troy.hinckley@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defconst debug-packages
'(realgud))
(defun debug/init-realgud()
(use-package realgud
:defer t
:init
(dolist (debugger (mapcar 'debug-generate-symbol debug-additional-debuggers))
(autoload debugger "realgud" nil t))
(advice-add 'realgud-short-key-mode-setup
:before #'debug-short-key-state)
(evilified-state-evilify-map realgud:shortkey-mode-map
:eval-after-load realgud
:mode realgud-short-key-mode
:bindings
"s" 'realgud:cmd-next
"i" 'realgud:cmd-step
"o" 'realgud:cmd-finish
"c" 'realgud:cmd-continue
"J" 'realgud:cmd-jump
"bb" 'realgud:cmd-break
"bc" 'realgud:cmd-clear
"bd" 'realgud:cmd-delete
"bs" 'realgud:cmd-disable
"be" 'realgud:cmd-enable
"v" 'realgud:cmd-eval-dwim
"r" 'realgud:cmd-restart
"q" 'realgud:cmd-quit
"S" 'realgud-window-cmd-undisturb-src)))

View File

@ -162,6 +162,7 @@
- [[file:+tools/cmake/README.org][cmake]]
- [[file:+tools/command-log/README.org][command-log]]
- [[file:+tools/dash/README.org][dash]]
- [[file:+tools/debug/README.org][debug]]
- [[file:+tools/deft/README.org][deft]]
- [[file:+tools/docker/README.org][docker]]
- [[file:+tools/fasd/README.org][fasd]]