public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
@ 2024-04-12 16:08 peter0x44 at disroot dot org
  2024-04-12 16:09 ` [Bug gdb/31636] " peter0x44 at disroot dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: peter0x44 at disroot dot org @ 2024-04-12 16:08 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

            Bug ID: 31636
           Summary: GDB 14 incorrectly reads/handles file timestamps on
                    i686-w64-mingw32 hosts
           Product: gdb
           Version: 14.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: peter0x44 at disroot dot org
  Target Milestone: ---

When using gdb on an i686-w64-mingw32 host, GDB always detects the executable
as outdated. As a consequence, it fails to detect file changes and is unusable.

This is a regression between gdb 13 and 14, and gdb 14.2 did not fix this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/31636] GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
  2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
@ 2024-04-12 16:09 ` peter0x44 at disroot dot org
  2024-04-12 16:21 ` peter0x44 at disroot dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: peter0x44 at disroot dot org @ 2024-04-12 16:09 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

Peter Damianov <peter0x44 at disroot dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i686-w64-mingw32
                URL|                            |https://github.com/skeeto/w
                   |                            |64devkit/issues/96

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/31636] GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
  2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
  2024-04-12 16:09 ` [Bug gdb/31636] " peter0x44 at disroot dot org
@ 2024-04-12 16:21 ` peter0x44 at disroot dot org
  2024-04-12 17:52 ` ssbssa at sourceware dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: peter0x44 at disroot dot org @ 2024-04-12 16:21 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

--- Comment #1 from Peter Damianov <peter0x44 at disroot dot org> ---
The build of GDB was cross-compiled using Debian bookworm under docker.
https://github.com/skeeto/w64devkit/blob/deef5631c9ebeb5f401e5744ee3b4d22ed56a3f6/Dockerfile#L357-L368

I believe --host=i686-w64-mingw32 should be enough to reproduce, but I haven't
tried.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/31636] GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
  2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
  2024-04-12 16:09 ` [Bug gdb/31636] " peter0x44 at disroot dot org
  2024-04-12 16:21 ` peter0x44 at disroot dot org
@ 2024-04-12 17:52 ` ssbssa at sourceware dot org
  2024-04-12 18:11 ` pedro at palves dot net
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2024-04-12 17:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
The reason is, gnulib/config.h has this define:

```
/* For 64-bit time_t on 32-bit mingw. */
#define __MINGW_USE_VC2005_COMPAT 1
```

And bfd doesn't do this, so you get different definitions of struct stat.

In bfd/bfdio.c:

```
(top-gdb) pt buf
type = struct _stati64 {
    _dev_t st_dev;
    _ino_t st_ino;
    unsigned short st_mode;
    short st_nlink;
    short st_uid;
    short st_gid;
    _dev_t st_rdev;
    long long st_size;
    __time32_t st_atime;
    __time32_t st_mtime;
    __time32_t st_ctime;
}
```

And in gdb/symfile.c:

```
(top-gdb) pt new_statbuf
type = struct _stat64 {
    _dev_t st_dev;
    _ino_t st_ino;
    unsigned short st_mode;
    short st_nlink;
    short st_uid;
    short st_gid;
    _dev_t st_rdev;
    long long st_size;
    __time64_t st_atime;
    __time64_t st_mtime;
    __time64_t st_ctime;
}
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/31636] GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
  2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
                   ` (2 preceding siblings ...)
  2024-04-12 17:52 ` ssbssa at sourceware dot org
@ 2024-04-12 18:11 ` pedro at palves dot net
  2024-04-13  2:18 ` peter0x44 at disroot dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pedro at palves dot net @ 2024-04-12 18:11 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

Pedro Alves <pedro at palves dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |pedro at palves dot net
   Last reconfirmed|                            |2024-04-12
     Ever confirmed|0                           |1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/31636] GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
  2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
                   ` (3 preceding siblings ...)
  2024-04-12 18:11 ` pedro at palves dot net
@ 2024-04-13  2:18 ` peter0x44 at disroot dot org
  2024-04-13  2:20 ` peter0x44 at disroot dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: peter0x44 at disroot dot org @ 2024-04-13  2:18 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

--- Comment #3 from Peter Damianov <peter0x44 at disroot dot org> ---
Can confirm that adding -D__MINGW_USE_VC_2005_COMPAT in CFLAGS and CXXFLAGS
appears to resolve this issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/31636] GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
  2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
                   ` (4 preceding siblings ...)
  2024-04-13  2:18 ` peter0x44 at disroot dot org
@ 2024-04-13  2:20 ` peter0x44 at disroot dot org
  2024-04-13 11:15 ` ssbssa at sourceware dot org
  2024-04-19 20:44 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: peter0x44 at disroot dot org @ 2024-04-13  2:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

--- Comment #4 from Peter Damianov <peter0x44 at disroot dot org> ---
I meant to write:
-D__MINGW_USE_VC2005_COMPAT

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/31636] GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
  2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
                   ` (5 preceding siblings ...)
  2024-04-13  2:20 ` peter0x44 at disroot dot org
@ 2024-04-13 11:15 ` ssbssa at sourceware dot org
  2024-04-19 20:44 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2024-04-13 11:15 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

--- Comment #5 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to Peter Damianov from comment #3)
> Can confirm that adding -D__MINGW_USE_VC_2005_COMPAT in CFLAGS and CXXFLAGS
> appears to resolve this issue.

Yes, I would have suggested a similar workaround for now (though using CPPFLAGS
instead of CFLAGS/CXXFLAGS).

I was wondering why this problem didn't appear in gdb-13 as well, it already
contained this define since this gnulib update:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=dc6c21dabfbd242616b9e6266b459eded2d0762b

It's because reread_symbols() of gdb/symfile.c changed from stat() to
bfd_stat() here:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=f2c4f78c813a9cef38b7e9c9ad18822fb9e19345

Should bfd be changed to always define __MINGW_USE_VC2005_COMPAT for mingw
targets like gnulib does?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/31636] GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts
  2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
                   ` (6 preceding siblings ...)
  2024-04-13 11:15 ` ssbssa at sourceware dot org
@ 2024-04-19 20:44 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2024-04-19 20:44 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31636

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
I think we didn't anticipate that 'struct stat' itself could
vary between subdirectories like this.

Calling bfd_stat is unavoidable and that symfile.c change was
needed to fix a different bug -- at the very least that code
would fail for remote BFDs.

I wonder if there's a hack we could add to gnulib to avoid
some of its 'stat'-related changes.  Maybe that would be
sufficient.

Otherwise I think the only two solutions here are (1) also
get BFD to use gnulib, and (2) remove gnulib.

(1) is a bit of a pain because gdb has to carefully curate
exactly which gnulib modules are used -- since IIRC there's
at least one that we accidentally used and it broke other
things.

Probably (2) is best for our long-term sanity.  And maybe simpler
now that gdb uses c++ and can perhaps defer a subset of
the portability problems to the standard library.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-19 20:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 16:08 [Bug gdb/31636] New: GDB 14 incorrectly reads/handles file timestamps on i686-w64-mingw32 hosts peter0x44 at disroot dot org
2024-04-12 16:09 ` [Bug gdb/31636] " peter0x44 at disroot dot org
2024-04-12 16:21 ` peter0x44 at disroot dot org
2024-04-12 17:52 ` ssbssa at sourceware dot org
2024-04-12 18:11 ` pedro at palves dot net
2024-04-13  2:18 ` peter0x44 at disroot dot org
2024-04-13  2:20 ` peter0x44 at disroot dot org
2024-04-13 11:15 ` ssbssa at sourceware dot org
2024-04-19 20:44 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).