This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] crash while re-reading symbols from objfile on ppc-aix.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 12 Nov 2013 21:53:35 +0400
- Subject: Re: [RFA] crash while re-reading symbols from objfile on ppc-aix.
- Authentication-results: sourceware.org; auth=none
- References: <1384258285-21433-1-git-send-email-brobecker at adacore dot com> <874n7hilie dot fsf at fleche dot redhat dot com>
> Joel> The critical difference between
> Joel> a platform such as x86_64-linuxe where it works, and ppc-aix,
> Joel> where it doesn't lies in the fact that bfd-data sharing is not
> Joel> activated on ppc-aix, and as a result, the per-bfd data gets
> Joel> allocated on the objfile's obstack instead of in the bfd objalloc:
> I'm curious to know why it doesn't share.
I will try looking it up tomorrow if I have a moment. I just assumed
at the time that this was related to the object format not having been
updated to support sharing. Although, quoting the relevant code again:
| /* If the object requires gdb to do relocations, we simply fall
| back to not sharing data across users. These cases are rare
| enough that this seems reasonable. */
| if (abfd != NULL && !gdb_bfd_requires_relocations (abfd))
| storage = bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage));
| set_bfd_data (abfd, objfiles_bfd_data, storage);
| storage = OBSTACK_ZALLOC (&objfile->objfile_obstack,
| struct objfile_per_bfd_storage);
.. the important piece seems to be that gdb_bfd_requires_relocations
needs to be false. gdb_bfd_requires_relocations iterates over
all sections looking for SEC_RELOC:
if ((sect->flags & SEC_RELOC) != 0)
gdata->needs_relocations = 1;
And looking at the .text section for our binary:
0 .text 00000480 10000200 10000200 00000200 2**7
CONTENTS, ALLOC, LOAD, RELOC, CODE
Is that enough to explain the non-sharing?
> Joel> * symfile.c (reread_symbols): Move call to set_objfile_per_bfd
> Joel> after re-initialization of OBJFILE's obstack.
> Joel> Tested on x86_64-linux, no regression. Also tested on ppc-aix using
> Joel> AdaCore's testsuite (expect hangs at the end of the test, on ppc-aix,
> Joel> so I can't collect any result).
> Joel> Ok to commit?
> Yes, definitely. Thanks.
Thanks, Tom. I will commit tomorrow.