(dbgr-cmd-remap arg "break" "break %X:l" "b")
)
-(defun dbgr-cmd-step(&optional 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")
- (dbgr-cmd-remap arg "step" "step %p" "s")
+(defun dbgr-cmd-continue(&optional arg)
+ "Continue execution."
+ (interactive "MContinue args: ")
+ (dbgr-cmd-remap arg "continue" "continue" "c")
)
-(defun dbgr-cmd-next(&optional arg)
- "Step one source line at current call level.
-
-With a numeric argument, step that many times. This command is
-often referred to as 'step through' as opposed to 'step into' 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")
- (dbgr-cmd-remap arg "next" "next %p" "n")
+(defun dbgr-cmd-eval(arg)
+ "Exaluate an expression."
+ (interactive "MEval expesssion: ")
+ (dbgr-cmd-remap arg "eval" "eval %s" "e")
)
+(defun dbgr-cmd-eval-region(start end)
+ (interactive "r")
+ (let ((text (buffer-substring-no-properties start end)))
+ (dbgr-cmd-remap text "eval" "eval %s" "e")
+ )
+ )
+
(defun dbgr-cmd-finish(&optional arg)
"Run until the completion of the current stack frame.
(dbgr-cmd-remap arg "finish" "finish" "F")
)
+(defun dbgr-cmd-frame(&optional arg)
+ "Change the current frame number to the value of the numeric argument.
+If no argument specified use 0 or the most recent frame."
+ (dbgr-cmd-remap arg "frame" "frame %p" "f" t t)
+)
+
(defun dbgr-cmd-newer-frame(&optional arg)
"Move the current frame to a newer (more recent) frame.
With a numeric argument move that many levels forward."
(dbgr-cmd-remap arg "down" "down %p" "<" t t)
)
+(defun dbgr-cmd-next(&optional arg)
+ "Step one source line at current call level.
+
+With a numeric argument, step that many times. This command is
+often referred to as 'step through' as opposed to 'step into' 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")
+ (dbgr-cmd-remap arg "next" "next %p" "n")
+)
+
(defun dbgr-cmd-older-frame(&optional arg)
"Move the current frame to an older (less recent) frame.
With a numeric argument move that many levels back."
(dbgr-cmd-remap arg "up" "up %p" ">" t t)
)
-(defun dbgr-cmd-frame(&optional arg)
- "Change the current frame number to the value of the numeric argument.
-If no argument specified use 0 or the most recent frame."
- (dbgr-cmd-remap arg "frame" "frame %p" "f" t t)
-)
-
-(defun dbgr-cmd-continue(&optional arg)
- "Continue execution."
- (interactive "p")
- (dbgr-cmd-remap arg "continue" "continue" "c")
-)
-
(defun dbgr-cmd-restart(&optional arg)
"Restart execution."
- (interactive "p")
+ (interactive "MRestart args: ")
(dbgr-cmd-remap arg "restart" "run" "R" 't nil 't)
)
(defun dbgr-cmd-shell(&optional arg)
"Restart execution."
+ (interactive "p")
(dbgr-cmd-remap arg "shell" "shell" "S")
)
+(defun dbgr-cmd-step(&optional 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")
+ (dbgr-cmd-remap arg "step" "step %p" "s")
+)
+
(defun dbgr-cmd-quit (&optional arg)
"Gently terminate execution of the debugged program."
(interactive "p")
(setq dbgr-overlay-arrow2 nil)
(setq dbgr-overlay-arrow3 nil))
+(defun dbgr-goto-arrow1()
+ "Goto the position stored in dbgr-overlay-arrow1"
+ (interactive "")
+ (switch-to-buffer (marker-buffer dbgr-overlay-arrow1))
+ (goto-char dbgr-overlay-arrow1)
+ )
+
+(defun dbgr-goto-arrow2()
+ "Goto the position stored in dbgr-overlay-arrow2"
+ (interactive "")
+ (switch-to-buffer (marker-buffer dbgr-overlay-arrow2))
+ (goto-char dbgr-overlay-arrow2)
+ )
+
+(defun dbgr-goto-arrow3()
+ "Goto the position stored in dbgr-overlay-arrow3"
+ (interactive "")
+ (switch-to-buffer (marker-buffer dbgr-overlay-arrow3))
+ (goto-char dbgr-overlay-arrow3)
+ )
+
(defun dbgr-recenter-arrow1()
"If the current buffer contains dbgr-overlay-arrow1 go to that position"
(interactive "")
:help (documentation 'dbgr-cmd-restart)
))
+ (define-key menu-map [eval]
+ (dbgr-menu-item menu-map "eval" 'dbgr-cmd-eval-region
+ :enable '(dbgr-get-process)
+ :help (documentation 'dbgr-cmd-eval-region)
+ ))
+
(define-key menu-map [recenter]
(dbgr-menu-item menu-map "recenter" 'dbgr-recenter-arrow
:enable '(dbgr-get-process)
:help (documentation 'dbgr-recenter-arrow)
))
+ (define-key menu-map [1]
+ (dbgr-menu-item menu-map "arrow 1" 'dbgr-goto-arrow1
+ :enable '(dbgr-get-process)
+ :help (documentation 'dbgr-goto-arrow1)
+ ))
+
+ (define-key menu-map [2]
+ (dbgr-menu-item menu-map "arrow 2" 'dbgr-goto-arrow2
+ :enable '(dbgr-get-process)
+ :help (documentation 'dbgr-goto-arrow2)
+ ))
+
+ (define-key menu-map [3]
+ (dbgr-menu-item menu-map "arrow 3" 'dbgr-goto-arrow3
+ :enable '(dbgr-get-process)
+ :help (documentation 'dbgr-goto-arrow3)
+ ))
(define-key menu-map [menu-bar debugger line2] '(menu-item "--"))
(dbgr-send-command command-str (function dbgr-send-command-process)))
-(defun dbgr-expand-format (fmt-str &optional opt-num-str opt-buffer)
+(defun dbgr-expand-format (fmt-str &optional opt-str opt-buffer)
"Expands commands format characters inside FMT-STRING using values
-from the debugging session. OPT-NUM-STR is an optional number string.
+from the debugging session. OPT-STR is an optional string.
Some %-escapes in the string arguments are expanded. These are:
%f -- Name without directory of current source file.
%l -- Number of current source line.
%p -- Numeric prefix argument converted to a string
If no prefix argument %p is the null string.
+ %s -- value of opt-str.
+
"
(let* ((buffer (or opt-buffer (current-buffer)))
(srcbuf (dbgr-get-srcbuf buffer))
(src-file-name (and srcbuf (buffer-file-name srcbuf)))
- (num-arg (and opt-num-str (int-to-string opt-num-str)))
result)
(while (and fmt-str
(let ((case-fold-search nil))
- (string-match "\\([^%]*\\)%\\([dfFlpxX]\\)" fmt-str)))
+ (string-match "\\([^%]*\\)%\\([dfFlpxXs]\\)" fmt-str)))
(let* ((key-str (match-string 2 fmt-str))
(key (string-to-char key-str)))
(setq result
;; (gud-read-address))
;; ((eq key ?c)
;; (gud-find-class srcbuf))
- ((eq key ?p) num-arg)
+ ((eq key ?p) (if opt-str (int-to-string opt-str) ""))
+ ((eq key ?s) opt-str)
(t key)))))
(setq fmt-str (substring fmt-str (match-end 2))))
;; There might be text left in FMT-STR when the loop ends.
(defvar dbgr-short-key-mode-map (make-sparse-keymap)
"Keymap used in `dbgr-short-key-mode'.")
+(define-key dbgr-short-key-mode-map
+ (kbd "1") 'dbgr-goto-arrow1)
+(define-key dbgr-short-key-mode-map
+ (kbd "2") 'dbgr-goto-arrow2)
+(define-key dbgr-short-key-mode-map
+ (kbd "3") 'dbgr-goto-arrow3)
(define-key dbgr-short-key-mode-map
(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 "e") 'dbgr-cmd-eval-region)
(define-key dbgr-short-key-mode-map
(kbd "<") 'dbgr-cmd-newer-frame)
(define-key dbgr-short-key-mode-map
(dbgr-track-mode-vars "dbgr-perldb")
-(define-key dbgr-track-mode-map (kbd "C-c !b")
- 'dbgr-goto-backtrace-line)
+;(define-key dbgr-track-mode-map (kbd "C-c!b")
+; 'dbgr-goto-backtrace-line)
(declare-function dbgr-track-mode(bool))
the remake command to use, like 'q'")
(setf (gethash "break" dbgr-remake-command-hash) "break %l")
+(setf (gethash "eval" dbgr-remake-command-hash) "expand %s")
(setf (gethash "remake" dbgr-command-hash) dbgr-remake-command-hash)
\\{dbgr-example-map-standard}"
(define-key map (kbd "C-c !b") 'dbgr-dbgr-goto-backtrace-line)
- (define-key map (kbd "C-c S") 'dbgr-cmd-shell)
)
(specify "format %l - without arg"
(assert-equal "line " (dbgr-expand-format "line %p")))
+ (specify "format %s"
+ (assert-equal "hi, rocky!"
+ (dbgr-expand-format "h%s!" "i, rocky")))
+
(setup)
;; Current buffer is now set up as a source buffer
(setq file-name (buffer-file-name))
(specify "dbgr-dbgr-command - not a command buffer"
(assert-raises error (dbgr-command "testing")))
- (specify "dbgr-define-command"
- (defalias 'dbgr-command-orig
- (symbol-function 'dbgr-command))
- (defun dbgr-command (str &optional arg no-record?
- frame-switch? dbgr-prompts?)
- (assert-equal "testing" str))
- (dbgr-define-command 'my-test "testing" "a" "my documentation")
- (assert-t (functionp 'dbgr-cmd-my-test))
- (assert-equal "my documentation" (documentation 'dbgr-cmd-my-test))
- (assert-equal 'dbgr-cmd-my-test (lookup-key (current-local-map) "\C-ca"))
- ;; FIXME: figure out what this was doing and why it
- ;; now fails
- ;;(dbgr-cmd-my-test "abc")
- (fset 'dbgr-command (symbol-function 'dbgr-command-orig))
- )
-
)
(test-unit "send")