gdb: fix use of uninitialised gdb_printing_disassembler::m_in_comment
Simon pointed out that gdb_printing_disassembler::m_in_comment can be
used uninitialised by the Python disassembler API code. This issue
was spotted when GDB was built with the undefined behaviour sanitizer,
and causes the gdb.python/py-disasm.exp test to fail like this:
(gdb) PASS: gdb.python/py-disasm.exp: global_disassembler=GlobalPreInfoDisassembler: python add_global_disassembler(GlobalPreInfoDisassembler)
disassemble main
Dump of assembler code for function main:
0x0000555555555119 <+0>: push %rbp
0x000055555555511a <+1>: mov %rsp,%rbp
0x000055555555511d <+4>: nop
/home/user/src/binutils-gdb/gdb/disasm.h:144:12: runtime error: load of value 118, which is not a valid value for type 'bool'
The problem is that in disasmpy_builtin_disassemble we create a new
instance of gdbpy_disassembler, which is a sub-class of
gdb_printing_disassembler, however, the m_in_comment field is never
initialised.
This commit fixes the issue by providing a default initialisation
value for m_in_comment in disasm.h. As we only ever disassemble a
single instruction in disasmpy_builtin_disassemble then we don't need
to worry about reseting m_in_comment back to false after the single
instruction has been disassembled.
With this commit the above issue is resolved and
gdb.python/py-disasm.exp now passes.