public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb/testsuite] Require syscall time in gdb.reverse/time-reverse.exp
Date: Tue, 21 Feb 2023 14:10:27 +0100	[thread overview]
Message-ID: <20230221131027.29637-1-tdevries@suse.de> (raw)

On aarch64-linux, I run into:
...
Running gdb.reverse/time-reverse.exp ...
gdb compile failed, gdb.reverse/time-reverse.c: In function 'main':
gdb.reverse/time-reverse.c:39:12: error: 'SYS_time' undeclared \
  (first use in this function); did you mean 'SYS_times'?
   syscall (SYS_time, &time_global);
            ^~~~~~~~
            SYS_times
gdb.reverse/time-reverse.c:39:12: note: each undeclared identifier is \
  reported only once for each function it appears in
UNTESTED: gdb.reverse/time-reverse.exp: failed to prepare
...

Fix this by adding a new proc have_syscall, and requiring syscall time, such
that we have instead:
...
UNSUPPORTED: gdb.reverse/time-reverse.exp: require failed: \
  expr [have_syscall time]
...

Tested on x86_64-linux and aarch64-linux.
---
 gdb/testsuite/gdb.reverse/time-reverse.exp |  2 ++
 gdb/testsuite/lib/gdb.exp                  | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/gdb/testsuite/gdb.reverse/time-reverse.exp b/gdb/testsuite/gdb.reverse/time-reverse.exp
index 07d55b348e8..befda65d836 100644
--- a/gdb/testsuite/gdb.reverse/time-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/time-reverse.exp
@@ -23,6 +23,8 @@ require supports_reverse
 
 standard_testfile
 
+require {expr [have_syscall time]}
+
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index e48228ed4f6..12839a54710 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9397,5 +9397,16 @@ gdb_caching_proc linux_kernel_version {
     return [list $v1 $v2 $v3]
 }
 
+# Return 1 if syscall NAME is supported.
+
+proc have_syscall { name } {
+    set src \
+	[list \
+	     "#include <sys/syscall.h>" \
+	     "int var = SYS_$name;"]
+    set src [join $src "\n"]
+    return [gdb_can_simple_compile have_syscall_$name $src object]
+}
+
 # Always load compatibility stuff.
 load_lib future.exp

base-commit: d720176596dd6495c258fa73c4029f009616ebd2
-- 
2.35.3


             reply	other threads:[~2023-02-21 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 13:10 Tom de Vries [this message]
2023-02-21 19:44 ` Tom Tromey
2023-02-24 12:53   ` Tom de Vries
2023-02-22 16:12 ` [PATCH] gdb.reverse/time-reverse.exp: test both time syscall and C time function (was: Re: [pushed] [gdb/testsuite] Require syscall time in gdb.reverse/time-reverse.exp) Pedro Alves
2023-02-22 17:06   ` Tom de Vries
2023-02-22 18:11     ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230221131027.29637-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).