diff options
| author | Richard M. Stallman | 1995-10-24 17:55:30 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-10-24 17:55:30 +0000 |
| commit | 3b3703faebe46669e6f06cfc6acf68e898525fde (patch) | |
| tree | 4794c5a42f71d25df38ef0b1db8f91b7cae7c526 | |
| parent | 70d78eb6ea4275541d12c740f5020975e4f5f01f (diff) | |
| download | emacs-3b3703faebe46669e6f06cfc6acf68e898525fde.tar.gz emacs-3b3703faebe46669e6f06cfc6acf68e898525fde.zip | |
(gud-dbx-directories): New variable.
(gud-dbx-massage-args): Use gud-dbx-directories.
(gud-dbx-file-name): New function.
(gud-irixdbx-marker-filter): Use gud-dbx-file-name.
(gud-dbx-file-file): Use gud-dbx-file-name.
(gud-filter): Fix previous change.
| -rw-r--r-- | lisp/gud.el | 82 |
1 files changed, 58 insertions, 24 deletions
diff --git a/lisp/gud.el b/lisp/gud.el index 17ff347949c..d475e9be362 100644 --- a/lisp/gud.el +++ b/lisp/gud.el | |||
| @@ -33,7 +33,8 @@ | |||
| 33 | ;; added support for xdb (HPUX debugger). Rick Sladkey <jrs@world.std.com> | 33 | ;; added support for xdb (HPUX debugger). Rick Sladkey <jrs@world.std.com> |
| 34 | ;; wrote the GDB command completion code. Dave Love <d.love@dl.ac.uk> | 34 | ;; wrote the GDB command completion code. Dave Love <d.love@dl.ac.uk> |
| 35 | ;; added the IRIX kluge, re-implemented the Mips-ish variant and added | 35 | ;; added the IRIX kluge, re-implemented the Mips-ish variant and added |
| 36 | ;; a menu. | 36 | ;; a menu. Brian D. Carlstrom <bdc@ai.mit.edu> combined the IRIX kluge with |
| 37 | ;; the gud-xdb-directories hack producing gud-dbx-directories. | ||
| 37 | 38 | ||
| 38 | ;;; Code: | 39 | ;;; Code: |
| 39 | 40 | ||
| @@ -511,7 +512,36 @@ and source-file directory for your debugger." | |||
| 511 | ;;; History of argument lists passed to dbx. | 512 | ;;; History of argument lists passed to dbx. |
| 512 | (defvar gud-dbx-history nil) | 513 | (defvar gud-dbx-history nil) |
| 513 | 514 | ||
| 514 | (defun gud-dbx-massage-args (file args) args) | 515 | (defvar gud-dbx-directories nil |
| 516 | "*A list of directories that dbx should search for source code. | ||
| 517 | If nil, only source files in the program directory | ||
| 518 | will be known to dbx. | ||
| 519 | |||
| 520 | The file names should be absolute, or relative to the directory | ||
| 521 | containing the executable being debugged.") | ||
| 522 | |||
| 523 | (defun gud-dbx-massage-args (file args) | ||
| 524 | (nconc (let ((directories gud-dbx-directories) | ||
| 525 | (result nil)) | ||
| 526 | (while directories | ||
| 527 | (setq result (cons (car directories) (cons "-I" result))) | ||
| 528 | (setq directories (cdr directories))) | ||
| 529 | (nreverse result)) | ||
| 530 | args)) | ||
| 531 | |||
| 532 | (defun gud-dbx-file-name (f) | ||
| 533 | "Transform a relative file name to an absolute file name, for dbx." | ||
| 534 | (let ((result nil)) | ||
| 535 | (if (file-exists-p f) | ||
| 536 | (setq result (expand-file-name f)) | ||
| 537 | (let ((directories gud-dbx-directories)) | ||
| 538 | (while directories | ||
| 539 | (let ((path (concat (car directories) "/" f))) | ||
| 540 | (if (file-exists-p path) | ||
| 541 | (setq result (expand-file-name path) | ||
| 542 | directories nil))) | ||
| 543 | (setq directories (cdr directories))))) | ||
| 544 | result)) | ||
| 515 | 545 | ||
| 516 | (defun gud-dbx-marker-filter (string) | 546 | (defun gud-dbx-marker-filter (string) |
| 517 | (setq gud-marker-acc (if gud-marker-acc (concat gud-marker-acc string) string)) | 547 | (setq gud-marker-acc (if gud-marker-acc (concat gud-marker-acc string) string)) |
| @@ -680,8 +710,9 @@ This works in IRIX 4, 5 and 6.") | |||
| 680 | result) | 710 | result) |
| 681 | ((string-match ; kluged-up marker as above | 711 | ((string-match ; kluged-up marker as above |
| 682 | "\032\032\\([0-9]*\\):\\(.*\\)\n" result) | 712 | "\032\032\\([0-9]*\\):\\(.*\\)\n" result) |
| 683 | (let ((file (substring result (match-beginning 2) (match-end 2)))) | 713 | (let ((file (gud-dbx-file-name |
| 684 | (if (file-exists-p file) | 714 | (substring result (match-beginning 2) (match-end 2))))) |
| 715 | (if (and file (file-exists-p file)) | ||
| 685 | (setq gud-last-frame | 716 | (setq gud-last-frame |
| 686 | (cons | 717 | (cons |
| 687 | file | 718 | file |
| @@ -693,12 +724,15 @@ This works in IRIX 4, 5 and 6.") | |||
| 693 | 724 | ||
| 694 | (defun gud-dbx-find-file (f) | 725 | (defun gud-dbx-find-file (f) |
| 695 | (save-excursion | 726 | (save-excursion |
| 696 | (let ((buf (find-file-noselect f))) | 727 | (let ((realf (gud-dbx-file-name f))) |
| 697 | (set-buffer buf) | 728 | (if realf |
| 698 | (gud-make-debug-menu) | 729 | (let ((buf (find-file-noselect f))) |
| 699 | (local-set-key [menu-bar debug up] '("Up Stack" . gud-up)) | 730 | (set-buffer buf) |
| 700 | (local-set-key [menu-bar debug down] '("Down Stack" . gud-down)) | 731 | (gud-make-debug-menu) |
| 701 | buf))) | 732 | (local-set-key [menu-bar debug up] '("Up Stack" . gud-up)) |
| 733 | (local-set-key [menu-bar debug down] '("Down Stack" . gud-down)) | ||
| 734 | buf) | ||
| 735 | nil)))) | ||
| 702 | 736 | ||
| 703 | ;;;###autoload | 737 | ;;;###autoload |
| 704 | (defun dbx (command-line) | 738 | (defun dbx (command-line) |
| @@ -1219,20 +1253,20 @@ It is saved for when this flag is not set.") | |||
| 1219 | (setq process-window | 1253 | (setq process-window |
| 1220 | (and gud-last-frame | 1254 | (and gud-last-frame |
| 1221 | (>= (point) (process-mark proc)) | 1255 | (>= (point) (process-mark proc)) |
| 1222 | (get-buffer-window (current-buffer)))))) | 1256 | (get-buffer-window (current-buffer))))) |
| 1223 | (if process-window | 1257 | (if process-window |
| 1224 | (save-selected-window | 1258 | (save-selected-window |
| 1225 | (select-window process-window) | 1259 | (select-window process-window) |
| 1226 | (gud-display-frame))) | 1260 | (gud-display-frame))) |
| 1227 | 1261 | ||
| 1228 | ;; Let the comint filter do the actual insertion. | 1262 | ;; Let the comint filter do the actual insertion. |
| 1229 | ;; That lets us inherit various comint features. | 1263 | ;; That lets us inherit various comint features. |
| 1230 | (comint-output-filter proc output) | 1264 | (comint-output-filter proc output) |
| 1231 | 1265 | ||
| 1232 | ;; If we deferred text that arrived during this processing, | 1266 | ;; If we deferred text that arrived during this processing, |
| 1233 | ;; handle it now. | 1267 | ;; handle it now. |
| 1234 | (if gud-filter-pending-text | 1268 | (if gud-filter-pending-text |
| 1235 | (gud-filter proc "")))))) | 1269 | (gud-filter proc ""))))))) |
| 1236 | 1270 | ||
| 1237 | (defun gud-sentinel (proc msg) | 1271 | (defun gud-sentinel (proc msg) |
| 1238 | (cond ((null (buffer-name (process-buffer proc))) | 1272 | (cond ((null (buffer-name (process-buffer proc))) |