Re: [PATCH 2/3] Consistently use BFD's time

Christian Biesinger via gdb-patches
2020-01-14T22:26:43Z

On Tue, Jan 14, 2020 at 4:10 PM Tom Tromey <tromey@adacore.com> wrote:
>
> gdb uses the gnulib stat, while BFD does not. This can lead to
> inconsistencies between the two, because the gnulib stat adjusts for
> timezones.
>
> This patch changes gdb to use bfd_stat when examining a BFD's time.
> This avoids the problem; and also opens the door to caching target
> BFDs as well.
>
> One possible downside here is that gdb must now create a BFD before
> checking the cache.
>
> gdb/ChangeLog
> 2020-01-14 Tom Tromey <tromey@adacore.com>
>
> * gdb_bfd.c (gdb_bfd_open): Use bfd_stat.
> * symfile.c (reread_symbols): Use bfd_stat.
>
> Change-Id: Ie937630a221cbae15809c99327b47c1cbce141c0
> ---
> gdb/ChangeLog | 5 +++++
> gdb/gdb_bfd.c | 49 +++++++++++++++++++++++++------------------------
> gdb/symfile.c | 5 +----
> 3 files changed, 31 insertions(+), 28 deletions(-)
>
> diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
> index a1ee7814f32..26968396a15 100644
> --- a/gdb/gdb_bfd.c
> +++ b/gdb/gdb_bfd.c
> @@ -442,8 +442,15 @@ gdb_bfd_open (const char *name, const char *target, int fd)
> }
> }
>
> + /* We open the BFD here so that we can use BFD to get the mtime.
> + This is important because gdb uses the gnulib stat, but BFD does
> + not, and this can lead to differences on some systems. */

Maybe mention that mingw/windows is one of those?

Christian