It looks like the default behavior for gdb-mi is to simply ignore the target-stream output from gdb. This is data returned by the MI interface prefixed with @. The key function is gdbmi-bnf-target-stream-output in gdb-mi.el. I used the advice-add feature to override this function in my .emacs file:
(defun my-gdbmi-bnf-target-stream-output (c-string)
(add-hook 'kill-buffer-hook 'comint-write-input-ring)
For some reason gdb, as one of the comint modes, does not do this by default.
Note: gdb gud buffer has to be killed.
By default tt is not enough to just 'quit' from gdb session. You really need to kill comint (gdb) buffer. You can correct this behavior so, when you quit gdb session ('q' or 'quit'), ...