If no argument specified use 0 or the most recent frame." t t)
(dbgr-define-command
- 'continue "continue %p" "c"
+ 'continue "continue" "c"
"Continue execution.")
(dbgr-define-command
"Restart execution."
't nil 't)
- (defun dbgr-cmd-step(arg)
- "Step one source line.
-
-With a numeric argument, step that many times.
-This command is often referred to as 'step into' as opposed to
-'step over' or 'step out'.
-
-The definition of 'step' is debugger specific so, see the
-debugger documentation for a more complete definition of what is
-getting stepped."
- (interactive "p")
- (let ((buffer (current-buffer))
- (cmdbuf (dbgr-get-cmdbuf))
- (cmd-hash)
- (cmd)
- )
- (with-current-buffer-safe cmdbuf
- (dbgr-cmdbuf-info-in-srcbuf?= dbgr-cmdbuf-info
- (not (dbgr-cmdbuf? buffer)))
- (setq cmd-hash (dbgr-cmdbuf-info-cmd-hash dbgr-cmdbuf-info))
- (unless (and cmd-hash (setq cmd (gethash "step" cmd-hash)))
- (setq cmd "step %p"))
- )
- (dbgr-command cmd arg 't)
- ))
+ (dbgr-define-command
+ 'restart "shell" "S"
+ "Run an interactive shell using the current environment."
+ 't nil 't)
(defun dbgr-cmd-quit (arg)
"Gently terminate execution of the debugged program."
-;;; Copyright (C) 2010 Rocky Bernstein <rocky@gnu.org>
+;;; Copyright (C) 2010, 2011 Rocky Bernstein <rocky@gnu.org>
(require 'load-relative)
(defcustom dbgr-populate-common-fn-keys-function
(define-key map "r" 'dbgr-cmd-restart)
(define-key map "R" 'dbgr-cmd-restart)
(define-key map "s" 'dbgr-cmd-step)
+ (define-key map "S" 'dbgr-cmd-shell)
(define-key map [M-down] 'dbgr-track-hist-newer)
(define-key map [M-kp-2] 'dbgr-track-hist-newer)
(define-key map [M-up] 'dbgr-track-hist-older)
(kbd "b") 'dbgr-cmd-break)
(define-key dbgr-short-key-mode-map
(kbd "c") 'dbgr-cmd-continue)
+(define-key dbgr-short-key-mode-map
+ (kbd "S") 'dbgr-cmd-shell)
+(define-key dbgr-short-key-mode-map
+ (kbd "R") 'dbgr-cmd-restart)
(define-key dbgr-short-key-mode-map [insert] 'dbgr-short-key-mode)
(define-key dbgr-short-key-mode-map [M-insert] 'dbgr-short-key-mode)
(dbgr-populate-common-keys dbgr-short-key-mode-map)
(setf (gethash "gdb" dbgr-pat-hash) dbgr-gdb-pat-hash)
(provide-me "dbgr-gdb-")
-
(setf (gethash "kshdb" dbgr-pat-hash) dbgr-kshdb-pat-hash)
+(defvar dbgr-kshdb-command-hash (make-hash-table :test 'equal)
+ "Hash key is command name like 'quit' and the value is
+ the trepan command to use, like 'quit!'")
+
+;; (setf (gethash "quit" dbgr-kshdb-command-hash) "quit!")
+(setf (gethash "kshdb" dbgr-command-hash dbgr-kshdb-command-hash))
+
+(setf (gethash "kshdb" dbgr-pat-hash) dbgr-kshdb-pat-hash)
+
(provide-me "dbgr-kshdb-")
(setf (gethash "pydbgr" dbgr-pat-hash) dbgr-pydbgr-pat-hash)
+(defvar dbgr-pydbgr-command-hash (make-hash-table :test 'equal)
+ "Hash key is command name like 'quit' and the value is
+ the pydbgr command to use, like 'quit!'")
+
+(setf (gethash "quit" dbgr-pydbgr-command-hash) "quit!")
+(setf (gethash "shell" dbgr-pydbgr-command-hash) "python")
+(setf (gethash "pydbgr" dbgr-command-hash) dbgr-pydbgr-command-hash)
+
(provide-me "dbgr-pydbgr-")
(setf (gethash "rdebug" dbgr-pat-hash) dbgr-rdebug-pat-hash)
+(defvar dbgr-rdebug-command-hash (make-hash-table :test 'equal)
+ "Hash key is command name like 'quit' and the value is
+ the trepanx command to use, like 'quit!'")
+
+(setf (gethash "quit" dbgr-rdebug-command-hash) "quit!")
+(setf (gethash "shell" dbgr-rdebug-command-hash) "irb")
+(setf (gethash "trepan" dbgr-command-hash) dbgr-rdebug-command-hash)
+
(provide-me "dbgr-rdebug-")
;; line 64 in file /src/external-vcs/linecache/trunk/lib/linecache.rb.
(setf (gethash "brkpt-set" dbgr-trepan-pat-hash)
(make-dbgr-loc-pat
- :regexp "^Breakpoint \\([0-9]+\\) set at line \\([0-9]+\\)[ \t\n]+in file \\(.+\\),\n"
+ :regexp "^Breakpoint \\([0-9]+\\) set at .*[\n\t ]+line \\([0-9]+\\)[ \t\n]+in file \\(.+\\)."
:num 1
:file-group 3
:line-group 2))
the trepan command to use, like 'quit!'")
(setf (gethash "quit" dbgr-trepan-command-hash) "quit!")
+(setf (gethash "shell" dbgr-trepan-command-hash) "irb")
(setf (gethash "trepan" dbgr-command-hash) dbgr-trepan-command-hash)
(provide-me "dbgr-trepan-")
;; Set breakpoint 1: /tmp/fact.rb:1 (@0)
(setf (gethash "brkpt-set" dbgr-trepanx-pat-hash)
(make-dbgr-loc-pat
- :regexp "^Breakpoint \\([0-9]+\\): \\(.+\\):\\([0-9]+\\) (@[0-9]+)\n"
+ :regexp "^Set breakpoint \\([0-9]+\\): .+ at \\(.+\\):\\([0-9]+\\) (@[0-9]+)"
:num 1
:file-group 2
:line-group 3))
;; (0 trepan-frames-current-frame-face append))
))
+(setf (gethash "trepanx" dbgr-pat-hash) dbgr-trepanx-pat-hash)
+
+(defvar dbgr-trepanx-command-hash (make-hash-table :test 'equal)
+ "Hash key is command name like 'quit' and the value is
+ the trepanx command to use, like 'quit!'")
+
+(setf (gethash "quit" dbgr-trepanx-command-hash) "quit!")
+(setf (gethash "shell" dbgr-trepanx-command-hash) "irb")
+(setf (gethash "trepan" dbgr-command-hash) dbgr-trepanx-command-hash)
+
(provide-me "dbgr-trepanx-")
)
)
- (lexical-let ((text "Breakpoint 1 set at line 9
- in file /usr/local/bin/irb,
- VM offset 2 of instruction sequence <top (required)>."))
+ (lexical-let ((text "Breakpoint 1 set at VM offset 2 of instruction sequence \"<top /usr/local/bin/irb>\",
+ line 9 in file /usr/local/bin/irb.
+"))
(specify "basic breakpoint location"
(assert-t (numberp (loc-match text bps-pat))))
(specify "extract breakpoint file name"
;; setq however will workaround this.
(setq text " \e[0;31m Object#boom at tmp/boom.rb:2\e[0m")
-(context "traceback location matching"
- (tag regexp-trepanx)
- (specify "basic traceback location"
- (assert-t (numberp (tb-loc-match text))))
- (specify "extract traceback file name"
- (assert-equal 0 (tb-loc-match text))
- (assert-equal "tmp/boom.rb"
- (match-string (dbgr-loc-pat-file-group tb)
- text))
- (setq text
- " { } in main.__script__ at /tmp/blam.rb:5")
- (assert-equal 0 (tb-loc-match text))
- (assert-equal "/tmp/blam.rb"
- (match-string (dbgr-loc-pat-file-group tb)
- text))
- (specify "extract traceback line number"
- (assert-equal "5"
- (match-string (dbgr-loc-pat-line-group tb)
- text)))
-
- ;; (specify "prompt"
- ;; (assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt)
- ;; "(trepanx): "))
- ;; (assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt)
- ;; "((trepanx)): "))
- ;; (assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt)
- ;; "((trepanx@55)): "))
- ;; (assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt)
- ;; "((trepanx@main)): "))
- ;; )
-
- ;; (lexical-let ((text "Breakpoint 1 set at line 9
- ;; in file /usr/local/bin/irb,
- ;; VM offset 2 of instruction sequence <top (required)>."))
- ;; (specify "basic breakpoint location"
- ;; (assert-t (numberp (bp-loc-match text))))
- ;; (specify "extract breakpoint file name"
- ;; (assert-equal "/usr/local/bin/irb"
- ;; (match-string (dbgr-loc-pat-file-group bps)
- ;; text)))
- ;; (specify "extract breakpoint line number"
- ;; (assert-equal "9"
- ;; (match-string (dbgr-loc-pat-line-group bps)
- ;; text)))
- ;; )
- )
- )
+(context
+ "traceback location matching"
+ (tag regexp-trepanx)
+ (specify "basic traceback location"
+ (assert-t (numberp (tb-loc-match text))))
+ (specify "extract traceback file name"
+ (assert-equal 0 (tb-loc-match text))
+ (assert-equal "tmp/boom.rb"
+ (match-string (dbgr-loc-pat-file-group tb)
+ text))
+ (setq text
+ " { } in main.__script__ at /tmp/blam.rb:5")
+ (assert-equal 0 (tb-loc-match text))
+ (assert-equal "/tmp/blam.rb"
+ (match-string (dbgr-loc-pat-file-group tb)
+ text))
+ )
+ (specify "extract traceback line number"
+ (assert-equal "5"
+ (match-string (dbgr-loc-pat-line-group tb)
+ text)))
+
+ ;; (specify "prompt"
+ ;; (assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt)
+ ;; "(trepanx): "))
+ ;; (assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt)
+ ;; "((trepanx)): "))
+ ;; (assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt)
+ ;; "((trepanx@55)): "))
+ ;; (assert-equal 0 (string-match (dbgr-loc-pat-regexp prompt)
+ ;; "((trepanx@main)): "))
+ ;; )
+
+ (lexical-let
+ ((text "Set breakpoint 1: __script__() at /bin/irb:2 (@0)"))
+ (specify "basic breakpoint location"
+ (assert-t (numberp (bp-loc-match text))))
+ (specify "extract breakpoint file name"
+ (assert-equal "/bin/irb"
+ (match-string (dbgr-loc-pat-file-group bps)
+ text)))
+ (specify "extract breakpoint line number"
+ (assert-equal "2"
+ (match-string (dbgr-loc-pat-line-group bps)
+ text)))
+ )
+ )
(test-unit "regexp-trepanx")