This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patchv3 4/5] Keep objfile original filename
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 19 Sep 2013 15:22:12 +0200
- Subject: Re: [patchv3 4/5] Keep objfile original filename
- Authentication-results: sourceware.org; auth=none
- References: <20130915193809 dot GD20411 at host2 dot jankratochvil dot net> <21047 dot 36157 dot 621746 dot 711266 at ruffy dot mtv dot corp dot google dot com>
On Tue, 17 Sep 2013 00:59:09 +0200, Doug Evans wrote:
> Jan Kratochvil writes:
> > --- a/gdb/objfiles.c
> > +++ b/gdb/objfiles.c
> > @@ -281,20 +286,23 @@ allocate_objfile (bfd *abfd, int flags)
> > that any data that is reference is saved in the per-objfile data
> > region. */
> >
> > + if (name != NULL)
> > + objfile->original_name = xstrdup (name);
> > + else
> > + {
> > + gdb_assert (abfd == NULL);
> > + objfile->original_name = xstrdup ("<<anonymous objfile>>");
> > + }
>
> An alternative is to store the name in objfile_obstack.
Done, for a new patch.
> > --- a/gdb/symfile.c
> > +++ b/gdb/symfile.c
> > @@ -839,7 +839,8 @@ read_symbols (struct objfile *objfile, int add_flags)
> > struct cleanup *cleanup = make_cleanup_bfd_unref (abfd);
> >
> > if (abfd != NULL)
> > - symbol_file_add_separate (abfd, add_flags, objfile);
> > + symbol_file_add_separate (abfd, objfile->original_name, add_flags,
> > + objfile);
>
> Yeah. Passing objfile->original_name here will help a lot.
I do not understand it much, I do not think this particular case does matter
much. It is just about the ".gnu_debugdata" section case
(AKA "minidebuginfo"), FSF GDB HEAD already uses the same bfd+objfile name as
the file containing the section. This may not be perfect, I would expect more
something like:
xstrprintf ("%s:.gnu_debugdata", objfile->name);
But that is off-topic for this patch.
Using ORIGINAL_NAME here just follows what this patch does everywhere else.
> I can see a case for either way (abfd's file name or objfile->original_name).
What would be the reason for abfd's file name?
> Maybe add a comment here explaining why objfile_original_name is passed?
Added this one:
/* find_separate_debug_file_in_section uses the same filename for the
virtual section-as-bfd like the bfd filename containing the
section. Therefore use also non-canonical name form for the same
file containing the section. */
I will re-post it separately.
Thanks,
Jan