From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16818 invoked by alias); 6 Oct 2014 15:43:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 16807 invoked by uid 89); 6 Oct 2014 15:43:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Oct 2014 15:43:23 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XbARS-0005kr-Ul from Maciej_Rozycki@mentor.com ; Mon, 06 Oct 2014 08:43:19 -0700 Received: from localhost (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.3.181.6; Mon, 6 Oct 2014 16:43:17 +0100 Date: Mon, 06 Oct 2014 15:43:00 -0000 From: "Maciej W. Rozycki" To: Joel Brobecker CC: , Rich Fuhler , Richard Sandiford Subject: Re: [PATCH v2 1/2] ISA bit treatment on the MIPS platform In-Reply-To: Message-ID: References: <20120611182043.GA7597@adacore.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2014-10/txt/msg00100.txt.bz2 On Mon, 6 Oct 2014, Maciej W. Rozycki wrote: > Index: gdb-fsf-trunk-quilt/gdb/solib.c > =================================================================== > --- gdb-fsf-trunk-quilt.orig/gdb/solib.c 2014-10-03 13:52:46.000000000 +0100 > +++ gdb-fsf-trunk-quilt/gdb/solib.c 2014-10-03 14:50:26.398945943 +0100 > @@ -1444,8 +1444,28 @@ gdb_bfd_lookup_symbol_from_symtab (bfd * > > if (match_sym (sym, data)) > { > + struct gdbarch *gdbarch = target_gdbarch (); > + symaddr = sym->value; > + > + /* Some ELF targets fiddle with addresses of symbols they > + consider special. They use minimal symbols to do that > + and this is needed for correct breakpoint placement, > + but we do not have full data here to build a complete > + minimal symbol, so just set the address and let the > + targets cope with that. */ > + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour > + && gdbarch_elf_make_msymbol_special_p (gdbarch)) > + { > + struct minimal_symbol msym; > + > + memset (&msym, 0, sizeof (msym)); > + SET_MSYMBOL_VALUE_ADDRESS (&msym, symaddr); > + gdbarch_elf_make_msymbol_special (gdbarch, sym, &msym); > + symaddr = MSYMBOL_VALUE_RAW_ADDRESS (&msym); > + } > + > /* BFD symbols are section relative. */ > - symaddr = sym->value + sym->section->vma; > + symaddr += sym->section->vma; > break; > } > } I realised this part can be optimised similarly to `elf_symtab_read' in gdb/elfread.c so that `gdbarch_elf_make_msymbol_special_p' is called once per function call rather than once per symbol and I have now applied this update that I intend to consider a part of the final change. Maciej Index: gdb-fsf-trunk-quilt/gdb/solib.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/solib.c 2014-10-06 16:36:47.867795479 +0100 +++ gdb-fsf-trunk-quilt/gdb/solib.c 2014-10-06 16:36:25.368036677 +0100 @@ -1437,6 +1437,9 @@ gdb_bfd_lookup_symbol_from_symtab (bfd * struct cleanup *back_to = make_cleanup (xfree, symbol_table); unsigned int number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table); + struct gdbarch *gdbarch = target_gdbarch (); + int elf_make_msymbol_special_p + = gdbarch_elf_make_msymbol_special_p (gdbarch); for (i = 0; i < number_of_symbols; i++) { @@ -1444,7 +1447,6 @@ gdb_bfd_lookup_symbol_from_symtab (bfd * if (match_sym (sym, data)) { - struct gdbarch *gdbarch = target_gdbarch (); symaddr = sym->value; /* Some ELF targets fiddle with addresses of symbols they @@ -1454,7 +1456,7 @@ gdb_bfd_lookup_symbol_from_symtab (bfd * minimal symbol, so just set the address and let the targets cope with that. */ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour - && gdbarch_elf_make_msymbol_special_p (gdbarch)) + && elf_make_msymbol_special_p) { struct minimal_symbol msym;