From: Jean-Philippe Gravel Date: Wed, 17 Apr 2013 00:35:22 +0000 (-0400) Subject: * lisp/progmodes/gdb-mi.el (gdbmi-bnf-incomplete-record-result): X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~445 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7ce5be546101bb1b93856125487a3a6e6c9cd854;p=emacs.git * lisp/progmodes/gdb-mi.el (gdbmi-bnf-incomplete-record-result): Fix adjustment of offset when receiving incomplete responses from GDB. Fixes: debbugs:14129 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 68ac8721bb2..4a9c8cb22ec 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-04-17 Jean-Philippe Gravel + + * progmodes/gdb-mi.el (gdbmi-bnf-incomplete-record-result): + Fix adjustment of offset when receiving incomplete responses from GDB + (bug#14129). + 2013-04-16 Stefan Monnier * progmodes/python.el (python-mode-skeleton-abbrev-table): Rename from diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 8ba2822c3a3..f5e1abdd546 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -2149,19 +2149,23 @@ the end of the current result or async record is reached." ;; Search the data stream for the end of the current record: (let* ((newline-pos (string-match "\n" gud-marker-acc gdbmi-bnf-offset)) (is-progressive (equal (cdr class-command) 'progressive)) - (is-complete (not (null newline-pos))) - result-str) + (is-complete (not (null newline-pos))) + result-str) + + (when gdbmi-debug-mode + (message "gdbmi-bnf-incomplete-record-result: %s" + (substring gud-marker-acc gdbmi-bnf-offset newline-pos))) ;; Update the gdbmi-bnf-offset only if the current chunk of data can ;; be processed by the class-command handler: (when (or is-complete is-progressive) - (setq result-str + (setq result-str (substring gud-marker-acc gdbmi-bnf-offset newline-pos)) - (setq gdbmi-bnf-offset (+ 1 newline-pos))) - (if gdbmi-debug-mode - (message "gdbmi-bnf-incomplete-record-result: %s" - (substring gud-marker-acc gdbmi-bnf-offset newline-pos))) + ;; Move gdbmi-bnf-offset past the end of the chunk. + (setq gdbmi-bnf-offset (+ gdbmi-bnf-offset (length result-str))) + (when newline-pos + (setq gdbmi-bnf-offset (1+ gdbmi-bnf-offset)))) ;; Update the parsing state before invoking the handler in class-command ;; to make sure it's not left in an invalid state if the handler was