aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.reverse/time-reverse.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2023-02-22 15:40:58 +0000
committerPedro Alves <pedro@palves.net>2023-02-22 18:09:08 +0000
commit4097906672137d1a07b073a639374e9809a4f2db (patch)
treecf40f5c2a1a659c71923b0473efa6194ce338100 /gdb/testsuite/gdb.reverse/time-reverse.c
parentba25141c1e520f20c210b42fec19823667e83b8e (diff)
downloadbinutils-4097906672137d1a07b073a639374e9809a4f2db.zip
binutils-4097906672137d1a07b073a639374e9809a4f2db.tar.gz
binutils-4097906672137d1a07b073a639374e9809a4f2db.tar.bz2
gdb.reverse/time-reverse.exp: test both time syscall and C time function
Instead of only testing this on systems that have a SYS_time syscall, test it everywhere using the time(2) C function, and in addition, run the tests again using the SYS_time syscall. The C variant ensures that if some platform uses some syscall we are not aware of yet, we'll still exercise it, and likely fail, at which point we should teach GDB about the syscall. The explicit syscall variant is useful on platforms where the C function does not call a syscall at all by default, e.g., on some systems the C time function wraps an implementation provided by the vDSO. Approved-By: Tom de Vries <tdevries@suse.de> Change-Id: Id4b755d76577d02c46b8acbfa249d9c31b587633
Diffstat (limited to 'gdb/testsuite/gdb.reverse/time-reverse.c')
-rw-r--r--gdb/testsuite/gdb.reverse/time-reverse.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.reverse/time-reverse.c b/gdb/testsuite/gdb.reverse/time-reverse.c
index 668fb10..c22ecd8 100644
--- a/gdb/testsuite/gdb.reverse/time-reverse.c
+++ b/gdb/testsuite/gdb.reverse/time-reverse.c
@@ -20,6 +20,12 @@
#include <sys/syscall.h>
#include <unistd.h>
+#ifdef USE_SYSCALL
+# define my_time(TLOC) syscall (SYS_time, TLOC)
+#else
+# define my_time(TLOC) time (TLOC)
+#endif
+
void
marker1 (void)
{
@@ -36,7 +42,7 @@ int
main (void)
{
marker1 ();
- syscall (SYS_time, &time_global);
+ my_time (&time_global);
marker2 ();
return 0;
}