diff options
author | Peter Waller <p@pwaller.net> | 2020-12-21 09:38:07 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-12-21 09:38:22 -0500 |
commit | e1ff6226d8e36896edbdd651753a3e1292381ba0 (patch) | |
tree | c30ef5fba5cf64bd5d6ae951132b0b2880643623 /gdb/expression.h | |
parent | ca01f1bf3d9e5f5bcddf72bd83f574395e859d1c (diff) | |
download | gdb-e1ff6226d8e36896edbdd651753a3e1292381ba0.zip gdb-e1ff6226d8e36896edbdd651753a3e1292381ba0.tar.gz gdb-e1ff6226d8e36896edbdd651753a3e1292381ba0.tar.bz2 |
Preserve gdb_std{out, err, log, targ, targerr} across interpreter_exec_cmd
Calls through interpreter_exec_cmd can cause the output state to be modified in
a way which doesn't get back after the execution.
It looks like the intent is that interp::resume should put things back how they
should be, however, mi_interp::resume modifies gdb_stdout and nothing currently
restores it to the previous state.
To see the broken behaviour:
gdb -ex starti -ex bt -ex 'interpreter-exec mi echo' -ex bt -ex q echo <<<''
Prior to this patch, on a terminal environment, the first backtrace is
coloured, and the second backtrace is not. The reason is that
stdio_file::can_emit_style_escape becomes false, because the gdb_stdout gets
overwritten in mi_interp::resume and not replaced.
gdb/ChangeLog:
* interps.c (interpreter_exec_cmd): Restore streams pointers.
gdb/testsuite/ChangeLog:
* gdb.base/style-interp-exec-mi.exp: New.
* gdb.base/style-interp-exec-mi.c: New.
Signed-off-by: Peter Waller <p@pwaller.net>
Change-Id: Id87423b262d058857ea9dca5866ca6471741e512
Diffstat (limited to 'gdb/expression.h')
0 files changed, 0 insertions, 0 deletions