This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER.
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: bergner at vnet dot ibm dot com (Peter Bergner)
- Cc: palves at redhat dot com (Pedro Alves), amodra at gmail dot com (Alan Modra), gdb-patches at sourceware dot org, binutils at sourceware dot org (binutils)
- Date: Wed, 12 Oct 2016 10:08:01 +0200 (CEST)
- Subject: Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER.
- Authentication-results: sourceware.org; auth=none
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