Windows野郎で未だにWSL1の情弱である私も、昨日の記事で遂に Mozilla rr が使えるようになりました。
しかし、Emacsで使いにくい。Emacs用のパッケージも特に無さそう?というわけで、設定追加したので晒してみる。 -exec-reverse-continue見たいなコマンドはないっぽいけど、取りあえず、何か何とか動いてます。
基本的には gdb
を呼び出してるだけです。
- M-x → rr : rr replayを起動
- M-x → rr-record: rr recordを起動
- F8: continue
- Ctrl + F8: reverse-continue
- F9: step
- Ctrl + F9: reverse-step
- F10: next
- Ctrl + F10: reverse-next
- F11: finish
- Ctrl + F11: reverse-finish
(use-package gdb-mi :init (defcustom gud-rr-command-name "rr replay -i=mi" "Default command to execute an executable under the Mozilla rr debugger." :type 'string :group 'gdb) (defcustom gud-rr-record-command-name "rr record" "Default command to execute an executable under the Mozilla rr recode." :type 'string :group 'gdb) (defun rr (command-line) "rr replay" (interactive (list (gud-query-cmdline 'rr ""))) (gdb command-line) (gud-def gud-reverse-next "reverse-next %p" "\C-r" "Step one line (skip functions).") (gud-def gud-reverse-step "reverse-step %p" "\C-e" "Step one line (skip functions).") (gud-def gud-reverse-continue "reverse-continue" "\C-w" "Step one line (skip functions).") ) (defun rr-record (command-line) "rr record" (interactive (list (gud-query-cmdline 'rr-record))) (compile command-line)) :config ;; global-display-line-numbersを有効にしてるので、変数バッファなどで無効化 (defun my-disable-display-line-numbers (orig-func &rest args) (let ((r (apply orig-func args))) (remove-hook 'pre-command-hook #'display-line-numbers-update-width t) (setq display-line-numbers nil) r)) (advice-add 'gud-common-init :around #'my-disable-display-line-numbers) (advice-add 'gdb-get-buffer-create :around #'my-disable-display-line-numbers) (global-set-key (kbd "<f8>") 'gud-cont) (global-set-key (kbd "C-<f8>") 'gud-reverse-continue) (global-set-key (kbd "<f9>") 'gud-step) (global-set-key (kbd "C-<f9>") 'gud-reverse-step) (global-set-key (kbd "<f11>") 'gud-finish) (global-set-key (kbd "C-<f11>") 'gud-reverse-finish))