]> code.delx.au - gnu-emacs-elpa/commitdiff
Add dbg-cmd-eval-region. Add %s to dbgr-expand-format. Add goto arrows 1, 2, and...
authorrocky <rocky@gnu.org>
Thu, 7 Apr 2011 16:39:02 +0000 (12:39 -0400)
committerrocky <rocky@gnu.org>
Thu, 7 Apr 2011 16:39:02 +0000 (12:39 -0400)
dbgr/common/cmds.el
dbgr/common/fringe.el
dbgr/common/menu.el
dbgr/common/send.el
dbgr/common/shortkey.el
dbgr/debugger/perldb/track-mode.el
dbgr/debugger/remake/init.el
dbgr/lang/posix-shell.el
test/test-send.el

index bac15a7f104c5d2e68844ba217b395e282df0434..2e5dceb95d906764bcfdc30b5fd256b87db81df2 100644 (file)
@@ -34,34 +34,25 @@ if none has been set in the command hash."
   (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.
 
@@ -72,6 +63,12 @@ This command is often referred to as 'step out' as opposed to
     (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."
@@ -79,6 +76,20 @@ 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."
@@ -86,29 +97,32 @@ 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")
index 644304566ef09c39be0694ce9fc6a33dd298f585..72435f08f662d60f5dce3459a8a3fabe901a78cd 100644 (file)
@@ -131,6 +131,27 @@ session which should also erase those fringe arrows."
   (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 "")
index 3a09d79dd1ebb475b964dfd2fdf08933ca96258c..b96b9cc761b38a77915c86d10f9475534818f586 100644 (file)
@@ -117,11 +117,34 @@ menu. (The common map typically contains function key bindings.)"
                      :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 "--"))
 
index 0ca157956e0de61e4d23d6a316b80b20ab468f3c..7f9bd4e637487fbf97086ae7f5e82da51169afbd 100644 (file)
@@ -63,9 +63,9 @@ results into the command buffer."
   (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.
@@ -76,15 +76,16 @@ Some %-escapes in the string arguments are expanded. These are:
   %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 
@@ -125,7 +126,8 @@ Some %-escapes in the string arguments are expanded. These are:
                ;;  (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.
index 7947c2cc2c596125328851f20b15d738592b2794..dc28de9bf0e08e74bbbfc1cc71b55303a01dadec 100644 (file)
@@ -6,10 +6,18 @@
 (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
index 7b6b7030ab10d74f91cd6223b4f4e7d649689236..d3fdb0aa0502de9e21f9ed8fcd0e23c13a3abdf5 100644 (file)
@@ -14,8 +14,8 @@
 
 (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))
 
index fcc0272b23af7998bbb567890811886431b255dc..f12733113f14e44623f16fa55380d4dbe81d2df8 100644 (file)
@@ -104,6 +104,7 @@ dbgr-loc-pat struct")
   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)
 
 
index e5b94d106046a00b853d5e39a528d71d111a6143..e5ff8c75d3484fb0738845fdcb63fa68c2b5490a 100644 (file)
@@ -37,7 +37,6 @@ traceback) line."  )
 
 \\{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)
   )
 
 
index d3717c6883a238845324af0f82d39ca1b3ac03f0..43fc50e5d1d9bf51da5f5f5e5e310483a0945362 100644 (file)
         (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")