+2020-12-21  Peter Waller  <p@pwaller.net>
+
+       * interps.c (interpreter_exec_cmd): Restore streams pointers.
+
 2020-12-21  Markus Metzger  <markus.t.metzger@intel.com>
 
        * record.c (require_record_target): Rephrase error message.
 
   unsigned int nrules;
   unsigned int i;
 
+  /* Interpreters may clobber stdout/stderr (e.g.  in mi_interp::resume at time
+     of writing), preserve their state here.  */
+  scoped_restore save_stdout = make_scoped_restore (&gdb_stdout);
+  scoped_restore save_stderr = make_scoped_restore (&gdb_stderr);
+  scoped_restore save_stdlog = make_scoped_restore (&gdb_stdlog);
+  scoped_restore save_stdtarg = make_scoped_restore (&gdb_stdtarg);
+  scoped_restore save_stdtargerr = make_scoped_restore (&gdb_stdtargerr);
+
   if (args == NULL)
     error_no_arg (_("interpreter-exec command"));
 
 
+2020-12-21  Peter Waller  <p@pwaller.net>
+
+       * gdb.base/style-interp-exec-mi.exp: New.
+       * gdb.base/style-interp-exec-mi.c: New.
+
 2020-12-21  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * gdb.base/list.exp: Replace send_gdb + gdb_expect with
 
--- /dev/null
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2020 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+int
+main (void)
+{
+  return 0;
+}
 
--- /dev/null
+# Copyright 2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# It was observed that when doing:
+#
+#   - backtrace
+#   - an "interpreter-exec mi" command
+#   - backtrace again
+#
+# The second backtrace would not be styled.  This test tests that.
+
+standard_testfile
+
+save_vars { env(TERM) } {
+    # We need an ANSI-capable terminal to get the output.
+    setenv TERM ansi
+
+    if { [prepare_for_testing "failed to prepare" \
+           ${testfile} ${srcfile}] } {
+       return
+    }
+
+    if { ![runto_main] } {
+       untested "could not run to main"
+       return
+    }
+
+    gdb_test_no_output "set style enabled on"
+    set main_expr [style main function]
+    gdb_test "backtrace" ".* ${main_expr} .*" "backtrace before"
+    gdb_test "interpreter-exec mi \"-data-evaluate-expression 1\"" \
+       "\\^done,value=\"1\""
+    gdb_test "backtrace" ".* ${main_expr} .*" "backtrace after"
+}