Use bfd_get_filename throughout gdb

Alan Modra amodra@gmail.com
Tue May 19 22:38:36 GMT 2020


On Tue, May 19, 2020 at 09:10:29AM -0400, Simon Marchi wrote:
> On 2020-05-19 12:12 a.m., Alan Modra via Gdb-patches wrote:
> > ref: https://sourceware.org/pipermail/binutils/2020-May/111154.html
> > 
> > This patch makes gdb use the inline accessor for all bfd->filename
> > read accesses.
> > 
> > OK to apply after the 9.2 release happens?
> 
> Hi Alan,
> 
> This is ok to push to the master branch.  The 9.2 release happens from the gdb-9-branch
> anyway.

I guess I should have noticed that.  Now pushed.

> This doesn't prevent new code from using the field (in some of my pending patches,
> I'm pretty sure I have some code that accesses it).  Short of being able to make the
> field private, have you thought of leaving the field's name changed?  Perhaps adopting
> a naming convention that says "this field is private" and adding a comment above it to
> say "don't access this directly, use bfd_get_filename"?

Yes, I did think of leaving the field as "xfilename".  I put if back
to "filename" thinking I may have missed some places (files not
compiled or conditional compilation), and out of consideration for
out-of-tree projects like oprofile.

Also, there are quite a few other fields of struct bfd and struct
bfd_section that should be "made private".  A wholesale field renaming
change is probably better.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Gdb-patches mailing list