@@ -290,6 +290,7 @@ breakpoint of TYPE.")
290
290
thread-id stack-depth)
291
291
292
292
(cl-defstruct gdb--session
293
+ handling-output buffered-output
293
294
frame process buffers source-window debuggee-path debuggee-args
294
295
buffer-types-to-update buffers-to-update
295
296
threads selected-thread persist-thread selected-frame
@@ -1151,15 +1152,31 @@ HAS-CHILDREN should be t when this node has children."
1151
1152
(setq gdb--omit-console-output nil )
1152
1153
(gdb--command (concat " -interpreter-exec console " (gdb--escape-argument cmd))))))
1153
1154
1154
- (defun gdb--output-filter (string )
1155
+ (defun gdb--output-filter (mi-output )
1155
1156
" 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)))
1163
1180
1164
1181
(defun gdb--comint-sentinel (process str )
1165
1182
" Handle GDB comint process state changes."
0 commit comments