# HG changeset patch # User Nick Roberts # Date 1191322623 0 # Node ID b70291074dcf21aec64313ddd4e77858095ca533 # Parent 07537c759a20f27fadb65bcbe380d485226e3b8c (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. diff -r 07537c759a20 -r b70291074dcf lisp/progmodes/gdb-ui.el --- a/lisp/progmodes/gdb-ui.el Tue Oct 02 10:55:29 2007 +0000 +++ b/lisp/progmodes/gdb-ui.el Tue Oct 02 10:57:03 2007 +0000 @@ -472,9 +472,6 @@ expr))) (defun gdb-init-1 () - (set (make-local-variable 'gud-minor-mode) 'gdba) - (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) - ;; (gud-def gud-break (if (not (string-match "Machine" mode-name)) (gud-call "break %f:%l" arg) (save-excursion @@ -1515,6 +1512,10 @@ (set-window-buffer source-window buffer)) source-window)) +;; Derived from gud-gdb-marker-regexp +(defvar gdb-fullname-regexp + (concat "\\(.:?[^" ":" "\n]*\\)" ":" "\\([0-9]*\\)" ":" ".*")) + (defun gud-gdba-marker-filter (string) "A gud marker filter for gdb. Handle a burst of output from GDB." (if gdb-flush-pending-output @@ -1531,34 +1532,50 @@ ;; ;; Process all the complete markers in this chunk. (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc) - (let ((annotation (match-string 1 gud-marker-acc))) - ;; - ;; Stuff prior to the match is just ordinary output. - ;; It is either concatenated to OUTPUT or directed - ;; elsewhere. - (setq output - (gdb-concat-output - output - (substring gud-marker-acc 0 (match-beginning 0)))) - ;; - ;; Take that stuff off the gud-marker-acc. - (setq gud-marker-acc (substring gud-marker-acc (match-end 0))) + (let ((annotation (match-string 1 gud-marker-acc)) + (before (substring gud-marker-acc 0 (match-beginning 0))) + (after (substring gud-marker-acc (match-end 0)))) ;; ;; Parse the tag from the annotation, and maybe its arguments. (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation) (let* ((annotation-type (match-string 1 annotation)) (annotation-arguments (match-string 2 annotation)) (annotation-rule (assoc annotation-type - gdb-annotation-rules))) + gdb-annotation-rules)) + (fullname (string-match gdb-fullname-regexp annotation-type))) + + ;; Stuff prior to the match is just ordinary output. + ;; It is either concatenated to OUTPUT or directed + ;; elsewhere. + (setq output + (gdb-concat-output output + (concat before (if fullname "\n")))) + + ;; Take that stuff off the gud-marker-acc. + (setq gud-marker-acc after) + ;; Call the handler for this annotation. (if annotation-rule (funcall (car (cdr annotation-rule)) annotation-arguments) - ;; Else the annotation is not recognized. Ignore it silently, - ;; so that GDB can add new annotations without causing - ;; us to blow up. - )))) - ;; + + ;; Switch to gud-gdb-marker-filter if appropriate. + (when fullname + + ;; Extract the frame position from the marker. + (setq gud-last-frame (cons (match-string 1 annotation) + (string-to-number + (match-string 2 annotation)))) + + (set (make-local-variable 'gud-minor-mode) 'gdb) + (set (make-local-variable 'gud-marker-filter) + 'gud-gdb-marker-filter))) + + ;; Else the annotation is not recognized. Ignore it silently, + ;; so that GDB can add new annotations without causing + ;; us to blow up. + ))) + ;; Does the remaining text end in a partial line? ;; If it does, then keep part of the gud-marker-acc until we get more. (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'" @@ -2810,7 +2827,7 @@ (let ((answer (get-buffer-window buf 0)) (must-split nil)) (if answer - (display-buffer buf nil 0) ;Raise the frame if necessary. + (display-buffer buf nil 0) ;Deiconify the frame if necessary. ;; The buffer is not yet displayed. (pop-to-buffer gud-comint-buffer) ;Select the right frame. (let ((window (get-lru-window)))