Skip to content

Commit 3ad4746

Browse files
committed
try to fix issue #5
1 parent 0afb7b1 commit 3ad4746

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

gdb-mi.el

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ breakpoint of TYPE.")
290290
thread-id stack-depth)
291291

292292
(cl-defstruct gdb--session
293+
handling-output buffered-output
293294
frame process buffers source-window debuggee-path debuggee-args
294295
buffer-types-to-update buffers-to-update
295296
threads selected-thread persist-thread selected-frame
@@ -1151,15 +1152,31 @@ HAS-CHILDREN should be t when this node has children."
11511152
(setq gdb--omit-console-output nil)
11521153
(gdb--command (concat "-interpreter-exec console " (gdb--escape-argument cmd))))))
11531154

1154-
(defun gdb--output-filter (string)
1155+
(defun gdb--output-filter (mi-output)
11551156
"Parse GDB/MI output."
1156-
(gdb--debug-execute-body 'raw-output (message "%s" string))
1157-
(let* ((gc-cons-threshold most-positive-fixnum)
1158-
(output (gdb--measure-time "Handle MI Output" (gdb--handle-mi-output string))))
1159-
(gdb--update)
1160-
(gdb--debug-execute-body '(timings commands raw-output)
1161-
(message "--------------------"))
1162-
output))
1157+
(gdb--with-valid-session
1158+
(setf (gdb--session-buffered-output session) (concat (gdb--session-buffered-output session)
1159+
mi-output))
1160+
(let ((gc-cons-threshold most-positive-fixnum)
1161+
str-to-process (output ""))
1162+
(unless (gdb--session-handling-output session)
1163+
(unwind-protect
1164+
(progn
1165+
(setf (gdb--session-handling-output session) t)
1166+
1167+
(while (gdb--session-buffered-output session)
1168+
(setq str-to-process (gdb--session-buffered-output session))
1169+
(setf (gdb--session-buffered-output session) nil)
1170+
1171+
(gdb--debug-execute-body 'raw-output (message "%s" str-to-process))
1172+
(setq output (concat output
1173+
(gdb--measure-time "Handle MI Output" (gdb--handle-mi-output str-to-process))))
1174+
(gdb--update)
1175+
(gdb--debug-execute-body '(timings commands raw-output)
1176+
(message "--------------------"))))
1177+
1178+
(setf (gdb--session-handling-output session) nil)))
1179+
output)))
11631180

11641181
(defun gdb--comint-sentinel (process str)
11651182
"Handle GDB comint process state changes."

0 commit comments

Comments
 (0)