diff options
author | Tom de Vries <tdevries@suse.de> | 2022-06-06 19:27:46 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2022-06-06 19:27:46 +0200 |
commit | faec7017f0302e33a3d2be107e83a3ef21a4813e (patch) | |
tree | 8a29b3cba097e206dce5d0d7fc8d4a8eeca9da1d /gdb/python | |
parent | 772f4c2e98100e2bc3277bb7a214b8751c1cf968 (diff) | |
download | binutils-faec7017f0302e33a3d2be107e83a3ef21a4813e.zip binutils-faec7017f0302e33a3d2be107e83a3ef21a4813e.tar.gz binutils-faec7017f0302e33a3d2be107e83a3ef21a4813e.tar.bz2 |
[gdb] Fix maint selftest -v print_one_insn
When running the print_one_insn selftests with -v, I get:
...
$ gdb -q -batch -ex "maint selftest -v print_one_insn"
Running selftest print_one_insn::A6.
.shor 0x783eRunning selftest print_one_insn::A7.
trap_s 0x1Running selftest print_one_insn::ARC600.
.shor 0x783eRunning selftest print_one_insn::ARC601.
Running selftest print_one_insn::ARC700.
trap_s 0x1Running selftest print_one_insn::ARCv2.
trap_s 0x1Running selftest print_one_insn::EM.
trap_s 0x1Running selftest print_one_insn::HS.
trap_s 0x1Running selftest print_one_insn::Loongarch32.
...
The insn is written to gdb_stdout, and there is code in the selftest to add a
newline after the insn, which writes to stream().
The stream() ui_file points into a string buffer, which the disassembler uses
before writing to gdb_stdout, so writing into it after the disassembler has
finished has no effect.
Fix this by using gdb_stdlog and debug_printf (which is what the unit test
infrastructure itself uses) instead, such that we have:
...
Running selftest print_one_insn::A6.
.shor 0x783e
Running selftest print_one_insn::A7.
trap_s 0x1
Running selftest print_one_insn::ARC600.
.shor 0x783e
Running selftest print_one_insn::ARC601.
Running selftest print_one_insn::ARC700.
trap_s 0x1
Running selftest print_one_insn::ARCv2.
trap_s 0x1
Running selftest print_one_insn::Loongarch32.
...
Note: I've also removed the printing of arch_name, which would give
us otherwise the redundant:
...
Running selftest print_one_insn::A6.
arc .shor 0x783e
Running selftest print_one_insn::A7.
arc trap_s 0x1
...
Tested on x86_64-linux.
Diffstat (limited to 'gdb/python')
0 files changed, 0 insertions, 0 deletions