From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30194 invoked by alias); 11 Apr 2003 15:06:05 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30166 invoked from network); 11 Apr 2003 15:06:04 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 11 Apr 2003 15:06:04 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id C12C12B2F; Fri, 11 Apr 2003 11:06:04 -0400 (EDT) Message-ID: <3E96D9DC.5080508@redhat.com> Date: Fri, 11 Apr 2003 15:06:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alexandre Oliva Cc: cgd@broadcom.com, gdb-patches@sources.redhat.com, binutils@sources.redhat.com Subject: Re: use MIPS NewABI register names when disassembling NewABI code References: <3E927BCA.1080702@redhat.com> <3E93391F.2050005@redhat.com> <3E94339A.8030405@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-04/txt/msg00233.txt.bz2 > On Apr 11, 2003, cgd@broadcom.com wrote: > > >> At Fri, 11 Apr 2003 05:43:18 +0000 (UTC), "Alexandre Oliva" wrote: > >>> * mips-dis.c (_print_insn_mips): Override reg_names from >>> disassembler_options. > > >> Uh... Well... "I'm not the maintainer, but i'd say no." 8-) Anything with the word `new' in it should set of alarm bells. "New" (in edit case) doublely so :-) > Index: gdb/ChangeLog > from Alexandre Oliva > > * Makefile.in (libbfd_h): Added missing setting. Obvious, thanks (Is the use of libbfd.h permitted though?). > * mips-tdep.c (mips_gdbarch_init): Set disassembler_options > according to the selected ABI. Yes!! Can you please create a bug report (http://www.gnu.org/software/gdb/bugs/, pointing out that the MIPS needs a ``set mips disassembler' command. thanks, Andrew > Index: gdb/Makefile.in > =================================================================== > RCS file: /cvs/src/src/gdb/Makefile.in,v > retrieving revision 1.361 > diff -u -p -r1.361 Makefile.in > --- gdb/Makefile.in 10 Apr 2003 13:15:50 -0000 1.361 > +++ gdb/Makefile.in 11 Apr 2003 07:43:10 -0000 > @@ -574,6 +574,7 @@ elf_sh_h = $(INCLUDE_DIR)/elf/sh.h > elf_arm_h = $(INCLUDE_DIR)/elf/arm.h $(elf_reloc_macros_h) > elf_bfd_h = $(BFD_SRC)/elf-bfd.h > libaout_h = $(BFD_SRC)/libaout.h > +libbfd_h = $(BFD_SRC)/libbfd.h > remote_sim_h = $(INCLUDE_DIR)/gdb/remote-sim.h > demangle_h = $(INCLUDE_DIR)/demangle.h > obstack_h = $(INCLUDE_DIR)/obstack.h > Index: gdb/mips-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/mips-tdep.c,v > retrieving revision 1.187 > diff -u -p -r1.187 mips-tdep.c > --- gdb/mips-tdep.c 8 Apr 2003 19:21:15 -0000 1.187 > +++ gdb/mips-tdep.c 11 Apr 2003 07:43:14 -0000 > @@ -5731,6 +5731,34 @@ mips_gdbarch_init (struct gdbarch_info i > if (wanted_abi != MIPS_ABI_UNKNOWN) > mips_abi = wanted_abi; > > + /* We have to set tm_print_insn_info before looking for a > + pre-existing architecture, otherwise we may return before we get > + a chance to set it up. */ > + if (mips_abi == MIPS_ABI_N32 || mips_abi == MIPS_ABI_N64) > + { > + /* Set up the disassembler info, so that we get the right > + register names from libopcodes. */ > + if (mips_abi == MIPS_ABI_N32) > + tm_print_insn_info.disassembler_options = "gpr-names=n32"; > + else > + tm_print_insn_info.disassembler_options = "gpr-names=64"; > + tm_print_insn_info.flavour = bfd_target_elf_flavour; > + tm_print_insn_info.arch = bfd_arch_mips; > + if (info.bfd_arch_info != NULL > + && info.bfd_arch_info->arch == bfd_arch_mips > + && info.bfd_arch_info->mach) > + tm_print_insn_info.mach = info.bfd_arch_info->mach; > + else > + tm_print_insn_info.mach = bfd_mach_mips8000; > + } > + else > + /* This string is not recognized explicitly by the disassembler, > + but it tells the disassembler to not try to guess the ABI from > + the bfd elf headers, such that, if the user overrides the ABI > + of a program linked as NewABI, the disassembly will follow the > + register naming conventions specified by the user. */ > + tm_print_insn_info.disassembler_options = "gpr-names=32"; > + > if (gdbarch_debug) > { > fprintf_unfiltered (gdb_stdlog, > @@ -5875,18 +5903,6 @@ mips_gdbarch_init (struct gdbarch_info i > set_gdbarch_long_bit (gdbarch, 32); > set_gdbarch_ptr_bit (gdbarch, 32); > set_gdbarch_long_long_bit (gdbarch, 64); > - > - /* Set up the disassembler info, so that we get the right > - register names from libopcodes. */ > - tm_print_insn_info.flavour = bfd_target_elf_flavour; > - tm_print_insn_info.arch = bfd_arch_mips; > - if (info.bfd_arch_info != NULL > - && info.bfd_arch_info->arch == bfd_arch_mips > - && info.bfd_arch_info->mach) > - tm_print_insn_info.mach = info.bfd_arch_info->mach; > - else > - tm_print_insn_info.mach = bfd_mach_mips8000; > - > set_gdbarch_use_struct_convention (gdbarch, > mips_n32n64_use_struct_convention); > set_gdbarch_reg_struct_has_addr (gdbarch, > @@ -5906,18 +5922,6 @@ mips_gdbarch_init (struct gdbarch_info i > set_gdbarch_long_bit (gdbarch, 64); > set_gdbarch_ptr_bit (gdbarch, 64); > set_gdbarch_long_long_bit (gdbarch, 64); > - > - /* Set up the disassembler info, so that we get the right > - register names from libopcodes. */ > - tm_print_insn_info.flavour = bfd_target_elf_flavour; > - tm_print_insn_info.arch = bfd_arch_mips; > - if (info.bfd_arch_info != NULL > - && info.bfd_arch_info->arch == bfd_arch_mips > - && info.bfd_arch_info->mach) > - tm_print_insn_info.mach = info.bfd_arch_info->mach; > - else > - tm_print_insn_info.mach = bfd_mach_mips8000; > - > set_gdbarch_use_struct_convention (gdbarch, > mips_n32n64_use_struct_convention); > set_gdbarch_reg_struct_has_addr (gdbarch, > > > > > -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org} CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist Professional serial bug killer