[PATCHv2 5/5] gdb: fix reread_symbols when an objfile has target: prefix

Andrew Burgess aburgess@redhat.com
Fri Sep 29 10:20:14 GMT 2023


Tom Tromey <tromey@adacore.com> writes:

> Andrew> I didn't 100% understand the issues discussed in that thread, however,
> Andrew> I think the problem with the previous thread related to the changes in
> Andrew> gdb_bfd.c, rather than to the change in symfile.c.  As such, I think
> Andrew> this change might be acceptable, my reasoning is:
>
> Andrew>   - the objfile::mtime field is set by a call to bfd_get_mtime (see
> Andrew>     objfiles.c), which calls bfd_stat under the hood.  This will end
> Andrew>     up using the system stat,
>
> Andrew>   - In symfile.c we currently call stat directly, which will call the
> Andrew>     gnulib stat, which, if I understand the above thread correctly,
> Andrew>     might give a different result to the system stat in some cases,
>
> Andrew>   - By switching to using bfd_stat in symfile.c we should now be
> Andrew>     consistently calling the system stat,
>
> The BFD cache (in gdb_bfd.c) uses fstat, so I think there would still be
> a problem here.

OK, but the original mtime is captured via a call to bfd_stat.

Isn't the problem when we have two mismatched calls.  Using bfd_stat in
one place (a.k.a. system stat/fstat) vs a direct call to stat/fstat from
GDB in another place (a.k.a. gnulib stat/fstat).

In this patch I'm proposing that we _consistently_ call bfd_stat.  Sure
that might disagree with system stat/fstat -- but who cares?  So long as
the time being calculated and compared to is a BFD time_t result then we
should be fine .... or am I really not understanding the problem?

Thanks,
Andrew



More information about the Gdb-patches mailing list