(if (boundp sym) (symbol-value sym))))
(defvar gud-running nil
- "Non-nil if debuggee is running.
-Used to grey out relevant togolbar icons.")
+ "Non-nil if debugged program is running.
+Used to grey out relevant toolbar icons.")
;; Use existing Info buffer, if possible.
(defun gud-goto-info ()
(defun gud-stop-subjob ()
(interactive)
- (if (string-equal
- (buffer-local-value 'gud-target-name gud-comint-buffer) "emacs")
- (comint-stop-subjob)
- (comint-interrupt-subjob)))
+ (with-current-buffer gud-comint-buffer
+ (if (string-equal gud-target-name "emacs")
+ (comint-stop-subjob)
+ (comint-interrupt-subjob))))
(easy-mmode-defmap gud-menu-map
'(([help] "Info" . gud-goto-info)
:enable (and (not emacs-basic-display)
(display-graphic-p)
(fboundp 'x-show-tip))
+ :visible (memq gud-minor-mode
+ '(gdbmi gdba dbx sdb xdb pdb))
:button (:toggle . gud-tooltip-mode))
([refresh] "Refresh" . gud-refresh)
([run] menu-item "Run" gud-run
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
- :visible (not (eq gud-minor-mode 'gdba)))
- ([go] menu-item "Run/Continue" gud-go
+ :enable (not gud-running)
+ :visible (and (memq gud-minor-mode '(gdbmi gdb dbx jdb))
+ (not (eq gud-minor-mode 'gdba))))
+ ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go
:visible (and (not gud-running)
(eq gud-minor-mode 'gdba)))
([stop] menu-item "Stop" gud-stop-subjob
(and gud-running
(eq gud-minor-mode 'gdba))))
([until] menu-item "Continue to selection" gud-until
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba gdb perldb)))
- :visible (gud-tool-bar-item-visible-no-fringe))
+ :enable (not gud-running)
+ :visible (and (memq gud-minor-mode '(gdbmi gdba gdb perldb))
+ (gud-tool-bar-item-visible-no-fringe)))
([remove] menu-item "Remove Breakpoint" gud-remove
:enable (not gud-running)
:visible (gud-tool-bar-item-visible-no-fringe))
([tbreak] menu-item "Temporary Breakpoint" gud-tbreak
- :enable (memq gud-minor-mode
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
'(gdbmi gdba gdb sdb xdb bashdb)))
([break] menu-item "Set Breakpoint" gud-break
:enable (not gud-running)
:visible (gud-tool-bar-item-visible-no-fringe))
([up] menu-item "Up Stack" gud-up
- :enable (and (not gud-running)
- (memq gud-minor-mode
- '(gdbmi gdba gdb dbx xdb jdb pdb bashdb))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))
([down] menu-item "Down Stack" gud-down
- :enable (and (not gud-running)
- (memq gud-minor-mode
- '(gdbmi gdba gdb dbx xdb jdb pdb bashdb))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))
([pp] menu-item "Print S-expression" gud-pp
:enable (and (not gud-running)
gdb-active-process)
'gud-target-name gud-comint-buffer) "emacs")
(eq gud-minor-mode 'gdba)))
([print*] menu-item "Print Dereference" gud-pstar
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba gdb))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdba gdb)))
([print] menu-item "Print Expression" gud-print
:enable (not gud-running))
([watch] menu-item "Watch Expression" gud-watch
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdba)))
([finish] menu-item "Finish Function" gud-finish
- :enable (and (not gud-running)
- (memq gud-minor-mode
- '(gdbmi gdba gdb xdb jdb pdb bashdb))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdba gdb xdb jdb pdb bashdb)))
([stepi] menu-item "Step Instruction" gud-stepi
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba gdb dbx))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
([nexti] menu-item "Next Instruction" gud-nexti
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba gdb dbx))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
([step] menu-item "Step Line" gud-step
:enable (not gud-running))
([next] menu-item "Next Line" gud-next
(existing-buffer (get-buffer (concat "*gud" filepart "*"))))
(pop-to-buffer (concat "*gud" filepart "*"))
(when (and existing-buffer (get-buffer-process existing-buffer))
- (error "This program is already running under gdb"))
+ (error "This program is already being debugged"))
;; Set the dir, in case the buffer already existed with a different dir.
(setq default-directory dir)
;; Set default-directory to the file's directory.
((memq (process-status proc) '(signal exit))
;; Stop displaying an arrow in a source file.
(setq gud-overlay-arrow-position nil)
- (with-current-buffer gud-comint-buffer
- (if (memq gud-minor-mode-type '(gdbmi gdba))
- (gdb-reset)
- (gud-reset)))
+ (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+ '(gdba gdbmi))
+ (gdb-reset)
+ (gud-reset))
(let* ((obuf (current-buffer)))
;; save-excursion isn't the right thing if
;; process-buffer is current-buffer
(defvar gdb-script-font-lock-keywords
'(("^define\\s-+\\(\\(\\w\\|\\s_\\)+\\)" (1 font-lock-function-name-face))
("\\$\\(\\w+\\)" (1 font-lock-variable-name-face))
- ("^\\s-*\\(\\(\\w\\|\\s_\\)+\\)" (1 font-lock-keyword-face))))
+ ("^\\s-*\\(\\w\\(\\w\\|\\s_\\)*\\)" (1 font-lock-keyword-face))))
;; FIXME: The keyword "end" associated with "document"
;; should have font-lock-keyword-face (currently font-lock-doc-face).
(kill-local-variable 'gdb-define-alist)
(remove-hook 'after-save-hook 'gdb-create-define-alist t))))
-(defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode)
+(defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode
+ python-mode)
"List of modes for which to enable GUD tooltips."
:type 'sexp
:group 'gud
(defvar gud-tooltip-mouse-motions-active nil
"Locally t in a buffer if tooltip processing of mouse motion is enabled.")
+;; We don't set track-mouse globally because this is a big redisplay
+;; problem in buffers having a pre-command-hook or such installed,
+;; which does a set-buffer, like the summary buffer of Gnus. Calling
+;; set-buffer prevents redisplay optimizations, so every mouse motion
+;; would be accompanied by a full redisplay.
+
(defun gud-tooltip-activate-mouse-motions (activatep)
"Activate/deactivate mouse motion events for the current buffer.
ACTIVATEP non-nil means activate mouse motion events."
(case gud-minor-mode
(gdba (concat "server print " expr))
((dbx gdbmi) (concat "print " expr))
- (xdb (concat "p " expr))
- (sdb (concat expr "/"))
- (perldb expr)))
+ ((xdb pdb) (concat "p " expr))
+ (sdb (concat expr "/"))))
(defun gud-tooltip-tips (event)
"Show tip for identifier or selection under the mouse.
gdb-server-prefix "macro expand " expr "\n")
`(lambda () (gdb-tooltip-print-1 ,expr))))
(gdb-enqueue-input
- (list (concat cmd "\n") 'gdb-tooltip-print)))
+ (list (concat cmd "\n")
+ `(lambda () (gdb-tooltip-print ,expr)))))
(setq gud-tooltip-original-filter (process-filter process))
(set-process-filter process 'gud-tooltip-process-output)
(gud-basic-call cmd))