[PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER.
Wed Oct 12 08:08:00 GMT 2016
Peter Bergner wrote:
> On 10/7/16 2:21 PM, Ulrich Weigand wrote:
> > There's a second use of disassemble_init_for_target, which probably needs
> > the same treatment. In fact, maybe the nicest way would be to call the
> > callback "gdbarch_disassemble_init_for_target", with a default of simply
> > disassemble_init_for_target, but which targets can override to do extra
> > stuff before (or after) calling disassemble_init_for_target in there.
> > GDB common code would then just call gdbarch_disassemble_init_for_target
> > everywhere it currently calls disassemble_init_for_target.
> Ok, I think this resolves all of your last suggestions. Is this better?
> * dis-asm.h (ppc_verify_disassembler_options): New prototype.
> * ppc-dis.c (parse_ppc_dis_option): New function.
> (ppc_verify_disassembler_options): Likewise.
> (powerpc_init_dialect): Use parse_ppc_dis_option().
> * gdbarch.sh (gdbarch_disassemble_init_for_target): New function.
> * gdbarch.c: Regenerate.
> * gdbarch.h: Likewise.
> * disasm.c (gdb_disassemble_info): Use it.
> (gdb_buffered_insn_length_init_dis): Likewise.
> * rs6000-tdep.c: (gdb_disassembler_cpu): New static declaration.
> (prospective_cpu): Likewise.
> (gdb_disassemble_init_for_ppc): New function.
> (set_disassembler_cpu): Likewise.
> (show_disassembler_cpu): Likewise.
> (rs6000_gdbarch_init): Setup callback for gdb_disassemble_init_for_ppc.
> (_initialize_rs6000_tdep): Setup callbacks for set_disassembler_cpu()
> and show_disassembler_cpu().
> * arch-utils.c: Include "dis-asm.h".
> (default_disassemble_init_for_target): New function.
> * arch-utils.h (default_disassemble_init_for_target): New Prototype.
Yes, for a PowerPC-only solution this patch looks fine to me. Thanks!
However, we should resolve the separate discussion with Pedro about
maybe getting a fully platform-independent solution first ...
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
More information about the Binutils