aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-02-02 23:27:57 +0000
committerPedro Alves <palves@redhat.com>2017-02-02 23:27:57 +0000
commitb1ace6bdc2063f3dcf46172db98bb3474b6e1121 (patch)
tree221787ac0308d73d24f4eb0f163a598e6be1e048
parentec4cb20ba971232450f3420d3c7c0c8bbecc1ace (diff)
downloadgdb-b1ace6bdc2063f3dcf46172db98bb3474b6e1121.zip
gdb-b1ace6bdc2063f3dcf46172db98bb3474b6e1121.tar.gz
gdb-b1ace6bdc2063f3dcf46172db98bb3474b6e1121.tar.bz2
Fix "maintenance selftest" printing stray instructions
The "maintenance selftest" command is printing odd bits of stray instructions like: ~~~ brkwarning: A handler for the OS ABI "GNU/Linux" is not built into this configuration of GDB. Attempting to continue with the default HS settings. brkmov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0mov r0, #0breakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakbreakM3.L = 0xffff;/* ( -1) M3=0x0xffff(65535) */break 8break 8warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration of GDB. Attempting to continue with the default cris:common_v10_v32 settings. ~~~ etc. Those appear because here: class gdb_disassembler_test : public gdb_disassembler { public: const bool verbose = false; explicit gdb_disassembler_test (struct gdbarch *gdbarch, const gdb_byte *insn, size_t len) : gdb_disassembler (gdbarch, (verbose ? gdb_stdout : &null_stream), gdb_disassembler_test::read_memory), specifically in this line: (verbose ? gdb_stdout : &null_stream), "verbose" has not been initialized yet, because the order of initialization is base classes first, then members. I.e. "verbose" is only initialized after the base constructor is called. Since the gdb_disassembler_test object is created on the stack, "verbose" has garbage at that point. If the gargage is non-zero, then we end up with the gdb_disassembler_test's stream incorrectly pointing to gdb_stdout. gdb/ChangeLog: 2017-02-02 Pedro Alves <palves@redhat.com> * disasm-selftests.c (print_one_insn_test): Move the "verbose" field out of gdb_disassembler_test and make it static.
-rw-r--r--gdb/disasm-selftests.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
index 7d0b006..9eb80b4 100644
--- a/gdb/disasm-selftests.c
+++ b/gdb/disasm-selftests.c
@@ -102,13 +102,12 @@ print_one_insn_test (struct gdbarch *gdbarch)
/* Test gdb_disassembler for a given gdbarch by reading data from a
pre-allocated buffer. If you want to see the disassembled
instruction printed to gdb_stdout, set verbose to true. */
+ static const bool verbose = false;
class gdb_disassembler_test : public gdb_disassembler
{
public:
- const bool verbose = false;
-
explicit gdb_disassembler_test (struct gdbarch *gdbarch,
const gdb_byte *insn,
size_t len)