Fix up comment convention on the arch-tag lines.
[bpt/emacs.git] / lisp / progmodes / gud.el
index 97144fe..c057ccc 100644 (file)
@@ -5,13 +5,13 @@
 ;; Keywords: unix, tools
 
 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2003,
-;;  2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;;  2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
 ;; 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,
@@ -26,8 +26,8 @@
 
 ;;; Commentary:
 
-;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu> It was
-;; later rewritten by rms.  Some ideas were due to Masanobu.  Grand
+;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu>.
+;; It was later rewritten by rms.  Some ideas were due to Masanobu.  Grand
 ;; Unification (sdb/dbx support) by Eric S. Raymond <esr@thyrsus.com> Barry
 ;; Warsaw <bwarsaw@cen.com> hacked the mode to use comint.el.  Shane Hartman
 ;; <shane@spr.com> added support for xdb (HPUX debugger).  Rick Sladkey
 (defvar gdb-macro-info)
 (defvar gdb-server-prefix)
 (defvar gdb-show-changed-values)
+(defvar gdb-source-window)
 (defvar gdb-var-list)
 (defvar gdb-speedbar-auto-raise)
+(defvar gud-tooltip-mode)
+(defvar hl-line-mode)
+(defvar hl-line-sticky-flag)
 (defvar tool-bar-map)
 
+
 ;; ======================================================================
 ;; GUD commands must be visible in C buffers visited by GUD
 
 (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
+Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python) and jdb."
+  :group 'processes
   :group 'tools)
 
 
@@ -88,7 +93,7 @@ Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python), jdb."
 
 (defun gud-symbol (sym &optional soft minor-mode)
   "Return the symbol used for SYM in MINOR-MODE.
-MINOR-MODE defaults to `gud-minor-mode.
+MINOR-MODE defaults to `gud-minor-mode'.
 The symbol returned is `gud-<MINOR-MODE>-<SYM>'.
 If SOFT is non-nil, returns nil if the symbol doesn't already exist."
   (unless (or minor-mode gud-minor-mode) (error "Gud internal error"))
@@ -104,6 +109,9 @@ If SOFT is non-nil, returns nil if the symbol doesn't already exist."
   "Non-nil if debugged program is running.
 Used to grey out relevant toolbar icons.")
 
+(defvar gud-target-name "--unknown--"
+  "The apparent name of the program being debugged in a gud buffer.")
+
 ;; Use existing Info buffer, if possible.
 (defun gud-goto-info ()
   "Go to relevant Emacs info node."
@@ -137,7 +145,7 @@ Used to grey out relevant toolbar icons.")
 
 (easy-mmode-defmap gud-menu-map
   '(([help]     "Info" . gud-goto-info)
-    ([tooltips] menu-item "Toggle GUD tooltips" gud-tooltip-mode
+    ([tooltips] menu-item "Show GUD tooltips" gud-tooltip-mode
                   :enable (and (not emacs-basic-display)
                               (display-graphic-p)
                               (fboundp 'x-show-tip))
@@ -308,6 +316,8 @@ Uses `gud-<MINOR-MODE>-directories' to find the source files."
        (setq directories (cdr directories)))
       result)))
 
