aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2004-11-22 20:08:26 +0000
committerNick Roberts2004-11-22 20:08:26 +0000
commit7c511b96e0cc692a4b772fe34ed7470b4020c20e (patch)
tree747694106e3b0d71d134cbc230fd88b71ed5e28b
parent47924ad55082a0a13855727956ae16f8254e49a7 (diff)
downloademacs-7c511b96e0cc692a4b772fe34ed7470b4020c20e.tar.gz
emacs-7c511b96e0cc692a4b772fe34ed7470b4020c20e.zip
(gdb-flush-pending-output): New variable.
(gdb-send-item, gdb-resync, gud-gdba-marker-filter): Use it.
-rw-r--r--lisp/progmodes/gdb-ui.el110
1 files changed, 58 insertions, 52 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 34bc3a33e80..af3b4d3e0e5 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -69,6 +69,7 @@
69(defvar gdb-buffer-type nil) 69(defvar gdb-buffer-type nil)
70(defvar gdb-overlay-arrow-position nil) 70(defvar gdb-overlay-arrow-position nil)
71(defvar gdb-server-prefix nil) 71(defvar gdb-server-prefix nil)
72(defvar gdb-flush-pending-output nil)
72 73
73(defvar gdb-buffer-type nil 74(defvar gdb-buffer-type nil
74 "One of the symbols bound in `gdb-buffer-rules'.") 75 "One of the symbols bound in `gdb-buffer-rules'.")
@@ -234,6 +235,7 @@ detailed description of this mode.
234 (setq gdb-pending-triggers nil) 235 (setq gdb-pending-triggers nil)
235 (setq gdb-output-sink 'user) 236 (setq gdb-output-sink 'user)
236 (setq gdb-server-prefix "server ") 237 (setq gdb-server-prefix "server ")
238 (setq gdb-flush-pending-output nil)
237 ;; 239 ;;
238 (setq gdb-buffer-type 'gdba) 240 (setq gdb-buffer-type 'gdba)
239 ;; 241 ;;
@@ -643,6 +645,7 @@ This filter may simply queue input for a later time."
643 last)))) 645 last))))
644 646
645(defun gdb-send-item (item) 647(defun gdb-send-item (item)
648 (setq gdb-flush-pending-output nil)
646 (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log)) 649 (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log))
647 (setq gdb-current-item item) 650 (setq gdb-current-item item)
648 (with-current-buffer gud-comint-buffer 651 (with-current-buffer gud-comint-buffer
@@ -706,6 +709,7 @@ This filter may simply queue input for a later time."
706 ) "An assoc mapping annotation tags to functions which process them.") 709 ) "An assoc mapping annotation tags to functions which process them.")
707 710
708(defun gdb-resync() 711(defun gdb-resync()
712 (setq gdb-flush-pending-output t)
709 (setq gud-running nil) 713 (setq gud-running nil)
710 (setq gdb-output-sink 'user) 714 (setq gdb-output-sink 'user)
711 (setq gdb-input-queue nil) 715 (setq gdb-input-queue nil)
@@ -854,61 +858,63 @@ happens to be appropriate."
854 858
855(defun gud-gdba-marker-filter (string) 859(defun gud-gdba-marker-filter (string)
856 "A gud marker filter for gdb. Handle a burst of output from GDB." 860 "A gud marker filter for gdb. Handle a burst of output from GDB."
857 (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log)) 861 (if gdb-flush-pending-output
858 ;; Recall the left over gud-marker-acc from last time 862 nil
859 (setq gud-marker-acc (concat gud-marker-acc string)) 863 (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log))
860 ;; Start accumulating output for the GUD buffer 864 ;; Recall the left over gud-marker-acc from last time
861 (let ((output "")) 865 (setq gud-marker-acc (concat gud-marker-acc string))
862 ;; 866 ;; Start accumulating output for the GUD buffer
863 ;; Process all the complete markers in this chunk. 867 (let ((output ""))
864 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc) 868 ;;
865 (let ((annotation (match-string 1 gud-marker-acc))) 869 ;; Process all the complete markers in this chunk.
866 ;; 870 (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
867 ;; Stuff prior to the match is just ordinary output. 871 (let ((annotation (match-string 1 gud-marker-acc)))
868 ;; It is either concatenated to OUTPUT or directed 872 ;;
869 ;; elsewhere. 873 ;; Stuff prior to the match is just ordinary output.
870 (setq output 874 ;; It is either concatenated to OUTPUT or directed
871 (gdb-concat-output 875 ;; elsewhere.
872 output
873 (substring gud-marker-acc 0 (match-beginning 0))))
874 ;;
875 ;; Take that stuff off the gud-marker-acc.
876 (setq gud-marker-acc (substring gud-marker-acc (match-end 0)))
877 ;;
878 ;; Parse the tag from the annotation, and maybe its arguments.
879 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
880 (let* ((annotation-type (match-string 1 annotation))
881 (annotation-arguments (match-string 2 annotation))
882 (annotation-rule (assoc annotation-type
883 gdb-annotation-rules)))
884 ;; Call the handler for this annotation.
885 (if annotation-rule
886 (funcall (car (cdr annotation-rule))
887 annotation-arguments)
888 ;; Else the annotation is not recognized. Ignore it silently,
889 ;; so that GDB can add new annotations without causing
890 ;; us to blow up.
891 ))))
892 ;;
893 ;; Does the remaining text end in a partial line?
894 ;; If it does, then keep part of the gud-marker-acc until we get more.
895 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
896 gud-marker-acc)
897 (progn
898 ;; Everything before the potential marker start can be output.
899 (setq output 876 (setq output
900 (gdb-concat-output output 877 (gdb-concat-output
901 (substring gud-marker-acc 0 878 output
902 (match-beginning 0)))) 879 (substring gud-marker-acc 0 (match-beginning 0))))
903 ;; 880 ;;
904 ;; Everything after, we save, to combine with later input. 881 ;; Take that stuff off the gud-marker-acc.
905 (setq gud-marker-acc (substring gud-marker-acc (match-beginning 0)))) 882 (setq gud-marker-acc (substring gud-marker-acc (match-end 0)))
883 ;;
884 ;; Parse the tag from the annotation, and maybe its arguments.
885 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
886 (let* ((annotation-type (match-string 1 annotation))
887 (annotation-arguments (match-string 2 annotation))
888 (annotation-rule (assoc annotation-type
889 gdb-annotation-rules)))
890 ;; Call the handler for this annotation.
891 (if annotation-rule
892 (funcall (car (cdr annotation-rule))
893 annotation-arguments)
894 ;; Else the annotation is not recognized. Ignore it silently,
895 ;; so that GDB can add new annotations without causing
896 ;; us to blow up.
897 ))))
906 ;; 898 ;;
907 ;; In case we know the gud-marker-acc contains no partial annotations: 899 ;; Does the remaining text end in a partial line?
908 (progn 900 ;; If it does, then keep part of the gud-marker-acc until we get more.
909 (setq output (gdb-concat-output output gud-marker-acc)) 901 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
910 (setq gud-marker-acc ""))) 902 gud-marker-acc)
911 output)) 903 (progn
904 ;; Everything before the potential marker start can be output.
905 (setq output
906 (gdb-concat-output output
907 (substring gud-marker-acc 0
908 (match-beginning 0))))
909 ;;
910 ;; Everything after, we save, to combine with later input.
911 (setq gud-marker-acc (substring gud-marker-acc (match-beginning 0))))
912 ;;
913 ;; In case we know the gud-marker-acc contains no partial annotations:
914 (progn
915 (setq output (gdb-concat-output output gud-marker-acc))
916 (setq gud-marker-acc "")))
917 output)))
912 918
913(defun gdb-concat-output (so-far new) 919(defun gdb-concat-output (so-far new)
914 (let ((sink gdb-output-sink)) 920 (let ((sink gdb-output-sink))