This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 1/2] ISA bit treatment on the MIPS platform
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: <gdb-patches at sourceware dot org>, Rich Fuhler <rich at mips dot com>, Richard Sandiford <rdsandiford at googlemail dot com>
- Date: Mon, 6 Oct 2014 16:43:12 +0100
- Subject: Re: [PATCH v2 1/2] ISA bit treatment on the MIPS platform
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 1 dot 10 dot 1204202134510 dot 19835 at tp dot orcam dot me dot uk> <20120611182043 dot GA7597 at adacore dot com> <alpine dot DEB dot 1 dot 10 dot 1409292313170 dot 4971 at tp dot orcam dot me dot uk>
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;