aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2007-10-02 10:57:03 +0000
committerNick Roberts2007-10-02 10:57:03 +0000
commit89525f8b2bd53eb3877e76beb44e94c1fa30c35f (patch)
tree057e3bbd8635fe803f83c3404b4a224399732dbe
parentb621b522ad55adf972e5fdcf1da3acdaf6af59a1 (diff)
downloademacs-89525f8b2bd53eb3877e76beb44e94c1fa30c35f.tar.gz
emacs-89525f8b2bd53eb3877e76beb44e94c1fa30c35f.zip
(gdb-init-1): Don't set the values
gud-minor-mode and gud-marker-filter. (gdb-fullname-regexp): New variable. (gud-gdba-marker-filter): Use it to switch to text command mode if appropriate.
-rw-r--r--lisp/progmodes/gdb-ui.el61
1 files changed, 39 insertions, 22 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 629a61f68e1..a0bd32f355c 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -472,9 +472,6 @@ otherwise do not."
472 expr))) 472 expr)))
473 473
474(defun gdb-init-1 () 474(defun gdb-init-1 ()
475 (set (make-local-variable 'gud-minor-mode) 'gdba)
476 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
477 ;;
478 (gud-def gud-break (if (not (string-match "Machine" mode-name)) 475 (gud-def gud-break (if (not (string-match "Machine" mode-name))
479 (gud-call "break %f:%l" arg) 476 (gud-call "break %f:%l" arg)
480 (save-excursion 477 (save-excursion
@@ -1515,6 +1512,10 @@ happens to be appropriate."
1515 (set-window-buffer source-window buffer)) 1512 (set-window-buffer source-window buffer))
1516 source-window)) 1513 source-window))
1517 1514
1515;; Derived from gud-gdb-marker-regexp
1516(defvar gdb-fullname-regexp
1517 (concat "\\(.:?[^" ":" "\n]*\\)" ":" "\\([0-9]*\\)" ":" ".*"))
1518
1518(defun gud-gdba-marker-filter (string) 1519(defun gud-gdba-marker-filter (string)
1519 "A gud marker filter for gdb. Handle a burst of output from GDB." 1520 "A gud marker filter for gdb. Handle a burst of output from GDB."
1520 (if gdb-flush-pending-output 1521 (if gdb-flush-pending-output
@@ -1531,34 +1532,50 @@ happens to be appropriate."
1531 ;; 1532 ;;
1532 ;; Process all the complete markers in this chunk. 1533 ;; Process all the complete markers in this chunk.
1533 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc) 1534 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
1534 (let ((annotation (match-string 1 gud-marker-acc))) 1535 (let ((annotation (match-string 1 gud-marker-acc))
1535 ;; 1536 (before (substring gud-marker-acc 0 (match-beginning 0)))
1536 ;; Stuff prior to the match is just ordinary output. 1537 (after (substring gud-marker-acc (match-end 0))))
1537 ;; It is either concatenated to OUTPUT or directed
1538 ;; elsewhere.
1539 (setq output
1540 (gdb-concat-output
1541 output
1542 (substring gud-marker-acc 0 (match-beginning 0))))
1543 ;;
1544 ;; Take that stuff off the gud-marker-acc.
1545 (setq gud-marker-acc (substring gud-marker-acc (match-end 0)))
1546 ;; 1538 ;;
1547 ;; Parse the tag from the annotation, and maybe its arguments. 1539 ;; Parse the tag from the annotation, and maybe its arguments.
1548 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) 1540 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
1549 (let* ((annotation-type (match-string 1 annotation)) 1541 (let* ((annotation-type (match-string 1 annotation))
1550 (annotation-arguments (match-string 2 annotation)) 1542 (annotation-arguments (match-string 2 annotation))
1551 (annotation-rule (assoc annotation-type 1543 (annotation-rule (assoc annotation-type
1552 gdb-annotation-rules))) 1544 gdb-annotation-rules))
1545 (fullname (string-match gdb-fullname-regexp annotation-type)))
1546
1547 ;; Stuff prior to the match is just ordinary output.
1548 ;; It is either concatenated to OUTPUT or directed
1549 ;; elsewhere.
1550 (setq output
1551 (gdb-concat-output output
1552 (concat before (if fullname "\n"))))
1553
1554 ;; Take that stuff off the gud-marker-acc.
1555 (setq gud-marker-acc after)
1556
1553 ;; Call the handler for this annotation. 1557 ;; Call the handler for this annotation.
1554 (if annotation-rule 1558 (if annotation-rule
1555 (funcall (car (cdr annotation-rule)) 1559 (funcall (car (cdr annotation-rule))
1556 annotation-arguments) 1560 annotation-arguments)
1557 ;; Else the annotation is not recognized. Ignore it silently, 1561
1558 ;; so that GDB can add new annotations without causing 1562 ;; Switch to gud-gdb-marker-filter if appropriate.
1559 ;; us to blow up. 1563 (when fullname
1560 )))) 1564
1561 ;; 1565 ;; Extract the frame position from the marker.
1566 (setq gud-last-frame (cons (match-string 1 annotation)
1567 (string-to-number
1568 (match-string 2 annotation))))
1569
1570 (set (make-local-variable 'gud-minor-mode) 'gdb)
1571 (set (make-local-variable 'gud-marker-filter)
1572 'gud-gdb-marker-filter)))
1573
1574 ;; Else the annotation is not recognized. Ignore it silently,
1575 ;; so that GDB can add new annotations without causing
1576 ;; us to blow up.
1577 )))
1578
1562 ;; Does the remaining text end in a partial line? 1579 ;; Does the remaining text end in a partial line?
1563 ;; If it does, then keep part of the gud-marker-acc until we get more. 1580 ;; If it does, then keep part of the gud-marker-acc until we get more.
1564 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'" 1581 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
@@ -2810,7 +2827,7 @@ corresponding to the mode line clicked."
2810 (let ((answer (get-buffer-window buf 0)) 2827 (let ((answer (get-buffer-window buf 0))
2811 (must-split nil)) 2828 (must-split nil))
2812 (if answer 2829 (if answer
2813 (display-buffer buf nil 0) ;Raise the frame if necessary. 2830 (display-buffer buf nil 0) ;Deiconify the frame if necessary.
2814 ;; The buffer is not yet displayed. 2831 ;; The buffer is not yet displayed.
2815 (pop-to-buffer gud-comint-buffer) ;Select the right frame. 2832 (pop-to-buffer gud-comint-buffer) ;Select the right frame.
2816 (let ((window (get-lru-window))) 2833 (let ((window (get-lru-window)))