]> code.delx.au - gnu-emacs-elpa/commitdiff
DRY initial debugger-start code somewhat.
authorrocky <rocky@gnu.org>
Thu, 14 Apr 2011 00:09:52 +0000 (20:09 -0400)
committerrocky <rocky@gnu.org>
Thu, 14 Apr 2011 00:09:52 +0000 (20:09 -0400)
Add keys for buffer switching in backtrace-buffer.

Try to guard against sending to process via comint when it is dead and set comint-last-output-start to avoid a ansi-color-apply-on-region doesn't bomb.

13 files changed:
dbgr/common/backtrace-mode.el
dbgr/common/buffer/backtrace.el
dbgr/common/core.el
dbgr/common/send.el
dbgr/common/shortkey.el
dbgr/debugger/bashdb/bashdb.el
dbgr/debugger/gdb/gdb.el
dbgr/debugger/gdb/track-mode.el
dbgr/debugger/pydbgr/pydbgr.el
dbgr/debugger/rdebug/rdebug.el
dbgr/debugger/remake/remake.el
dbgr/debugger/trepan/trepan.el
dbgr/debugger/trepanx/trepanx.el

index a15037f88c77e9e4385081fedb228504e1544135..0b6a653e7dae80fac6f32d07c8e1cb4e9be7902a 100644 (file)
@@ -4,6 +4,7 @@
 (require-relative-list  '("menu") "dbgr-")
 (defvar dbgr-backtrace-mode-map
   (let ((map  (dbgr-populate-debugger-menu (make-sparse-keymap))))
+    (dbgr-populate-common-keys map)
     (define-key map "."       'dbgr-backtrace-moveto-frame-selected)
     (define-key map "r"       'dbgr-backtrace-init)
     (define-key map [double-mouse-1] 'dbgr-goto-frame-mouse)
     (define-key map [mouse-3] 'dbgr-goto-frame-mouse)
     (define-key map [up]      'dbgr-backtrace-moveto-frame-prev)
     (define-key map [down]    'dbgr-backtrace-moveto-frame-next)
+
+    ;; FIXME: these can go to a common routine. See also shortkey.el
+    (define-key map "<"       'dbgr-cmd-newer-frame)
+    (define-key map ">"       'dbgr-cmd-older-frame)
+    (define-key map "d"       'dbgr-cmd-newer-frame)
+    (define-key map "u"       'dbgr-cmd-older-frame)
+    (define-key map "l"        'dbgr-recenter-arrow)
+    (define-key map "C"        'dbgr-window-cmd-undisturb-src)
+    (define-key map "S"        'dbgr-window-src-undisturb-cmd)
+
     (define-key map "n"       'dbgr-backtrace-moveto-frame-next)
     (define-key map "p"       'dbgr-backtrace-moveto-frame-prev)
+    (define-key map "0"       'dbgr-goto-frame-n)
+    (define-key map "1"       'dbgr-goto-frame-n)
+    (define-key map "2"       'dbgr-goto-frame-n)
+    (define-key map "3"       'dbgr-goto-frame-n)
+    (define-key map "4"       'dbgr-goto-frame-n)
+    (define-key map "5"       'dbgr-goto-frame-n)
+    (define-key map "6"       'dbgr-goto-frame-n)
+    (define-key map "7"       'dbgr-goto-frame-n)
+    (define-key map "8"       'dbgr-goto-frame-n)
+    (define-key map "9"       'dbgr-goto-frame-n)
     (define-key map [(control m)] 'dbgr-goto-frame)
-    (define-key map "0" 'dbgr-goto-frame-n)
-    (define-key map "1" 'dbgr-goto-frame-n)
-    (define-key map "2" 'dbgr-goto-frame-n)
-    (define-key map "3" 'dbgr-goto-frame-n)
-    (define-key map "4" 'dbgr-goto-frame-n)
-    (define-key map "5" 'dbgr-goto-frame-n)
-    (define-key map "6" 'dbgr-goto-frame-n)
-    (define-key map "7" 'dbgr-goto-frame-n)
-    (define-key map "8" 'dbgr-goto-frame-n)
-    (define-key map "9" 'dbgr-goto-frame-n)
-    (dbgr-populate-common-keys map)
 
     ;; ;; --------------------
     ;; ;; The "Stack window" submenu.
index 6cfc33dc03a7a0356819165b1d785d9ff9973297..a9c0af21f0c9389533161619ed241804ab07a13a 100644 (file)
@@ -60,7 +60,7 @@ to be debugged."
            (sleep-count 0)
            )
        (unless frame-pat
-         (error "No 'frame' regular expression recorded for debugger %s"
+         (error "No 'debugger-backtrace' regular expression recorded for debugger %s"
                 (dbgr-cmdbuf-debugger-name)))
        (setq process (get-buffer-process (current-buffer)))
        (dbgr-cmdbuf-info-in-srcbuf?= (not (dbgr-cmdbuf? buffer)))
index c7d4992ff9997957649d473b8e4093702c4580ac..96797028bcc930f251c14d9b73467d78ce621ce5 100644 (file)
@@ -95,6 +95,40 @@ return the first argument is always removed.
        (cons (list arg) (list remaining))))
      (t (cons (list arg) (list remaining))))))
 
+(defun dbgr-run-process(debugger-name script-filename cmd-args 
+                                     track-mode-func &optional no-reset)
+  "Runs `dbgr-exec-shell with DEBUGGER-NAME SCRIPT-FILENAME PROGRAM-ARGS
+NO-RESET and SCRIPT-ARGS. If this succeeeds we call TRACK-MODE-FUNC
+and save cmd-args in command-buffer for use if we want to restarting.
+If we don't succeed in running the program we will switch to the command buffer
+which shows details of the error. The command buffer or nil is returned"
+
+  (let ((cmd-buf))
+    (condition-case nil
+       (setq cmd-buf 
+             (apply 'dbgr-exec-shell debugger-name script-filename
+                    (car cmd-args) no-reset (cdr cmd-args)))
+      (error nil))
+    ;; FIXME: Is there probably is a way to remove the
+    ;; below test and combine in condition-case? 
+    (let ((process (get-buffer-process cmd-buf)))
+      (if (and process (eq 'run (process-status process)))
+         (progn
+           (switch-to-buffer cmd-buf)
+           (funcall track-mode-func 't)
+           (dbgr-cmdbuf-info-cmd-args= cmd-args)
+           )
+       (progn 
+         (if cmd-buf (switch-to-buffer cmd-buf))
+         (message "Error running command: %s %s" debugger-name script-filename)
+         )
+       )
+      )
+    cmd-buf
+    )
+  )
+
+
 (defun dbgr-terminate (&optional buf)
   "Resets state in all buffers associated with source or command buffer BUF)
 This does things like remove fringe arrows breakpoint icons and
index d908944ee7cf348d744e492868368341777613d9..7081a158d87da16d2df56d4cc28bed707f6d18dc 100644 (file)
@@ -6,11 +6,20 @@
 
 (defun dbgr-send-command-comint (process command-str)
   "Assume we are in a comint buffer. Insert COMMAND-STR and 
-send that input onto the process.  Parameter PROCESS not used."
-  (comint-goto-process-mark)
-  (setq dbgr-last-output-start (point-marker))
-  (insert command-str)
-  (comint-send-input))
+send that input onto the process."
+  (if (eq 'run (process-status process))
+      (progn
+       (comint-goto-process-mark)
+       (setq comint-last-output-start
+             (setq dbgr-last-output-start (point-marker)))
+       (insert command-str)
+       (comint-send-input)
+       )
+    ;; else
+    (message "Process %s not in `run' state; not issuing %s" 
+            process command-str)
+    )
+  )
 
 (defalias 'comint-output-filter-orig 
   (symbol-function 'comint-output-filter))
index 6c96a72a58a3e4a72ca895ac1accc8592f6444f7..0aa6f091131d6bce6794919ba39a3f762447f9e0 100644 (file)
@@ -3,40 +3,34 @@
 (require-relative-list '("custom" "key" "menu") "dbgr-")
 (require-relative-list '("buffer/helper") "dbgr-buffer-")
 
-(defvar dbgr-short-key-mode-map (make-sparse-keymap)
+(defvar dbgr-short-key-mode-map 
+  (let ((map (make-sparse-keymap)))
+    (dbgr-populate-common-keys map)
+    (dbgr-populate-src-buffer-map-plain map)
+    (dbgr-populate-debugger-menu map)
+    (define-key map "1"        'dbgr-goto-arrow1)
+    (define-key map "2"        'dbgr-goto-arrow2)
+    (define-key map "3"        'dbgr-goto-arrow3)
+    (define-key map "b"        'dbgr-cmd-break)
+    (define-key map "c"        'dbgr-cmd-continue)
+    (define-key map "e"        'dbgr-cmd-eval-region)
+
+    ;; FIXME: these can go to a common routine
+    (define-key map "<"        'dbgr-cmd-newer-frame)
+    (define-key map ">"        'dbgr-cmd-older-frame)
+    (define-key map "d"        'dbgr-cmd-newer-frame)
+    (define-key map "u"        'dbgr-cmd-older-frame)
+    (define-key map "l"        'dbgr-recenter-arrow)
+    (define-key map "C"        'dbgr-window-cmd-undisturb-src)
+    (define-key map "S"        'dbgr-window-src-undisturb-cmd)
+
+    (define-key map "R"        'dbgr-cmd-restart)
+    (define-key map "!"        'dbgr-cmd-shell)
+    (define-key map [insert]   'dbgr-short-key-mode)
+    (define-key map [M-insert] 'dbgr-short-key-mode)
+    map)
   "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
-  (kbd ">") 'dbgr-cmd-older-frame)
-(define-key dbgr-short-key-mode-map
-  (kbd "l") 'dbgr-recenter-arrow)
-(define-key dbgr-short-key-mode-map
-  (kbd "C") 'dbgr-window-cmd-undisturb-src)
-(define-key dbgr-short-key-mode-map
-  (kbd "S") 'dbgr-window-src-undisturb-cmd)
-(define-key dbgr-short-key-mode-map
-  (kbd "R") 'dbgr-cmd-restart)
-(define-key dbgr-short-key-mode-map
-  (kbd "!") 'dbgr-cmd-shell)
-(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)
-(dbgr-populate-src-buffer-map-plain dbgr-short-key-mode-map)
-(dbgr-populate-debugger-menu dbgr-short-key-mode-map)
 
 ;; Implementation note: This is the mode that does all the work, it's
 ;; local to the buffer that is affected.
index 7f51e6322dd54926caa89d79183206a744aaa3cb..549b46cd40ea758451bd77b6aad7fc58e93d6fe8 100644 (file)
@@ -42,36 +42,16 @@ discover that the buffer has prior command-buffer information and
 NO-RESET is nil, then that information which may point into other
 buffers and source buffers which may contain marks and fringe or
 marginal icons is reset."
-
-  
   (interactive)
-  (let* (
-        (cmd-str (or opt-command-line (bashdb-query-cmdline "bashdb")))
+  (let* ((cmd-str (or opt-command-line (bashdb-query-cmdline "bashdb")))
         (cmd-args (split-string-and-unquote cmd-str))
         (parsed-args (bashdb-parse-cmd-args cmd-args))
         (script-args (cdr cmd-args))
         (script-name (car script-args))
         (cmd-buf))
-  
-    ;; Parse the command line and pick out the script name and whether
-    ;; --annotate has been set.
-  
-    (condition-case nil
-       (setq cmd-buf 
-             (apply 'dbgr-exec-shell "bashdb" script-name
-                    (car cmd-args) no-reset (cdr cmd-args)))
-    (error nil))
-    ;; FIXME: Is there probably is a way to remove the
-    ;; below test and combine in condition-case? 
-    (let ((process (get-buffer-process cmd-buf)))
-      (if (and process (eq 'run (process-status process)))
-         (progn
-           (switch-to-buffer cmd-buf)
-           (bashdb-track-mode 't)
-           (dbgr-cmdbuf-info-cmd-args= cmd-args)
-           )
-       (message "Error running bashdb command"))
-    )))
+    (dbgr-run-process "bashdb" script-name cmd-args 
+                     'bashdb-track-mode no-reset)
+    ))
 
 (defalias 'bashdb 'dbgr-bashdb)
 
index 39e13c7812da5ed60863004aebe0c6c8c22138ef..68889d452bb7218a3ef70c615dd5acfd51f91b69 100644 (file)
@@ -24,8 +24,6 @@ This should be an executable on your path, or an absolute file name."
   :type 'string
   :group 'dbgr-gdb)
 
-(declare-function dbgr-gdb-track-mode (bool))
-
 ;; -------------------------------------------------------------------
 ;; The end.
 ;;
@@ -44,33 +42,41 @@ buffers and source buffers which may contain marks and fringe or
 marginal icons is reset."
   
   (interactive)
-  (let* (
-        (cmd-str (or opt-command-line (dbgr-gdb-query-cmdline "gdb")))
+  (let* ((cmd-str (or opt-command-line (dbgr-gdb-query-cmdline "gdb")))
         (cmd-args (split-string-and-unquote cmd-str))
         (parsed-args (dbgr-gdb-parse-cmd-args cmd-args))
         (script-args (cdr cmd-args))
         (script-name (expand-file-name (car script-args)))
-        (cmd-buf))
+        (cmd-buf (dbgr-run-process "gdb" (car script-args) cmd-args
+                                    'dbgr-gdb-track-mode nil))
+        )
+    (if cmd-buf 
+       (with-current-buffer cmd-buf
+         (dbgr-command "set annotate 1" nil nil nil)
+         )
+      )
+    )
   
-    ;; Parse the command line and pick out the script name and whether
-    ;; --annotate has been set.
+    ;; ;; Parse the command line and pick out the script name and whether
+    ;; ;; --annotate has been set.
   
-    (condition-case nil
-       (setq cmd-buf 
-             (apply 'dbgr-exec-shell "gdb" (car script-args)
-                    (car cmd-args) nil
-                    (cons script-name (cddr cmd-args))))
-    (error nil))
-    ;; FIXME: Is there probably is a way to remove the
-    ;; below test and combine in condition-case? 
-    (let ((process (get-buffer-process cmd-buf)))
-      (if (and process (eq 'run (process-status process)))
-         (progn
-           (switch-to-buffer cmd-buf)
-           (dbgr-gdb-track-mode 't)
-           (dbgr-cmdbuf-info-cmd-args= cmd-args)
-           )
-       (message "Error running gdb command"))
-    )))
+    ;; (condition-case nil
+    ;;         (setq cmd-buf 
+    ;;               (apply 'dbgr-exec-shell "gdb" (car script-args)
+    ;;                      (car cmd-args) nil
+    ;;                      (cons script-name (cddr cmd-args))))
+    ;; (error nil))
+    ;; ;; FIXME: Is there probably is a way to remove the
+    ;; ;; below test and combine in condition-case? 
+    ;; (let ((process (get-buffer-process cmd-buf)))
+    ;;   (if (and process (eq 'run (process-status process)))
+    ;;           (progn
+    ;;             (switch-to-buffer cmd-buf)
+    ;;             (dbgr-gdb-track-mode 't)
+    ;;             (dbgr-cmdbuf-info-cmd-args= cmd-args)
+    ;;             )
+    ;;         (message "Error running gdb command"))
+    ;; )
+    )
 
 (provide-me "dbgr-")
index 1d0b1a5946c6194cba1514e8a376da4be871c669..889b0b142b4618c2f89f2fdf7937dc00b3ab1608 100644 (file)
@@ -32,9 +32,9 @@
   :global nil
   :group 'dbgr-gdb
   :keymap dbgr-gdb-track-mode-map
-  (dbgr-track-set-debugger "dbgr-gdb")
   (if dbgr-gdb-track-mode
       (progn 
+       (dbgr-track-set-debugger "gdb")
        (dbgr-track-mode 't)
        (run-mode-hooks (intern (dbgr-gdb-track-mode-hook))))
     (progn 
index 8686d61b18755f25555d4d082f3ee6424481be7a..12c1d51ed864dfe5c3289051b70c7ff279ced55b 100644 (file)
@@ -54,26 +54,11 @@ marginal icons is reset."
         (script-args (cdr cmd-args))
         (script-name (car script-args))
         (cmd-buf))
-  
-    ;; Parse the command line and pick out the script name and whether
-    ;; --annotate has been set.
-  
-    (condition-case nil
-       (setq cmd-buf 
-             (apply 'dbgr-exec-shell "pydbgr" script-name
-                    (car cmd-args) no-reset (cdr cmd-args)))
-    (error nil))
-    ;; FIXME: Is there probably is a way to remove the
-    ;; below test and combine in condition-case? 
-    (let ((process (get-buffer-process cmd-buf)))
-      (if (and process (eq 'run (process-status process)))
-         (progn
-           (switch-to-buffer cmd-buf)
-           (pydbgr-track-mode 't)
-           (dbgr-cmdbuf-info-cmd-args= cmd-args)
-           )
-       (message "Error running pydbgr command"))
-    )))
+    (dbgr-run-process "pydbgr" script-name cmd-args 
+                     'pydbgr-track-mode no-reset)
+    )
+  )
+
 
 (defalias 'pydbgr 'dbgr-pydbgr)
 
index 551b8cfbafad07818192a475f2fce33858eee418..9c53ef8fcf76dec4c9aa5596954ba0a807cb829e 100644 (file)
@@ -95,11 +95,8 @@ discover that the buffer has prior command-buffer information and
 NO-RESET is nil, then that information which may point into other
 buffers and source buffers which may contain marks and fringe or
 marginal icons is reset."
-
-  
   (interactive)
-  (let* (
-        (cmd-str (or opt-command-line (rdebug-query-cmdline "rdebug")))
+  (let* ((cmd-str (or opt-command-line (rdebug-query-cmdline "rdebug")))
         (cmd-args (split-string-and-unquote cmd-str))
         (parsed-args (rdebug-parse-cmd-args cmd-args))
         (script-name-annotate-p (rdebug-get-script-name cmd-args))
@@ -107,27 +104,10 @@ marginal icons is reset."
         (annotate-p  (cadr script-name-annotate-p))
         (script-args (cdr cmd-args))
         (cmd-buf))
-  
-    ;; Parse the command line and pick out the script name and whether
-    ;; --annotate has been set.
-  
-    (condition-case nil
-       (setq cmd-buf 
-             (apply 'dbgr-exec-shell "rdebug" script-name
-                    (car cmd-args) no-reset (cdr cmd-args)))
-    (error nil))
-    ;; FIXME: Is there probably is a way to remove the
-    ;; below test and combine in condition-case? 
-    (let ((process (get-buffer-process cmd-buf)))
-      (if (and process (eq 'run (process-status process)))
-         (progn
-           (switch-to-buffer cmd-buf)
-           (rdebug-track-mode 't)
-           (dbgr-cmdbuf-info-cmd-args= cmd-args)
-           )
-       (message "Error running rdebug command"))
-    )))
+    (dbgr-run-process "rdebug" script-name cmd-args 
+                     'rdebug-track-mode no-reset)
+    )
+  )
 
 (defalias 'rdebug 'dbgr-rdebug)
-
 (provide-me "dbgr-")
index 082f41e9672be6a49cf559b093bf4db3bc751511..7e2ea7075c57f894c309feaa23688e9c77764802 100644 (file)
@@ -24,8 +24,6 @@ This should be an executable on your path, or an absolute file name."
   :type 'string
   :group 'remake)
 
-(declare-function remake-track-mode (bool))
-
 ;; -------------------------------------------------------------------
 ;; The end.
 ;;
@@ -45,37 +43,40 @@ marginal icons is reset."
 
   
   (interactive)
-  (let* (
-        (cmd-str (or opt-command-line (remake-query-cmdline "remake")))
+  (let* ((cmd-str (or opt-command-line (remake-query-cmdline "remake")))
         (cmd-args (split-string-and-unquote cmd-str))
         (parsed-args (remake-parse-cmd-args cmd-args))
         (remake-program (car parsed-args))
         (makefile-name (or (cadr parsed-args) "Makefile"))
         (makefile-args (caddr parsed-args))
         (cmd-buf))
+    (dbgr-run-process "remake" makefile-name 
+                     (cons remake-program makefile-args)
+                     'remake-track-mode no-reset)
+
+    ;; ;; Parse the command line and pick out the script name and whether
+    ;; ;; --annotate has been set.
   
-    ;; Parse the command line and pick out the script name and whether
-    ;; --annotate has been set.
-  
-    (condition-case nil
-       (setq cmd-buf 
-             (apply 'dbgr-exec-shell "remake" makefile-name
-                    remake-program no-reset makefile-args))
-      (error nil))
-    ;; FIXME: Is there probably is a way to remove the
-    ;; below test and combine in condition-case? 
-    (let ((process (get-buffer-process cmd-buf)))
-      (if (and process (eq 'run (process-status process)))
-         (progn
-           (switch-to-buffer cmd-buf)
-           (remake-track-mode 't)
-           (dbgr-cmdbuf-info-cmd-args= cmd-args)
-           )
-       (message "Error running remake command"))
-    )))
+    ;; (condition-case nil
+    ;;         (setq cmd-buf 
+    ;;               (apply 'dbgr-exec-shell "remake" makefile-name
+    ;;                      remake-program no-reset makefile-args))
+    ;;   (error nil))
+    ;; ;; FIXME: Is there probably is a way to remove the
+    ;; ;; below test and combine in condition-case? 
+    ;; (let ((process (get-buffer-process cmd-buf)))
+    ;;   (if (and process (eq 'run (process-status process)))
+    ;;           (progn
+    ;;             (switch-to-buffer cmd-buf)
+    ;;             (remake-track-mode 't)
+    ;;             (dbgr-cmdbuf-info-cmd-args= cmd-args)
+    ;;             )
+    ;;         (message "Error running remake command"))
+    ;;   )
+    )
+  )
 
 (defalias 'remake 'dbgr-remake)
 
 (provide-me "dbgr-")
-
 ;;; remake.el ends here
index 80bffa85d3b8507fb2518e609b945d5d3565ecfe..02d24f08324168cb58b0ebaa5f41adc3866fc48f 100644 (file)
@@ -24,8 +24,6 @@ This should be an executable on your path, or an absolute file name."
   :type 'string
   :group 'trepan)
 
-(declare-function trepan-track-mode (bool))
-
 ;; -------------------------------------------------------------------
 ;; The end.
 ;;
@@ -42,8 +40,6 @@ discover that the buffer has prior command-buffer information and
 NO-RESET is nil, then that information which may point into other
 buffers and source buffers which may contain marks and fringe or
 marginal icons is reset."
-
-  
   (interactive)
   (let* (
         (cmd-str (or opt-command-line (trepan-query-cmdline "trepan")))
@@ -52,29 +48,11 @@ marginal icons is reset."
         (script-args (cdr cmd-args))
         (script-name (car script-args))
         (cmd-buf))
-  
-    ;; Parse the command line and pick out the script name and whether
-    ;; --annotate has been set.
-  
-    (condition-case nil
-       (setq cmd-buf 
-             (apply 'dbgr-exec-shell "trepan" script-name
-                    (car cmd-args) no-reset (cdr cmd-args)))
-      (error nil))
-    ;; FIXME: Is there probably is a way to remove the
-    ;; below test and combine in condition-case? 
-    (let ((process (get-buffer-process cmd-buf)))
-      (if (and process (eq 'run (process-status process)))
-         (progn
-           (switch-to-buffer cmd-buf)
-           (trepan-track-mode 't)
-           (dbgr-cmdbuf-info-cmd-args= cmd-args)
-           )
-       (message "Error running trepan command"))
-    )))
+    (dbgr-run-process "trepan" script-name cmd-args 'trepan-track-mode no-reset)
+    )
+  )
 
 (defalias 'trepan 'dbgr-trepan)
 
 (provide-me "dbgr-")
-
 ;;; trepan.el ends here
index 41bc318237c0e8aebac0af7a8c92c99e589ce4ef..464a2e1745078ee136af3b9cd512aa04b06f3c8e 100644 (file)
@@ -24,8 +24,6 @@ This should be an executable on your path, or an absolute file name."
   :type 'string
   :group 'trepanx)
 
-(declare-function trepanx-track-mode (bool))
-
 ;; -------------------------------------------------------------------
 ;; The end.
 ;;
@@ -42,8 +40,6 @@ discover that the buffer has prior command-buffer information and
 NO-RESET is nil, then that information which may point into other
 buffers and source buffers which may contain marks and fringe or
 marginal icons is reset."
-
-  
   (interactive)
   (let* (
         (cmd-str (or opt-command-line (trepanx-query-cmdline "trepanx")))
@@ -52,29 +48,12 @@ marginal icons is reset."
         (script-args (cdr cmd-args))
         (script-name (car script-args))
         (cmd-buf))
-  
-    ;; Parse the command line and pick out the script name and whether
-    ;; --annotate has been set.
-  
-    (condition-case nil
-       (setq cmd-buf 
-             (apply 'dbgr-exec-shell "trepanx" script-name
-                    (car cmd-args) no-reset (cdr cmd-args)))
-    (error nil))
-    ;; FIXME: Is there probably is a way to remove the
-    ;; below test and combine in condition-case? 
-    (let ((process (get-buffer-process cmd-buf)))
-      (if (and process (eq 'run (process-status process)))
-         (progn
-           (switch-to-buffer cmd-buf)
-           (trepanx-track-mode 't)
-           (dbgr-cmdbuf-info-cmd-args= cmd-args)
-           )
-       (message "Error running trepanx command"))
-    )))
+    (dbgr-run-process "trepanx" script-name cmd-args 
+                     'trepanx-track-mode no-reset)
+    )
+  )
 
 (defalias 'trepanx 'dbgr-trepanx)
 
 (provide-me "dbgr-")
-
 ;;; trepanx.el ends here