From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14296 invoked by alias); 8 Apr 2003 02:31:36 -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 14282 invoked from network); 8 Apr 2003 02:31:33 -0000 Received: from unknown (HELO lacrosse.corp.redhat.com) (66.187.233.200) by sources.redhat.com with SMTP; 8 Apr 2003 02:31:33 -0000 Received: from free.redhat.lsd.ic.unicamp.br (aoliva.cipe.redhat.com [10.0.1.10]) by lacrosse.corp.redhat.com (8.11.6/8.9.3) with ESMTP id h382VVu14023 for ; Mon, 7 Apr 2003 22:31:32 -0400 Received: from free.redhat.lsd.ic.unicamp.br (free.redhat.lsd.ic.unicamp.br [127.0.0.1]) by free.redhat.lsd.ic.unicamp.br (8.12.8/8.12.8) with ESMTP id h382VRwi026093 for ; Mon, 7 Apr 2003 23:31:27 -0300 Received: (from aoliva@localhost) by free.redhat.lsd.ic.unicamp.br (8.12.8/8.12.8/Submit) id h382VRei026089; Mon, 7 Apr 2003 23:31:27 -0300 To: gdb-patches@sources.redhat.com Subject: use MIPS NewABI register names when disassembling NewABI code From: Alexandre Oliva Organization: GCC Team, Red Hat Date: Tue, 08 Apr 2003 02:31:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2003-04/txt/msg00121.txt.bz2 --=-=-= Content-length: 491 mips-opc.c:_print_insn_mips decides which register naming convention to use obtaining a pointer to the bfd from the first symbol in the symbols field from the disassemble_info argument, and then looking for ABI information in the ELF headers. Unfortunately, gdb doesn't set up symbols, so we end up always using the o32 register naming convention. This patch arranges for the information the disassembler uses to be passed to it, in an admittedly ugly, but effective way. Ok to install? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=mips-gdb-abi-disassemble.patch Content-length: 1338 Index: gdb/ChangeLog from Alexandre Oliva * mips-tdep.c (mips_gdbarch_init): Set tm_print_insn_info.symbols to at least an empty symbol. Index: gdb/mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.185 diff -u -p -r1.185 mips-tdep.c --- gdb/mips-tdep.c 7 Apr 2003 18:38:04 -0000 1.185 +++ gdb/mips-tdep.c 8 Apr 2003 02:26:04 -0000 @@ -5656,6 +5656,24 @@ mips_gdbarch_init (struct gdbarch_info i if (info.abfd) { + static asymbol *symbols = NULL; + + /* The disassembler uses *info.symbols to get to the bfd elf + flags, which it uses to tell the executable ABI, so we have + to give it at least one symbol. */ + if (tm_print_insn_info.symbols == NULL + || tm_print_insn_info.symbols == &symbols) + { + /* It would be nice if we could bfd_release the previous + symbol, but we'd need a pointer to its bfd then. */ + symbols = bfd_make_empty_symbol (info.abfd); + if (symbols != NULL) + { + tm_print_insn_info.symbols = &symbols; + tm_print_insn_info.num_symbols = 0; + } + } + /* First of all, extract the elf_flags, if available. */ if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour) elf_flags = elf_elfheader (info.abfd)->e_flags; --=-=-= Content-length: 289 -- 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 --=-=-=--