]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/gud.el
(ada-prj-display-page): Use `mapc' rather than `mapcar'.
[gnu-emacs] / lisp / progmodes / gud.el
index e557fdef8430b43e6a6916ea2c20ecd478f0fba5..4b0dec7002e140c9c84f8602f4e0e8fef37e5579 100644 (file)
@@ -11,7 +11,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -59,7 +59,7 @@
 (defgroup gud nil
   "Grand Unified Debugger mode for gdb and other debuggers under Emacs.
 Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python), jdb."
 (defgroup gud nil
   "Grand Unified Debugger mode for gdb and other debuggers under Emacs.
 Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python), jdb."
-  :group 'unix
+  :group 'processes
   :group 'tools)
 
 
   :group 'tools)
 
 
@@ -237,7 +237,7 @@ Used to grey out relevant toolbar icons.")
        ([menu-bar run] menu-item
        ,(propertize "run" 'face 'font-lock-doc-face) gud-run
        :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
        ([menu-bar run] menu-item
        ,(propertize "run" 'face 'font-lock-doc-face) gud-run
        :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
-       ([menu-bar go] menu-item 
+       ([menu-bar go] menu-item
        ,(propertize " go " 'face 'font-lock-doc-face) gud-go
        :visible (and (not gud-running)
                      (eq gud-minor-mode 'gdba)))
        ,(propertize " go " 'face 'font-lock-doc-face) gud-go
        :visible (and (not gud-running)
                      (eq gud-minor-mode 'gdba)))
@@ -292,6 +292,11 @@ Used to grey out relevant toolbar icons.")
 (defun gud-file-name (f)
   "Transform a relative file name to an absolute file name.
 Uses `gud-<MINOR-MODE>-directories' to find the source files."
 (defun gud-file-name (f)
   "Transform a relative file name to an absolute file name.
 Uses `gud-<MINOR-MODE>-directories' to find the source files."
+  ;; When `default-directory' is a remote file name, prepend its
+  ;; remote part to f, which is the local file name.  Fortunately,
+  ;; `file-remote-p' returns exactly this remote file name part (or
+  ;; nil otherwise).
+  (setq f (concat (or (file-remote-p default-directory) "") f))
   (if (file-exists-p f) (expand-file-name f)
     (let ((directories (gud-val 'directories))
          (result nil))
   (if (file-exists-p f) (expand-file-name f)
     (let ((directories (gud-val 'directories))
          (result nil))
@@ -2462,7 +2467,7 @@ comint mode, which see."
 ;; for local variables in the debugger buffer.
 (defun gud-common-init (command-line massage-args marker-filter
                                     &optional find-file)
 ;; for local variables in the debugger buffer.
 (defun gud-common-init (command-line massage-args marker-filter
                                     &optional find-file)
-  (let* ((words (split-string command-line))
+  (let* ((words (split-string-and-unquote command-line))
         (program (car words))
         (dir default-directory)
         ;; Extract the file name from WORDS
         (program (car words))
         (dir default-directory)
         ;; Extract the file name from WORDS
@@ -2510,7 +2515,10 @@ comint mode, which see."
       (while (and w (not (eq (car w) t)))
        (setq w (cdr w)))
       (if w
       (while (and w (not (eq (car w) t)))
        (setq w (cdr w)))
       (if w
-         (setcar w file)))
+         (setcar w
+                 (if (file-remote-p default-directory)
+                     (setq file (file-name-nondirectory file))
+                   file))))
     (apply 'make-comint (concat "gud" filepart) program nil
           (if massage-args (funcall massage-args file args) args))
     ;; Since comint clobbered the mode, we don't set it until now.
     (apply 'make-comint (concat "gud" filepart) program nil
           (if massage-args (funcall massage-args file args) args))
     ;; Since comint clobbered the mode, we don't set it until now.
@@ -3114,7 +3122,7 @@ class of the file (using s to separate nested class ids)."
                              'syntax-table (eval-when-compile
                                              (string-to-syntax "> b")))
           ;; Make sure that rehighlighting the previous line won't erase our
                              'syntax-table (eval-when-compile
                                              (string-to-syntax "> b")))
           ;; Make sure that rehighlighting the previous line won't erase our
-          ;; syntax-table property.  
+          ;; syntax-table property.
           (put-text-property (1- (match-beginning 0)) (match-end 0)
                              'font-lock-multiline t)
           nil)))))
           (put-text-property (1- (match-beginning 0)) (match-end 0)
                              'font-lock-multiline t)
           nil)))))
@@ -3193,8 +3201,12 @@ Treats actions as defuns."
     (goto-char (point-max)))
   t)
 
     (goto-char (point-max)))
   t)
 
+;; Besides .gdbinit, gdb documents other names to be usable for init
+;; files, cross-debuggers can use something like
+;; .PROCESSORNAME-gdbinit so that the host and target gdbinit files
+;; don't interfere with each other.
 ;;;###autoload
 ;;;###autoload
-(add-to-list 'auto-mode-alist '("/\\.gdbinit" . gdb-script-mode))
+(add-to-list 'auto-mode-alist '("/\\.[a-z0-9-]*gdbinit" . gdb-script-mode))
 
 ;;;###autoload
 (define-derived-mode gdb-script-mode nil "GDB-Script"
 
 ;;;###autoload
 (define-derived-mode gdb-script-mode nil "GDB-Script"
@@ -3349,7 +3361,7 @@ This event can be examined by forms in GUD-TOOLTIP-DISPLAY.")
 
 (defun gud-tooltip-dereference (&optional arg)
   "Toggle whether tooltips should show `* expr' or `expr'.
 
 (defun gud-tooltip-dereference (&optional arg)
   "Toggle whether tooltips should show `* expr' or `expr'.
-With arg, dereference expr iff arg is positive."
+With arg, dereference expr if ARG is positive, otherwise do not derereference."
  (interactive "P")
   (setq gud-tooltip-dereference
        (if (null arg)
  (interactive "P")
   (setq gud-tooltip-dereference
        (if (null arg)