comparison lisp/progmodes/gud.el @ 90133:4da4a09e8b1b

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-31 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 206-222) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 45-52) - Update from CVS - Update from CVS: texi Makefile.in CVS keyw cruft - Update from CVS: ChangeLog tweaks
author Miles Bader <miles@gnu.org>
date Thu, 31 Mar 2005 09:58:14 +0000
parents 72cf6261961e e1f821140a5a
children 146c086df160
comparison
equal deleted inserted replaced
90132:4080fe8b4f0f 90133:4da4a09e8b1b
529 gud-minibuffer-local-map nil 529 gud-minibuffer-local-map nil
530 hist-sym))) 530 hist-sym)))
531 531
532 (defvar gdb-first-prompt t) 532 (defvar gdb-first-prompt t)
533 533
534 (defvar gud-filter-pending-text nil
535 "Non-nil means this is text that has been saved for later in `gud-filter'.")
536
534 ;;;###autoload 537 ;;;###autoload
535 (defun gdb (command-line) 538 (defun gdb (command-line)
536 "Run gdb on program FILE in buffer *gud-FILE*. 539 "Run gdb on program FILE in buffer *gud-FILE*.
537 The directory containing FILE becomes the initial working directory 540 The directory containing FILE becomes the initial working directory
538 and source-file directory for your debugger." 541 and source-file directory for your debugger."
560 563
561 (local-set-key "\C-i" 'gud-gdb-complete-command) 564 (local-set-key "\C-i" 'gud-gdb-complete-command)
562 (setq comint-prompt-regexp "^(.*gdb[+]?) *") 565 (setq comint-prompt-regexp "^(.*gdb[+]?) *")
563 (setq paragraph-start comint-prompt-regexp) 566 (setq paragraph-start comint-prompt-regexp)
564 (setq gdb-first-prompt t) 567 (setq gdb-first-prompt t)
568 (setq gud-filter-pending-text nil)
565 (run-hooks 'gdb-mode-hook)) 569 (run-hooks 'gdb-mode-hook))
566 570
567 ;; One of the nice features of GDB is its impressive support for 571 ;; One of the nice features of GDB is its impressive support for
568 ;; context-sensitive command completion. We preserve that feature 572 ;; context-sensitive command completion. We preserve that feature
569 ;; in the GUD buffer by using a GDB command designed just for Emacs. 573 ;; in the GUD buffer by using a GDB command designed just for Emacs.
2443 2447
2444 (defvar gud-filter-defer-flag nil 2448 (defvar gud-filter-defer-flag nil
2445 "Non-nil means don't process anything from the debugger right now. 2449 "Non-nil means don't process anything from the debugger right now.
2446 It is saved for when this flag is not set.") 2450 It is saved for when this flag is not set.")
2447 2451
2448 (defvar gud-filter-pending-text nil
2449 "Non-nil means this is text that has been saved for later in `gud-filter'.")
2450
2451 ;; These functions are responsible for inserting output from your debugger 2452 ;; These functions are responsible for inserting output from your debugger
2452 ;; into the buffer. The hard work is done by the method that is 2453 ;; into the buffer. The hard work is done by the method that is
2453 ;; the value of gud-marker-filter. 2454 ;; the value of gud-marker-filter.
2454 2455
2455 (defun gud-filter (proc string) 2456 (defun gud-filter (proc string)
2514 ;; handle it now. 2515 ;; handle it now.
2515 (if gud-filter-pending-text 2516 (if gud-filter-pending-text
2516 (gud-filter proc "")))))) 2517 (gud-filter proc ""))))))
2517 2518
2518 (defvar gud-minor-mode-type nil) 2519 (defvar gud-minor-mode-type nil)
2520 (defvar gud-overlay-arrow-position nil)
2521 (put 'gud-overlay-arrow-position 'overlay-arrow-string "=>")
2522 (add-to-list 'overlay-arrow-variable-list 'gud-overlay-arrow-position)
2519 2523
2520 (defun gud-sentinel (proc msg) 2524 (defun gud-sentinel (proc msg)
2521 (cond ((null (buffer-name (process-buffer proc))) 2525 (cond ((null (buffer-name (process-buffer proc)))
2522 ;; buffer killed 2526 ;; buffer killed
2523 ;; Stop displaying an arrow in a source file. 2527 ;; Stop displaying an arrow in a source file.
2524 (setq overlay-arrow-position nil) 2528 (setq gud-overlay-arrow-position nil)
2525 (set-process-buffer proc nil) 2529 (set-process-buffer proc nil)
2526 (if (memq gud-minor-mode-type '(gdbmi gdba)) 2530 (if (memq gud-minor-mode-type '(gdbmi gdba))
2527 (gdb-reset) 2531 (gdb-reset)
2528 (gud-reset))) 2532 (gud-reset)))
2529 ((memq (process-status proc) '(signal exit)) 2533 ((memq (process-status proc) '(signal exit))
2530 ;; Stop displaying an arrow in a source file. 2534 ;; Stop displaying an arrow in a source file.
2531 (setq overlay-arrow-position nil) 2535 (setq gud-overlay-arrow-position nil)
2532 (with-current-buffer gud-comint-buffer 2536 (with-current-buffer gud-comint-buffer
2533 (if (memq gud-minor-mode-type '(gdbmi gdba)) 2537 (if (memq gud-minor-mode-type '(gdbmi gdba))
2534 (gdb-reset) 2538 (gdb-reset)
2535 (gud-reset))) 2539 (gud-reset)))
2536 (let* ((obuf (current-buffer))) 2540 (let* ((obuf (current-buffer)))
2609 (save-restriction 2613 (save-restriction
2610 (widen) 2614 (widen)
2611 (goto-line line) 2615 (goto-line line)
2612 (setq pos (point)) 2616 (setq pos (point))
2613 (setq overlay-arrow-string "=>") 2617 (setq overlay-arrow-string "=>")
2614 (or overlay-arrow-position 2618 (or gud-overlay-arrow-position
2615 (setq overlay-arrow-position (make-marker))) 2619 (setq gud-overlay-arrow-position (make-marker)))
2616 (set-marker overlay-arrow-position (point) (current-buffer))) 2620 (set-marker gud-overlay-arrow-position (point) (current-buffer)))
2617 (cond ((or (< pos (point-min)) (> pos (point-max))) 2621 (cond ((or (< pos (point-min)) (> pos (point-max)))
2618 (widen) 2622 (widen)
2619 (goto-char pos)))) 2623 (goto-char pos))))
2620 (if window (set-window-point window overlay-arrow-position)))))) 2624 (if window (set-window-point window gud-overlay-arrow-position))))))
2621 2625
2622 ;; The gud-call function must do the right thing whether its invoking 2626 ;; The gud-call function must do the right thing whether its invoking
2623 ;; keystroke is from the GUD buffer itself (via major-mode binding) 2627 ;; keystroke is from the GUD buffer itself (via major-mode binding)
2624 ;; or a C buffer. In the former case, we want to supply data from 2628 ;; or a C buffer. In the former case, we want to supply data from
2625 ;; gud-last-frame. Here's how we do it: 2629 ;; gud-last-frame. Here's how we do it: