public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/6] gdb: callback: always include necessary headers
@ 2021-04-24 18:41 Mike Frysinger
  2021-04-24 18:41 ` [PATCH 2/6] gdb: callback: use ATTRIBUTE_NORETURN Mike Frysinger
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Mike Frysinger @ 2021-04-24 18:41 UTC (permalink / raw)
  To: gdb-patches

We use types from these headers, so always include them.
---
 include/gdb/callback.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/gdb/callback.h b/include/gdb/callback.h
index a2e02631628e..af10486e43be 100644
--- a/include/gdb/callback.h
+++ b/include/gdb/callback.h
@@ -45,12 +45,8 @@
 #ifndef CALLBACK_H
 #define CALLBACK_H
 
-/* ??? The reason why we check for va_start here should be documented.  */
-
-#ifndef va_start
 #include <ansidecl.h>
 #include <stdarg.h>
-#endif
 /* Needed for enum bfd_endian.  */
 #include "bfd.h"
 \f
-- 
2.30.2


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

* [PATCH 2/6] gdb: callback: use ATTRIBUTE_NORETURN
  2021-04-24 18:41 [PATCH 1/6] gdb: callback: always include necessary headers Mike Frysinger
@ 2021-04-24 18:41 ` Mike Frysinger
  2021-04-24 18:41 ` [PATCH 3/6] gdb: callback: inline PTR define Mike Frysinger
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2021-04-24 18:41 UTC (permalink / raw)
  To: gdb-patches

This define is handled by ansidecl.h, so no need to duplicate effort.
---
 include/gdb/callback.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/include/gdb/callback.h b/include/gdb/callback.h
index af10486e43be..b981d94505d6 100644
--- a/include/gdb/callback.h
+++ b/include/gdb/callback.h
@@ -121,11 +121,7 @@ struct host_callback_struct
   /* Print an error message and "exit".
      In the case of gdb "exiting" means doing a longjmp back to the main
      command loop.  */
-  void (*error) (host_callback *, const char *, ...)
-#ifdef __GNUC__
-    __attribute__ ((__noreturn__))
-#endif
-    ;
+  void (*error) (host_callback *, const char *, ...) ATTRIBUTE_NORETURN;
 
   int last_errno;		/* host format */
 
-- 
2.30.2


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

* [PATCH 3/6] gdb: callback: inline PTR define
  2021-04-24 18:41 [PATCH 1/6] gdb: callback: always include necessary headers Mike Frysinger
  2021-04-24 18:41 ` [PATCH 2/6] gdb: callback: use ATTRIBUTE_NORETURN Mike Frysinger
@ 2021-04-24 18:41 ` Mike Frysinger
  2021-04-24 18:41 ` [PATCH 4/6] sim: callback: inline wrap helper Mike Frysinger
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2021-04-24 18:41 UTC (permalink / raw)
  To: gdb-patches

We require C11 now, so no need for these pre-ANSI C hacks.
---
 include/gdb/callback.h   | 6 +++---
 sim/common/callback.c    | 2 +-
 sim/common/sim-syscall.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/gdb/callback.h b/include/gdb/callback.h
index b981d94505d6..11a941259f64 100644
--- a/include/gdb/callback.h
+++ b/include/gdb/callback.h
@@ -249,8 +249,8 @@ typedef struct cb_syscall {
   int errcode;
 
   /* Working space to be used by memory read/write callbacks.  */
-  PTR p1;
-  PTR p2;
+  void *p1;
+  void *p2;
   long x1,x2;
 
   /* Callbacks for reading/writing memory (e.g. for read/write syscalls).
@@ -320,7 +320,7 @@ const char *cb_target_str_signal (host_callback *, int);
 /* Translate host stat struct to target.
    If stat struct ptr is NULL, just compute target stat struct size.
    Result is size of target stat struct or 0 if error.  */
-int cb_host_to_target_stat (host_callback *, const struct stat *, PTR);
+int cb_host_to_target_stat (host_callback *, const struct stat *, void *);
 
 /* Translate a value to target endian.  */
 void cb_store_target_endian (host_callback *, char *, int, long);
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 2fec2704f3e0..6b7951d2a5ec 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -915,7 +915,7 @@ cb_store_target_endian (host_callback *cb, char *p, int size, long val)
    or zero if an error occurred during the translation.  */
 
 int
-cb_host_to_target_stat (host_callback *cb, const struct stat *hs, PTR ts)
+cb_host_to_target_stat (host_callback *cb, const struct stat *hs, void *ts)
 {
   const char *m = cb->stat_map;
   char *p;
diff --git a/sim/common/sim-syscall.c b/sim/common/sim-syscall.c
index e91453d5ba1f..9dbc71ac9fb0 100644
--- a/sim/common/sim-syscall.c
+++ b/sim/common/sim-syscall.c
@@ -71,8 +71,8 @@ sim_syscall_multi (SIM_CPU *cpu, int func, long arg1, long arg2, long arg3,
   sc.arg3 = arg3;
   sc.arg4 = arg4;
 
-  sc.p1 = (PTR) sd;
-  sc.p2 = (PTR) cpu;
+  sc.p1 = sd;
+  sc.p2 = cpu;
   sc.read_mem = sim_syscall_read_mem;
   sc.write_mem = sim_syscall_write_mem;
 
-- 
2.30.2


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

* [PATCH 4/6] sim: callback: inline wrap helper
  2021-04-24 18:41 [PATCH 1/6] gdb: callback: always include necessary headers Mike Frysinger
  2021-04-24 18:41 ` [PATCH 2/6] gdb: callback: use ATTRIBUTE_NORETURN Mike Frysinger
  2021-04-24 18:41 ` [PATCH 3/6] gdb: callback: inline PTR define Mike Frysinger
@ 2021-04-24 18:41 ` Mike Frysinger
  2021-04-24 18:41 ` [PATCH 5/6] sim: callback: convert time interface to 64-bit Mike Frysinger
  2021-04-24 18:41 ` [PATCH 6/6] sim: callback: convert FS interfaces " Mike Frysinger
  4 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2021-04-24 18:41 UTC (permalink / raw)
  To: gdb-patches

This is annoying as it requires inlining boiler plate, but we don't
have much choice: the wrap helper assumes the return value is always
an int, but that's already not the case with some of the callbacks
which use long.  GCC has extensions to define macros-as-functions,
but we can't assume GCC.
---
 sim/common/callback.c | 84 ++++++++++++++++++++++++++++++-------------
 1 file changed, 59 insertions(+), 25 deletions(-)

diff --git a/sim/common/callback.c b/sim/common/callback.c
index 6b7951d2a5ec..2b27226f0060 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -58,15 +58,6 @@ extern CB_TARGET_DEFS_MAP cb_init_syscall_map[];
 extern CB_TARGET_DEFS_MAP cb_init_errno_map[];
 extern CB_TARGET_DEFS_MAP cb_init_open_map[];
 
-/* Set the callback copy of errno from what we see now.  */
-
-static int
-wrap (host_callback *p, int val)
-{
-  p->last_errno = errno;
-  return val;
-}
-
 /* Make sure the FD provided is ok.  If not, return non-zero
    and set errno. */
 
@@ -143,7 +134,8 @@ os_close (host_callback *p, int fd)
 	  return 0;
 	}
 
-      result = wrap (p, close (fdmap (p, fd)));
+      result = close (fdmap (p, fd));
+      p->last_errno = errno;
     }
   p->fd_buddy[fd] = -1;
 
@@ -207,8 +199,9 @@ os_isatty (host_callback *p, int fd)
   result = fdbad (p, fd);
   if (result)
     return result;
-  result = wrap (p, isatty (fdmap (p, fd)));
 
+  result = isatty (fdmap (p, fd));
+  p->last_errno = errno;
   return result;
 }
 
@@ -220,7 +213,9 @@ os_lseek (host_callback *p, int fd, long off, int way)
   result = fdbad (p, fd);
   if (result)
     return result;
-  result = wrap (p, lseek (fdmap (p, fd), off, way));
+
+  result = lseek (fdmap (p, fd), off, way);
+  p->last_errno = errno;
   return result;
 }
 
@@ -296,14 +291,19 @@ os_read (host_callback *p, int fd, char *buf, int len)
       return len;
     }
 
-  result = wrap (p, read (fdmap (p, fd), buf, len));
+  result = read (fdmap (p, fd), buf, len);
+  p->last_errno = errno;
   return result;
 }
 
 static int
 os_read_stdin (host_callback *p, char *buf, int len)
 {
-  return wrap (p, read (0, buf, len));
+  int result;
+
+  result = read (0, buf, len);
+  p->last_errno = errno;
+  return result;
 }
 
 static int
@@ -362,7 +362,8 @@ os_write (host_callback *p, int fd, const char *buf, int len)
   switch (real_fd)
     {
     default:
-      result = wrap (p, write (real_fd, buf, len));
+      result = write (real_fd, buf, len);
+      p->last_errno = errno;
       break;
     case 1:
       result = p->write_stdout (p, buf, len);
@@ -401,42 +402,64 @@ os_flush_stderr (host_callback *p ATTRIBUTE_UNUSED)
 static int
 os_rename (host_callback *p, const char *f1, const char *f2)
 {
-  return wrap (p, rename (f1, f2));
+  int result;
+
+  result = rename (f1, f2);
+  p->last_errno = errno;
+  return result;
 }
 
 
 static int
 os_system (host_callback *p, const char *s)
 {
-  return wrap (p, system (s));
+  int result;
+
+  result = system (s);
+  p->last_errno = errno;
+  return result;
 }
 
 static long
 os_time (host_callback *p, long *t)
 {
-  return wrap (p, time (t));
+  long result;
+
+  result = time (t);
+  p->last_errno = errno;
+  return result;
 }
 
 
 static int
 os_unlink (host_callback *p, const char *f1)
 {
-  return wrap (p, unlink (f1));
+  int result;
+
+  result = unlink (f1);
+  p->last_errno = errno;
+  return result;
 }
 
 static int
 os_stat (host_callback *p, const char *file, struct stat *buf)
 {
+  int result;
+
   /* ??? There is an issue of when to translate to the target layout.
      One could do that inside this function, or one could have the
      caller do it.  It's more flexible to let the caller do it, though
      I'm not sure the flexibility will ever be useful.  */
-  return wrap (p, stat (file, buf));
+  result = stat (file, buf);
+  p->last_errno = errno;
+  return result;
 }
 
 static int
 os_fstat (host_callback *p, int fd, struct stat *buf)
 {
+  int result;
+
   if (fdbad (p, fd))
     return -1;
 
@@ -475,18 +498,24 @@ os_fstat (host_callback *p, int fd, struct stat *buf)
      One could do that inside this function, or one could have the
      caller do it.  It's more flexible to let the caller do it, though
      I'm not sure the flexibility will ever be useful.  */
-  return wrap (p, fstat (fdmap (p, fd), buf));
+  result = fstat (fdmap (p, fd), buf);
+  p->last_errno = errno;
+  return result;
 }
 
 static int
 os_lstat (host_callback *p, const char *file, struct stat *buf)
 {
+  int result;
+
   /* NOTE: hpn/2004-12-12: Same issue here as with os_fstat.  */
 #ifdef HAVE_LSTAT
-  return wrap (p, lstat (file, buf));
+  result = lstat (file, buf);
 #else
-  return wrap (p, stat (file, buf));
+  result = stat (file, buf);
 #endif
+  p->last_errno = errno;
+  return result;
 }
 
 static int
@@ -503,7 +532,8 @@ os_ftruncate (host_callback *p, int fd, long len)
   if (result)
     return result;
 #ifdef HAVE_FTRUNCATE
-  result = wrap (p, ftruncate (fdmap (p, fd), len));
+  result = ftruncate (fdmap (p, fd), len);
+  p->last_errno = errno;
 #else
   p->last_errno = EINVAL;
   result = -1;
@@ -515,7 +545,11 @@ static int
 os_truncate (host_callback *p, const char *file, long len)
 {
 #ifdef HAVE_TRUNCATE
-  return wrap (p, truncate (file, len));
+  int result;
+
+  result = truncate (file, len);
+  p->last_errno = errno;
+  return result;
 #else
   p->last_errno = EINVAL;
   return -1;
-- 
2.30.2


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

* [PATCH 5/6] sim: callback: convert time interface to 64-bit
  2021-04-24 18:41 [PATCH 1/6] gdb: callback: always include necessary headers Mike Frysinger
                   ` (2 preceding siblings ...)
  2021-04-24 18:41 ` [PATCH 4/6] sim: callback: inline wrap helper Mike Frysinger
@ 2021-04-24 18:41 ` Mike Frysinger
  2021-04-24 21:11   ` Tom Tromey
  2021-05-14  5:39   ` [PATCH 5/6 v2] " Mike Frysinger
  2021-04-24 18:41 ` [PATCH 6/6] sim: callback: convert FS interfaces " Mike Frysinger
  4 siblings, 2 replies; 10+ messages in thread
From: Mike Frysinger @ 2021-04-24 18:41 UTC (permalink / raw)
  To: gdb-patches

Rather than rely on time_t being the right size between the host &
target, have the interface always be 64-bit.  We can figure out if
we need to truncate when actually outputting it to the right target.
---
 include/gdb/callback.h |  3 ++-
 sim/common/callback.c  | 11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/gdb/callback.h b/include/gdb/callback.h
index 11a941259f64..f86fe7e4c548 100644
--- a/include/gdb/callback.h
+++ b/include/gdb/callback.h
@@ -47,6 +47,7 @@
 
 #include <ansidecl.h>
 #include <stdarg.h>
+#include <stdint.h>
 /* Needed for enum bfd_endian.  */
 #include "bfd.h"
 \f
@@ -78,7 +79,7 @@ struct host_callback_struct
   int (*read_stdin) ( host_callback *, char *, int);
   int (*rename) (host_callback *, const char *, const char *);
   int (*system) (host_callback *, const char *);
-  long (*time) (host_callback *, long *);
+  int64_t (*time) (host_callback *, int64_t *);
   int (*unlink) (host_callback *, const char *);
   int (*write) (host_callback *,int, const char *, int);
   int (*write_stdout) (host_callback *, const char *, int);
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 2b27226f0060..da8ea3e2f10c 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -420,12 +420,15 @@ os_system (host_callback *p, const char *s)
   return result;
 }
 
-static long
-os_time (host_callback *p, long *t)
+static int64_t
+os_time (host_callback *p, int64_t *t64)
 {
-  long result;
+  int64_t result;
+  time_t t;
 
-  result = time (t);
+  result = time (&t);
+  if (t64)
+    *t64 = t;
   p->last_errno = errno;
   return result;
 }
-- 
2.30.2


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

* [PATCH 6/6] sim: callback: convert FS interfaces to 64-bit
  2021-04-24 18:41 [PATCH 1/6] gdb: callback: always include necessary headers Mike Frysinger
                   ` (3 preceding siblings ...)
  2021-04-24 18:41 ` [PATCH 5/6] sim: callback: convert time interface to 64-bit Mike Frysinger
@ 2021-04-24 18:41 ` Mike Frysinger
  4 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2021-04-24 18:41 UTC (permalink / raw)
  To: gdb-patches

Rather than rely on off_t being the right size between the host &
target, have the interface always be 64-bit.  We can figure out if
we need to truncate when actually outputting it to the right target.
---
 include/gdb/callback.h | 6 +++---
 sim/common/callback.c  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/gdb/callback.h b/include/gdb/callback.h
index f86fe7e4c548..001e69aa8b37 100644
--- a/include/gdb/callback.h
+++ b/include/gdb/callback.h
@@ -73,7 +73,7 @@ struct host_callback_struct
   int (*close) (host_callback *,int);
   int (*get_errno) (host_callback *);
   int (*isatty) (host_callback *, int);
-  int (*lseek) (host_callback *, int, long , int);
+  int (*lseek) (host_callback *, int, int64_t, int);
   int (*open) (host_callback *, const char*, int mode);
   int (*read) (host_callback *,int,  char *, int);
   int (*read_stdin) ( host_callback *, char *, int);
@@ -89,8 +89,8 @@ struct host_callback_struct
   int (*to_stat) (host_callback *, const char *, struct stat *);
   int (*to_fstat) (host_callback *, int, struct stat *);
   int (*to_lstat) (host_callback *, const char *, struct stat *);
-  int (*ftruncate) (host_callback *, int, long);
-  int (*truncate) (host_callback *, const char *, long);
+  int (*ftruncate) (host_callback *, int, int64_t);
+  int (*truncate) (host_callback *, const char *, int64_t);
   int (*pipe) (host_callback *, int *);
 
   /* Called by the framework when a read call has emptied a pipe buffer.  */
diff --git a/sim/common/callback.c b/sim/common/callback.c
index da8ea3e2f10c..d31fdc606c90 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -206,7 +206,7 @@ os_isatty (host_callback *p, int fd)
 }
 
 static int
-os_lseek (host_callback *p, int fd, long off, int way)
+os_lseek (host_callback *p, int fd, int64_t off, int way)
 {
   int result;
 
@@ -522,7 +522,7 @@ os_lstat (host_callback *p, const char *file, struct stat *buf)
 }
 
 static int
-os_ftruncate (host_callback *p, int fd, long len)
+os_ftruncate (host_callback *p, int fd, int64_t len)
 {
   int result;
 
@@ -545,7 +545,7 @@ os_ftruncate (host_callback *p, int fd, long len)
 }
 
 static int
-os_truncate (host_callback *p, const char *file, long len)
+os_truncate (host_callback *p, const char *file, int64_t len)
 {
 #ifdef HAVE_TRUNCATE
   int result;
-- 
2.30.2


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

* Re: [PATCH 5/6] sim: callback: convert time interface to 64-bit
  2021-04-24 18:41 ` [PATCH 5/6] sim: callback: convert time interface to 64-bit Mike Frysinger
@ 2021-04-24 21:11   ` Tom Tromey
  2021-04-24 22:36     ` Mike Frysinger
  2021-05-14  5:39   ` [PATCH 5/6 v2] " Mike Frysinger
  1 sibling, 1 reply; 10+ messages in thread
From: Tom Tromey @ 2021-04-24 21:11 UTC (permalink / raw)
  To: Mike Frysinger via Gdb-patches

>>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:

Mike> Rather than rely on time_t being the right size between the host &
Mike> target, have the interface always be 64-bit.  We can figure out if
Mike> we need to truncate when actually outputting it to the right target.

Mike> -  long (*time) (host_callback *, long *);
Mike> +  int64_t (*time) (host_callback *, int64_t *);

It is possible to remove the 'int64_t *' parameter here?
The Linux time(2) man page says:

       The tloc argument is obsolescent and should always be NULL in new code.
       When tloc is NULL, the call cannot fail.

And, it does seem redundant.

Tom

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

* Re: [PATCH 5/6] sim: callback: convert time interface to 64-bit
  2021-04-24 21:11   ` Tom Tromey
@ 2021-04-24 22:36     ` Mike Frysinger
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2021-04-24 22:36 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Mike Frysinger via Gdb-patches

On 24 Apr 2021 15:11, Tom Tromey wrote:
> >>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Mike> Rather than rely on time_t being the right size between the host &
> Mike> target, have the interface always be 64-bit.  We can figure out if
> Mike> we need to truncate when actually outputting it to the right target.
> 
> Mike> -  long (*time) (host_callback *, long *);
> Mike> +  int64_t (*time) (host_callback *, int64_t *);
> 
> It is possible to remove the 'int64_t *' parameter here?
> The Linux time(2) man page says:
> 
>        The tloc argument is obsolescent and should always be NULL in new code.
>        When tloc is NULL, the call cannot fail.
> 
> And, it does seem redundant.

sure, if we're going to change the API, might as well only do it once.
it'll simplify the body too.
-mike

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

* [PATCH 5/6 v2] sim: callback: convert time interface to 64-bit
  2021-04-24 18:41 ` [PATCH 5/6] sim: callback: convert time interface to 64-bit Mike Frysinger
  2021-04-24 21:11   ` Tom Tromey
@ 2021-05-14  5:39   ` Mike Frysinger
  2021-05-14 14:00     ` Tom Tromey
  1 sibling, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2021-05-14  5:39 UTC (permalink / raw)
  To: gdb-patches

PR sim/27705
Rather than rely on time_t being the right size between the host &
target, have the interface always be 64-bit.  We can figure out if
we need to truncate when actually outputting it to the right target.
---
v2:
- delete the pointer arg and always return the value directly

 include/sim/callback.h |  3 ++-
 sim/common/callback.c  | 10 +++++-----
 sim/common/sim-io.c    |  7 +++----
 sim/common/sim-io.h    |  2 +-
 sim/common/syscall.c   |  2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/sim/callback.h b/include/sim/callback.h
index 87a61df08554..f40385e57616 100644
--- a/include/sim/callback.h
+++ b/include/sim/callback.h
@@ -47,6 +47,7 @@
 
 #include <ansidecl.h>
 #include <stdarg.h>
+#include <stdint.h>
 /* Needed for enum bfd_endian.  */
 #include "bfd.h"
 \f
@@ -78,7 +79,7 @@ struct host_callback_struct
   int (*read_stdin) ( host_callback *, char *, int);
   int (*rename) (host_callback *, const char *, const char *);
   int (*system) (host_callback *, const char *);
-  long (*time) (host_callback *, long *);
+  int64_t (*time) (host_callback *);
   int (*unlink) (host_callback *, const char *);
   int (*write) (host_callback *,int, const char *, int);
   int (*write_stdout) (host_callback *, const char *, int);
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 1b53823c4180..fb5e86431cc2 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -420,12 +420,12 @@ os_system (host_callback *p, const char *s)
   return result;
 }
 
-static long
-os_time (host_callback *p, long *t)
+static int64_t
+os_time (host_callback *p)
 {
-  long result;
+  int64_t result;
 
-  result = time (t);
+  result = time (NULL);
   p->last_errno = errno;
   return result;
 }
@@ -466,7 +466,7 @@ os_fstat (host_callback *p, int fd, struct stat *buf)
   if (p->ispipe[fd])
     {
 #if defined (HAVE_STRUCT_STAT_ST_ATIME) || defined (HAVE_STRUCT_STAT_ST_CTIME) || defined (HAVE_STRUCT_STAT_ST_MTIME)
-      time_t t = (*p->time) (p, NULL);
+      time_t t = (*p->time) (p);
 #endif
 
       /* We have to fake the struct stat contents, since the pipe is
diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c
index f418c3748cdc..e5da7f1fdaac 100644
--- a/sim/common/sim-io.c
+++ b/sim/common/sim-io.c
@@ -68,11 +68,10 @@ sim_io_unlink (SIM_DESC sd,
 }
 
 
-long
-sim_io_time (SIM_DESC sd,
-	     long *t)
+int64_t
+sim_io_time (SIM_DESC sd)
 {
-  return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd), t);
+  return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd));
 }
 
 
diff --git a/sim/common/sim-io.h b/sim/common/sim-io.h
index f018538ce469..a091fd08e469 100644
--- a/sim/common/sim-io.h
+++ b/sim/common/sim-io.h
@@ -31,7 +31,7 @@ int sim_io_shutdown (SIM_DESC sd);
 
 int sim_io_unlink (SIM_DESC sd, const char *);
 
-long sim_io_time (SIM_DESC sd, long *);
+int64_t sim_io_time (SIM_DESC sd);
 
 int sim_io_system (SIM_DESC sd, const char *);
 
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 258b3d694f4e..0a1d3f4114da 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -588,7 +588,7 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
 	   We might also want gettimeofday or times, but if system calls
 	   can be built on others, we can keep the number we have to support
 	   here down.  */
-	time_t t = (*cb->time) (cb, (time_t *) 0);
+	time_t t = (*cb->time) (cb);
 	result = t;
 	/* It is up to target code to process the argument to time().  */
       }
-- 
2.31.1


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

* Re: [PATCH 5/6 v2] sim: callback: convert time interface to 64-bit
  2021-05-14  5:39   ` [PATCH 5/6 v2] " Mike Frysinger
@ 2021-05-14 14:00     ` Tom Tromey
  0 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2021-05-14 14:00 UTC (permalink / raw)
  To: Mike Frysinger via Gdb-patches

>>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:

Mike> PR sim/27705
Mike> Rather than rely on time_t being the right size between the host &
Mike> target, have the interface always be 64-bit.  We can figure out if
Mike> we need to truncate when actually outputting it to the right target.

Looks good to me.  Thanks for doing this.

Tom

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

end of thread, other threads:[~2021-05-14 14:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-24 18:41 [PATCH 1/6] gdb: callback: always include necessary headers Mike Frysinger
2021-04-24 18:41 ` [PATCH 2/6] gdb: callback: use ATTRIBUTE_NORETURN Mike Frysinger
2021-04-24 18:41 ` [PATCH 3/6] gdb: callback: inline PTR define Mike Frysinger
2021-04-24 18:41 ` [PATCH 4/6] sim: callback: inline wrap helper Mike Frysinger
2021-04-24 18:41 ` [PATCH 5/6] sim: callback: convert time interface to 64-bit Mike Frysinger
2021-04-24 21:11   ` Tom Tromey
2021-04-24 22:36     ` Mike Frysinger
2021-05-14  5:39   ` [PATCH 5/6 v2] " Mike Frysinger
2021-05-14 14:00     ` Tom Tromey
2021-04-24 18:41 ` [PATCH 6/6] sim: callback: convert FS interfaces " Mike Frysinger

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).