diff options
author | Andrew Burgess <aburgess@redhat.com> | 2025-06-23 13:45:02 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2025-06-23 14:11:20 +0100 |
commit | 98cc89d9ca11e3f89a35698ce21d25dd48cf97eb (patch) | |
tree | df0fe864a0b1806bf820f0bafdc8cc338e6fa880 /gdb/python/py-connection.c | |
parent | 28b75d9dcb8b15543a22c8390b2b14ba1c54306c (diff) | |
download | binutils-98cc89d9ca11e3f89a35698ce21d25dd48cf97eb.zip binutils-98cc89d9ca11e3f89a35698ce21d25dd48cf97eb.tar.gz binutils-98cc89d9ca11e3f89a35698ce21d25dd48cf97eb.tar.bz2 |
gdbserver: include sys/stat.h for 'struct stat'
Tom de Vries reported a build failure on x86_64-w64-mingw32 after
commit:
commit bd389c9515d240f55b117075b43184efdea41287
Date: Wed Jun 11 22:52:16 2025 +0200
gdb: implement linux namespace support for fileio_lstat and vFile::lstat
The build failure looks like this:
../../src/gdbserver/hostio.cc: In function 'void handle_lstat(char*, int*)':
../../src/gdbserver/hostio.cc:544:63: error: cannot convert '_stat64*' to 'stat*'
544 | ret = the_target->multifs_lstat (hostio_fs_pid, filename, &st);
| ^~~
| |
| _stat64*
In file included from ./../../src/gdbserver/server.h:58,
from <command-line>:
./../../src/gdbserver/target.h:448:74: note: initializing argument 3 of 'virtual int process_stratum_target::multifs_lstat(int, const char*, stat*)'
448 | virtual int multifs_lstat (int pid, const char *filename, struct stat *sb);
| ~~~~~~~~~~~~~^~
The problem is that in sys/stat.h for mingw, 'stat' is #defined to
_stat64, but target.h doesn't include sys/stat.h, and so doesn't see
this #define.
However, target.h does, by luck, manages to see the actual definition
of 'struct stat', which isn't in sys/stat.h itself, but is in some
other header that just happens to be pulled in by chance.
As a result of all this, the declaration of
process_stratum_target::multifs_lstat in target.h uses 'struct stat'
for its argument type, while the call in hostio.cc, uses 'struct
_stat64' as its argument type, which causes the build error seen
above.
The fix is to include sys/stat.h in target.h so that the declaration's
argument type will change to 'struct _stat64' (via the #define).
Diffstat (limited to 'gdb/python/py-connection.c')
0 files changed, 0 insertions, 0 deletions