+(declare-function gdb-create-define-alist "gdb-ui" ())
+
 (defun gud-find-file (file)
   ;; Don't get confused by double slashes in the name that comes from GDB.
   (while (string-match "//+" file)
@@ -336,14 +346,14 @@ Uses `gud-<MINOR-MODE>-directories' to find the source files."
 ;; Of course you may use `gud-def' with any other debugger command, including
 ;; user defined ones.
 
-;; A macro call like (gud-def FUNC NAME KEY DOC) expands to a form
-;; which defines FUNC to send the command NAME to the debugger, gives
+;; A macro call like (gud-def FUNC CMD KEY DOC) expands to a form
+;; which defines FUNC to send the command CMD to the debugger, gives
 ;; it the docstring DOC, and binds that function to KEY in the GUD
 ;; major mode.  The function is also bound in the global keymap with the
 ;; GUD prefix.
 
 (defmacro gud-def (func cmd key &optional doc)
-  "Define FUNC to be a command sending STR and bound to KEY, with
+  "Define FUNC to be a command sending CMD and bound to KEY, with
 optional doc string DOC.  Certain %-escapes in the string arguments
 are interpreted specially if present.  These are:
 
@@ -367,9 +377,10 @@ we're in the GUD buffer)."
      (defun ,func (arg)
        ,@(if doc (list doc))
        (interactive "p")
-       ,(if (stringp cmd)
-           `(gud-call ,cmd arg)
-         cmd))
+       (if (not gud-running)
+        ,(if (stringp cmd)
+             `(gud-call ,cmd arg)
+           cmd)))
      ,(if key `(local-set-key ,(concat "\C-c" key) ',func))
      ,(if key `(global-set-key (vconcat gud-key-prefix ,key) ',func))))
 
@@ -414,7 +425,7 @@ we're in the GUD buffer)."
 
 (defvar gud-last-speedbar-stackframe nil
   "Description of the currently displayed GUD stack.
-t means that there is no stack, and we are in display-file mode.")
+The value t means that there is no stack, and we are in display-file mode.")
 
 (defvar gud-speedbar-key-map nil
   "Keymap used when in the buffers display mode.")
@@ -461,7 +472,13 @@ t means that there is no stack, and we are in display-file mode.")
     ["Auto raise frame" gdb-speedbar-auto-raise
      :style toggle :selected gdb-speedbar-auto-raise
      :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
-                   '(gdbmi gdba))])
+                   '(gdbmi gdba))]
+    ("Output Format"
+     :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+                   '(gdbmi gdba))
+     ["Binary" (gdb-var-set-format "binary") t]
+     ["Natural" (gdb-var-set-format  "natural") t]
+     ["Hexadecimal" (gdb-var-set-format "hexadecimal") t]))
   "Additional menu items to add to the speedbar frame.")
 
 ;; Make sure our special speedbar mode is loaded
@@ -470,14 +487,14 @@ t means that there is no stack, and we are in display-file mode.")
   (add-hook 'speedbar-load-hook 'gud-install-speedbar-variables))
 
 (defun gud-expansion-speedbar-buttons (directory zero)
-  "Wrapper for call to speedbar-add-expansion-list.   DIRECTORY and
-ZERO are not used, but are required by the caller."
+  "Wrapper for call to `speedbar-add-expansion-list'.
+DIRECTORY and ZERO are not used, but are required by the caller."
   (gud-speedbar-buttons gud-comint-buffer))
 
 (defun gud-speedbar-buttons (buffer)
   "Create a speedbar display based on the current state of GUD.
 If the GUD BUFFER is not running a supported debugger, then turn
-off the specialized speedbar mode.  BUFFER is not used, but are
+off the specialized speedbar mode.  BUFFER is not used, but is
 required by the caller."
   (when (and gud-comint-buffer
             ;; gud-comint-buffer might be killed
@@ -592,8 +609,9 @@ required by the caller."
 ;; History of argument lists passed to gdb.
 (defvar gud-gdb-history nil)
 
-(defcustom gud-gdb-command-name "gdb --annotate=3"
-  "Default command to execute an executable under the GDB debugger."
+(defcustom gud-gud-gdb-command-name "gdb --fullname"
+  "Default command to run an executable under GDB in text command mode.
+The option \"--fullname\" must be included in this value."
    :type 'string
    :group 'gud)
 
@@ -638,14 +656,6 @@ required by the caller."
     (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
       (let ((match (match-string 1 gud-marker-acc)))
 
-       ;; Pick up stopped annotation if attaching to process.
-       (if (string-equal match "stopped") (setq gdb-active-process t))
-
-       ;; Using annotations, switch to gud-gdba-marker-filter.
-       (when (string-equal match "prompt")
-         (require 'gdb-ui)
-         (gdb-prompt nil))
-
        (setq
         ;; Append any text before the marker to the output we're going
         ;; to return - we don't include the marker in this text.
@@ -654,13 +664,7 @@ required by the caller."
 
         ;; Set the accumulator to the remaining text.
 
-        gud-marker-acc (substring gud-marker-acc (match-end 0)))
-
-       ;; Pick up any errors that occur before first prompt annotation.
-       (if (string-equal match "error-begin")
-           (put-text-property 0 (length gud-marker-acc)
-                              'face font-lock-warning-face
-                              gud-marker-acc))))
+        gud-marker-acc (substring gud-marker-acc (match-end 0)))))
 
     ;; Does the remaining text look like it might end with the
     ;; beginning of another marker?  If it does, then keep it in
@@ -712,21 +716,16 @@ required by the caller."
 (defvar gud-filter-pending-text nil
   "Non-nil means this is text that has been saved for later in `gud-filter'.")
 
+;; If in gdba mode, gdb-ui is loaded.
+(declare-function gdb-restore-windows "gdb-ui" ())
+
+;; The old gdb command (text command mode).  The new one is in gdb-ui.el.
 ;;;###autoload
-(defun gdb (command-line)
+(defun gud-gdb (command-line)
   "Run gdb on program FILE in buffer *gud-FILE*.
 The directory containing FILE becomes the initial working
-directory and source-file directory for your debugger.  By
-default this command starts GDB using a graphical interface.  See
-`gdba' for more information.
-
-To run GDB in text command mode, replace the GDB \"--annotate=3\"
-option with \"--fullname\" either in the minibuffer for the
-current Emacs session, or the custom variable
-`gud-gdb-command-name' for all future sessions.  You need to use
-text command mode to debug multiple programs within one Emacs
-session."
-  (interactive (list (gud-query-cmdline 'gdb)))
+directory and source-file directory for your debugger."
+  (interactive (list (gud-query-cmdline 'gud-gdb)))
 
   (when (and gud-comint-buffer
           (buffer-name gud-comint-buffer)
@@ -769,8 +768,9 @@ session."
   (setq comint-prompt-regexp "^(.*gdb[+]?) *")
   (setq paragraph-start comint-prompt-regexp)
   (setq gdb-first-prompt t)
+  (setq gud-running nil)
   (setq gud-filter-pending-text nil)
-  (run-hooks 'gdb-mode-hook))
+  (run-hooks 'gud-gdb-mode-hook))
 
 ;; One of the nice features of GDB is its impressive support for
 ;; context-sensitive command completion.  We preserve that feature
@@ -919,7 +919,7 @@ It is passed through FILTER before we look at it."
 (defun gud-gdb-run-command-fetch-lines (command buffer &optional skip)
   "Run COMMAND, and return the list of lines it outputs.
 BUFFER is the current buffer which may be the GUD buffer in which to run.
-SKIP is the number of chars to skip on each lines, it defaults to 0."
+SKIP is the number of chars to skip on each line, it defaults to 0."
   (with-current-buffer gud-comint-buffer
     (if (and (eq gud-comint-buffer buffer)
             (save-excursion
@@ -1172,8 +1172,8 @@ a better solution in 6.1 upwards.")
 (defvar gud-dbx-use-stopformat-p
   (string-match "irix[6-9]\\.[1-9]" system-configuration)
   "Non-nil to use the dbx feature present at least from Irix 6.1
-  whereby $stopformat=1 produces an output format compatiable with
-  `gud-dbx-marker-filter'.")
+whereby $stopformat=1 produces an output format compatible with
+`gud-dbx-marker-filter'.")
 ;; [Irix dbx seems to be a moving target.  The dbx output changed
 ;; subtly sometime between OS v4.0.5 and v5.2 so that, for instance,
 ;; the output from `up' is no longer spotted by gud (and it's probably
@@ -1237,10 +1237,6 @@ a better solution in 6.1 upwards.")
          (setq result (substring result 0 (match-beginning 0))))))
     (or result "")))
 
-(defvar gud-dgux-p (string-match "-dgux" system-configuration)
-  "Non-nil means to assume the interface approriate for DG/UX dbx.
-This was tested using R4.11.")
-
 ;; There are a couple of differences between DG's dbx output and normal
 ;; dbx output which make it nontrivial to integrate this into the
 ;; standard dbx-marker-filter (mainly, there are a different number of
@@ -1299,9 +1295,6 @@ and source-file directory for your debugger."
    (gud-irix-p
     (gud-common-init command-line 'gud-dbx-massage-args
                     'gud-irixdbx-marker-filter))
-   (gud-dgux-p
-    (gud-common-init command-line 'gud-dbx-massage-args
-                    'gud-dguxdbx-marker-filter))
    (t
     (gud-common-init command-line 'gud-dbx-massage-args
                     'gud-dbx-marker-filter)))
@@ -1643,7 +1636,7 @@ and source-file directory for your debugger."
   (gud-common-init command-line nil 'gud-pdb-marker-filter)
   (set (make-local-variable 'gud-minor-mode) 'pdb)
 
-  (gud-def gud-break  "break %l"     "\C-b" "Set breakpoint at current line.")
+  (gud-def gud-break  "break %f:%l"  "\C-b" "Set breakpoint at current line.")
   (gud-def gud-remove "clear %f:%l"  "\C-d" "Remove breakpoint at current line")
   (gud-def gud-step   "step"         "\C-s" "Step one source line with display.")
   (gud-def gud-next   "next"         "\C-n" "Step one line (skip functions).")
@@ -1772,7 +1765,7 @@ class information on jdb startup (original method)."
   :group 'gud)
 
 (defvar gud-jdb-classpath nil
- "Java/jdb classpath directories list.
 "Java/jdb classpath directories list.
 If `gud-jdb-use-classpath' is non-nil, gud-jdb derives the `gud-jdb-classpath'
 list automatically using the following methods in sequence
 \(with subsequent successful steps overriding the results of previous
@@ -1781,7 +1774,7 @@ steps):
 1) Read the CLASSPATH environment variable,
 2) Read any \"-classpath\" argument used to run jdb,
    or detected in jdb output (e.g. if jdb is run by a script
-   that echoes the actual jdb command before starting jdb)
+   that echoes the actual jdb command before starting jdb),
 3) Send a \"classpath\" command to jdb and scan jdb output for
    classpath information if jdb is invoked with an \"-attach\" (to
    an already running VM) argument (This case typically does not
@@ -1789,7 +1782,7 @@ steps):
    to the VM when it is started).
 
 Note that method 3 cannot be used with oldjdb (or Java 1 jdb) since
-those debuggers do not support the classpath command. Use 1) or 2).")
+those debuggers do not support the classpath command.  Use 1) or 2).")
 
 (defvar gud-jdb-sourcepath nil
   "Directory list provided by an (optional) \"-sourcepath\" option to jdb.
@@ -1803,7 +1796,7 @@ the most recent debugger output history while searching for
 source file information.")
 
 (defvar gud-jdb-history nil
-"History of argument lists passed to jdb.")
+  "History of argument lists passed to jdb.")
 
 
 ;; List of Java source file directories.
@@ -1820,21 +1813,21 @@ file from which the class originated.  This allows gud mode to keep
 the source code display in sync with the debugging session.")
 
 (defvar gud-jdb-source-files nil
-"List of the java source files for this debugging session.")
+  "List of the java source files for this debugging session.")
 
 ;; Association list of fully qualified class names (package + class name)
 ;; and their source files.
 (defvar gud-jdb-class-source-alist nil
-"Association list of fully qualified class names and source files.")
+  "Association list of fully qualified class names and source files.")
 
 ;; This is used to hold a source file during analysis.
 (defvar gud-jdb-analysis-buffer nil)
 
 (defvar gud-jdb-classpath-string nil
-"Holds temporary classpath values.")
+  "Holds temporary classpath values.")
 
 (defun gud-jdb-build-source-files-list (path extn)
-"Return a list of java source files (absolute paths).
+  "Return a list of java source files (absolute paths).
 PATH gives the directories in which to search for files with
 extension EXTN.  Normally EXTN is given as the regular expression
  \"\\.java$\" ."
@@ -2104,8 +2097,8 @@ extension EXTN.  Normally EXTN is given as the regular expression
 (defvar gud-jdb-lowest-stack-level 999)
 
 (defun gud-jdb-find-source-using-classpath (p)
-"Find source file corresponding to fully qualified class p.
-Convert p from jdb's output, converted to a pathname
+  "Find source file corresponding to fully qualified class P.
+Convert P from jdb's output, converted to a pathname
 relative to a classpath directory."
   (save-match-data
     (let
@@ -2133,14 +2126,14 @@ relative to a classpath directory."
     (if found-file (concat (car cplist) "/" filename)))))
 
 (defun gud-jdb-find-source (string)
-"Alias for function used to locate source files.
+  "Alias for function used to locate source files.
 Set to `gud-jdb-find-source-using-classpath' or `gud-jdb-find-source-file'
 during jdb initialization depending on the value of
 `gud-jdb-use-classpath'."
-nil)
+  nil)
 
 (defun gud-jdb-parse-classpath-string (string)
-"Parse the classpath list and convert each item to an absolute pathname."
+  "Parse the classpath list and convert each item to an absolute pathname."
   (mapcar (lambda (s) (if (string-match "[/\\]$" s)
                          (replace-match "" nil nil s) s))
          (mapcar 'file-truename
@@ -2267,7 +2260,7 @@ The buffer is named \"*gud*\" if no initial class is given or
 switch is given, omit all whitespace between it and its value.
 
 See `gud-jdb-use-classpath' and `gud-jdb-classpath' documentation for
-information on how jdb accesses source files. Alternatively (if
+information on how jdb accesses source files.  Alternatively (if
 `gud-jdb-use-classpath' is nil), see `gud-jdb-directories' for the
 original source file access method.
 
@@ -2311,7 +2304,6 @@ gud, see `gud-mode'."
   (gud-def gud-run    "run"           nil    "Run the program.") ;if VM start using jdb
   (gud-def gud-print  "print %e"  "\C-p" "Evaluate Java expression at point.")
 
-
   (setq comint-prompt-regexp "^> \\|^[^ ]+\\[[0-9]+\\] ")
   (setq paragraph-start comint-prompt-regexp)
   (run-hooks 'jdb-mode-hook)
@@ -2457,9 +2449,6 @@ comint mode, which see."
   :group 'gud
   :type 'boolean)
 
-(defvar gud-target-name "--unknown--"
-  "The apparent name of the program being debugged in a gud buffer.")
-
 ;; Perform initializations common to all debuggers.
 ;; The first arg is the specified command line,
 ;; which starts with the program to debug.
@@ -2467,7 +2456,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)
-  (let* ((words (string->strings command-line))
+  (let* ((words (split-string-and-unquote command-line))
         (program (car words))
         (dir default-directory)
         ;; Extract the file name from WORDS
@@ -2527,7 +2516,6 @@ comint mode, which see."
         (and file-word (file-name-nondirectory file))))
   (set (make-local-variable 'gud-marker-filter) marker-filter)
   (if find-file (set (make-local-variable 'gud-find-file) find-file))
-  (setq gud-running nil)
   (setq gud-last-last-frame nil)
 
   (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter)
@@ -2610,6 +2598,8 @@ It is saved for when this flag is not set.")
 (defvar gud-overlay-arrow-position nil)
 (add-to-list 'overlay-arrow-variable-list 'gud-overlay-arrow-position)
 
+(declare-function gdb-reset "gdb-ui" ())
+
 (defun gud-sentinel (proc msg)
   (cond ((null (buffer-name (process-buffer proc)))
         ;; buffer killed
@@ -2635,7 +2625,7 @@ It is saved for when this flag is not set.")
           ;;  process-buffer is current-buffer
           (unwind-protect
               (progn
-                ;; Write something in *compilation* and hack its mode line,
+                ;; Write something in the GUD buffer and hack its mode line,
                 (set-buffer (process-buffer proc))
                 ;; Fix the mode line.
                 (setq mode-line-process
@@ -2679,6 +2669,11 @@ Obeying it means displaying in another window the specified file and line."
     (setq gud-last-last-frame gud-last-frame
          gud-last-frame nil)))
 
+(declare-function global-hl-line-highlight  "hl-line" ())
+(declare-function hl-line-highlight         "hl-line" ())
+(declare-function gdb-display-source-buffer "gdb-ui"  (buffer))
+(declare-function gdb-display-buffer "gdb-ui" (buf dedicated &optional size))
+
 ;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen
 ;; and that its line LINE is visible.
 ;; Put the overlay-arrow on the line LINE in that buffer.
@@ -2691,11 +2686,14 @@ Obeying it means displaying in another window the specified file and line."
         (buffer
          (with-current-buffer gud-comint-buffer
            (gud-find-file true-file)))
-        (window (and buffer (or (get-buffer-window buffer)
-                                (if (memq gud-minor-mode '(gdbmi gdba))
-                                    (unless (gdb-display-source-buffer buffer)
-                                      (gdb-display-buffer buffer nil)))
-                                (display-buffer buffer))))
+        (window (and buffer
+                     (or (get-buffer-window buffer)
+                         (if (memq gud-minor-mode '(gdbmi gdba))
+                             (or (if (get-buffer-window buffer 0)
+                                     (display-buffer buffer nil 0))
+                                 (unless (gdb-display-source-buffer buffer)
+                                   (gdb-display-buffer buffer nil))))
+                         (display-buffer buffer))))
         (pos))
     (if buffer
        (progn
@@ -2865,7 +2863,7 @@ Obeying it means displaying in another window the specified file and line."
            (set-marker-insertion-type gud-delete-prompt-marker t))
          (unless (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
                      'jdb)
-             (insert (concat  expr " = "))))))
+           (insert (concat  expr " = "))))))
     expr))
 
 ;; The next eight functions are hacked from gdbsrc.el by
@@ -3008,11 +3006,17 @@ Link exprs of the form:
        (t nil)))
      (t nil))))
 
+
+(declare-function c-langelem-sym "cc-defs" (langelem))
+(declare-function c-langelem-pos "cc-defs" (langelem))
+(declare-function syntax-symbol  "gud"     (x))
+(declare-function syntax-point   "gud"     (x))
+
 (defun gud-find-class (f line)
   "Find fully qualified class in file F at line LINE.
 This function uses the `gud-jdb-classpath' (and optional
 `gud-jdb-sourcepath') list(s) to derive a file
-pathname relative to its classpath directory. The values in
+pathname relative to its classpath directory.  The values in
 `gud-jdb-classpath' are assumed to have been converted to absolute
 pathname standards using file-truename.
 If F is visited by a buffer and its mode is CC-mode(Java),
@@ -3210,7 +3214,7 @@ Treats actions as defuns."
 
 ;;;###autoload
 (define-derived-mode gdb-script-mode nil "GDB-Script"
-  "Major mode for editing GDB scripts"
+  "Major mode for editing GDB scripts."
   (set (make-local-variable 'comment-start) "#")
   (set (make-local-variable 'comment-start-skip) "#+\\s-*")
   (set (make-local-variable 'outline-regexp) "[ \t]")
@@ -3357,11 +3361,11 @@ For C this would dereference a pointer expression.")
 
 (defvar gud-tooltip-event nil
   "The mouse movement event that led to a tooltip display.
-This event can be examined by forms in GUD-TOOLTIP-DISPLAY.")
+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'.
-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)
@@ -3393,11 +3397,13 @@ With arg, dereference expr iff arg is positive."
        ((xdb pdb) (concat "p " expr))
        (sdb (concat expr "/"))))
 
+(declare-function gdb-enqueue-input "gdb-ui" (item))
+
 (defun gud-tooltip-tips (event)
   "Show tip for identifier or selection under the mouse.
 The mouse must either point at an identifier or inside a selected
-region for the tip window to be shown.  If gud-tooltip-dereference is t,
-add a `*' in front of the printed expression. In the case of a C program
+region for the tip window to be shown.  If `gud-tooltip-dereference' is t,
+add a `*' in front of the printed expression.  In the case of a C program
 controlled by GDB, show the associated #define directives when program is
 not executing.
 
@@ -3451,5 +3457,5 @@ so they have been disabled."))
 
 (provide 'gud)
 
-;;; arch-tag: 6d990948-df65-461a-be39-1c7fb83ac4c4
+;; arch-tag: 6d990948-df65-461a-be39-1c7fb83ac4c4
 ;;; gud.el ends here