531 |
|
|
532 |
(defvar gdb-first-prompt t) |
(defvar gdb-first-prompt t) |
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 |
|
|
537 |
;;;###autoload |
;;;###autoload |
538 |
(defun gdb (command-line) |
(defun gdb (command-line) |
539 |
"Run gdb on program FILE in buffer *gud-FILE*. |
"Run gdb on program FILE in buffer *gud-FILE*. |
565 |
(setq comint-prompt-regexp "^(.*gdb[+]?) *") |
(setq comint-prompt-regexp "^(.*gdb[+]?) *") |
566 |
(setq paragraph-start comint-prompt-regexp) |
(setq paragraph-start comint-prompt-regexp) |
567 |
(setq gdb-first-prompt t) |
(setq gdb-first-prompt t) |
568 |
|
(setq gud-filter-pending-text nil) |
569 |
(run-hooks 'gdb-mode-hook)) |
(run-hooks 'gdb-mode-hook)) |
570 |
|
|
571 |
;; One of the nice features of GDB is its impressive support for |
;; One of the nice features of GDB is its impressive support for |
2449 |
"Non-nil means don't process anything from the debugger right now. |
"Non-nil means don't process anything from the debugger right now. |
2450 |
It is saved for when this flag is not set.") |
It is saved for when this flag is not set.") |
2451 |
|
|
|
(defvar gud-filter-pending-text nil |
|
|
"Non-nil means this is text that has been saved for later in `gud-filter'.") |
|
|
|
|
2452 |
;; These functions are responsible for inserting output from your debugger |
;; These functions are responsible for inserting output from your debugger |
2453 |
;; into the buffer. The hard work is done by the method that is |
;; into the buffer. The hard work is done by the method that is |
2454 |
;; the value of gud-marker-filter. |
;; the value of gud-marker-filter. |
2517 |
(gud-filter proc "")))))) |
(gud-filter proc "")))))) |
2518 |
|
|
2519 |
(defvar gud-minor-mode-type nil) |
(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) |
2523 |
|
|
2524 |
(defun gud-sentinel (proc msg) |
(defun gud-sentinel (proc msg) |
2525 |
(cond ((null (buffer-name (process-buffer proc))) |
(cond ((null (buffer-name (process-buffer proc))) |
2526 |
;; buffer killed |
;; buffer killed |
2527 |
;; Stop displaying an arrow in a source file. |
;; Stop displaying an arrow in a source file. |
2528 |
(setq overlay-arrow-position nil) |
(setq gud-overlay-arrow-position nil) |
2529 |
(set-process-buffer proc nil) |
(set-process-buffer proc nil) |
2530 |
(if (memq gud-minor-mode-type '(gdbmi gdba)) |
(if (memq gud-minor-mode-type '(gdbmi gdba)) |
2531 |
(gdb-reset) |
(gdb-reset) |
2532 |
(gud-reset))) |
(gud-reset))) |
2533 |
((memq (process-status proc) '(signal exit)) |
((memq (process-status proc) '(signal exit)) |
2534 |
;; Stop displaying an arrow in a source file. |
;; Stop displaying an arrow in a source file. |
2535 |
(setq overlay-arrow-position nil) |
(setq gud-overlay-arrow-position nil) |
2536 |
(with-current-buffer gud-comint-buffer |
(with-current-buffer gud-comint-buffer |
2537 |
(if (memq gud-minor-mode-type '(gdbmi gdba)) |
(if (memq gud-minor-mode-type '(gdbmi gdba)) |
2538 |
(gdb-reset) |
(gdb-reset) |
2615 |
(goto-line line) |
(goto-line line) |
2616 |
(setq pos (point)) |
(setq pos (point)) |
2617 |
(setq overlay-arrow-string "=>") |
(setq overlay-arrow-string "=>") |
2618 |
(or overlay-arrow-position |
(or gud-overlay-arrow-position |
2619 |
(setq overlay-arrow-position (make-marker))) |
(setq gud-overlay-arrow-position (make-marker))) |
2620 |
(set-marker overlay-arrow-position (point) (current-buffer))) |
(set-marker gud-overlay-arrow-position (point) (current-buffer))) |
2621 |
(cond ((or (< pos (point-min)) (> pos (point-max))) |
(cond ((or (< pos (point-min)) (> pos (point-max))) |
2622 |
(widen) |
(widen) |
2623 |
(goto-char pos)))) |
(goto-char pos)))) |
2624 |
(if window (set-window-point window overlay-arrow-position)))))) |
(if window (set-window-point window gud-overlay-arrow-position)))))) |
2625 |
|
|
2626 |
;; The gud-call function must do the right thing whether its invoking |
;; The gud-call function must do the right thing whether its invoking |
2627 |
;; keystroke is from the GUD buffer itself (via major-mode binding) |
;; keystroke is from the GUD buffer itself (via major-mode binding) |