aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2014-12-03 02:33:13 -0500
committerJoel Brobecker <brobecker@adacore.com>2014-12-03 13:43:08 +0400
commit2d7bb7580ac174127f8ae127ebc4156a91035fc0 (patch)
treeb2bda134fce35d42ba03bd5377f2f2138ae27dc1 /sim/common
parentfd9edc908915788839e7605e2fe4c00f4b3eb3db (diff)
downloadgdb-2d7bb7580ac174127f8ae127ebc4156a91035fc0.zip
gdb-2d7bb7580ac174127f8ae127ebc4156a91035fc0.tar.gz
gdb-2d7bb7580ac174127f8ae127ebc4156a91035fc0.tar.bz2
callback.h:struct host_callback_struct compilation error on Windows hosts.
On Windows, a recent gnulib update imported the lstat module, and this caused a remote-sim.c build failure in struct host_callback_struct: In file included from /[...]/gdb/remote-sim.c:34:0: /[...]/gdb/../include/gdb/callback.h:93:9: error: duplicate member '_stati64' int (*lstat) (host_callback *, const char *, struct stat *); ^ What happens it that gnulib's stat.h makes the following defines: /* Large File Support on native Windows. */ #if 1 # define stat _stati64 #endif and then: #if 1 # if ! 0 /* mingw does not support symlinks, therefore it does not have lstat. But without links, stat does just fine. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lstat stat # endif So, the following fields in struct host_callback_struct... int (*stat) (host_callback *, const char *, struct stat *); int (*fstat) (host_callback *, int, struct stat *); int (*lstat) (host_callback *, const char *, struct stat *); ... get translated to... int (*_stati64) (host_callback *, const char *, struct _stati64 *); int (*_fstati64) (host_callback *, int, struct _stati64 *); int (*_stati64) (host_callback *, const char *, struct _stati64 *); ... which causes two fields to have the same name. This patch fixes the issue by renaming the stat-related fields by adding a "to_" prefix, similar to what is done in GDB's target_ops vector. include/gdb/ChangeLog: * callback.h (struct host_callback_struct) <to_stat>: Renamed from "stat". <to_fstat>: Renamed from "fstat". <to_lstat>: Renamed from "lstat". sim/common/ChangeLog: * sim-io.c (sim_io_stat, sim_io_fstat): Adjust calls to "stat" and "fstat" callbacks by calls to "to_stat" and "to_fstat" (resp) callbacks following renaming in callback.h. * syscall.c (cb_syscall): Likewise. Adjust calls to "lstat" callback by call to "to_lstat" callback sim/cris/ChangeLog: * traps.c (cris_break_13_handler): Adjust call to "fstat" callback by call to "to_fstat" following renaming in callback.h. sim/h8300/ChangeLog: * compile.c (sim_resume): Adjust calls to "stat" and "fstat" callbacks by calls to "to_stat" and "to_fstat" (resp) callbacks following renaming in callback.h.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog8
-rw-r--r--sim/common/sim-io.c4
-rw-r--r--sim/common/syscall.c6
3 files changed, 13 insertions, 5 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 64f2081..3c85626 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-03 Joel Brobecker <brobecker@adacore.com>
+
+ * sim-io.c (sim_io_stat, sim_io_fstat): Adjust calls to "stat"
+ and "fstat" callbacks by calls to "to_stat" and "to_fstat" (resp)
+ callbacks following renaming in callback.h.
+ * syscall.c (cb_syscall): Likewise. Adjust calls to "lstat"
+ callback by call to "to_lstat" callback
+
2014-08-28 Gary Benson <gbenson@redhat.com>
* sim-trace.h (debug_printf): New define.
diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c
index 918137b..1114ec6 100644
--- a/sim/common/sim-io.c
+++ b/sim/common/sim-io.c
@@ -391,11 +391,11 @@ sim_io_poll_read (SIM_DESC sd,
int
sim_io_stat (SIM_DESC sd, const char *path, struct stat *buf)
{
- return STATE_CALLBACK (sd)->stat (STATE_CALLBACK (sd), path, buf);
+ return STATE_CALLBACK (sd)->to_stat (STATE_CALLBACK (sd), path, buf);
}
int
sim_io_fstat (SIM_DESC sd, int fd, struct stat *buf)
{
- return STATE_CALLBACK (sd)->fstat (STATE_CALLBACK (sd), fd, buf);
+ return STATE_CALLBACK (sd)->to_fstat (STATE_CALLBACK (sd), fd, buf);
}
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 397cd80..b5cb1ca 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -455,7 +455,7 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
result = -1;
goto FinishSyscall;
}
- result = (*cb->stat) (cb, path, &statbuf);
+ result = (*cb->to_stat) (cb, path, &statbuf);
free (path);
if (result < 0)
goto ErrorFinish;
@@ -488,7 +488,7 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
struct stat statbuf;
TADDR addr = sc->arg2;
- result = (*cb->fstat) (cb, sc->arg1, &statbuf);
+ result = (*cb->to_fstat) (cb, sc->arg1, &statbuf);
if (result < 0)
goto ErrorFinish;
buflen = cb_host_to_target_stat (cb, NULL, NULL);
@@ -526,7 +526,7 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
result = -1;
goto FinishSyscall;
}
- result = (*cb->lstat) (cb, path, &statbuf);
+ result = (*cb->to_lstat) (cb, path, &statbuf);
free (path);
if (result < 0)
goto ErrorFinish;