public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/5] In gdb.threads/pthreads.c, handle pthread_attr_setscope ENOTSUP
Date: Wed, 20 Sep 2023 18:59:58 +0100	[thread overview]
Message-ID: <20230920175959.2305271-5-pedro@palves.net> (raw)
In-Reply-To: <20230920175959.2305271-1-pedro@palves.net>

On Cygwin, I see:

 (gdb) PASS: gdb.threads/pthreads.exp: break thread1
 continue
 Continuing.
 pthread_attr_setscope 1: Not supported (134)
 [Thread 3732.0x265c exited with code 1]
 [Thread 3732.0x2834 exited with code 1]
 [Thread 3732.0x2690 exited with code 1]

 Program terminated with signal SIGHUP, Hangup.
 The program no longer exists.
 (gdb) FAIL: gdb.threads/pthreads.exp: Continue to creation of first thread

 ... and then a set of cascading failures.

Fix this by treating ENOTSUP the same way as if PTHREAD_SCOPE_SYSTEM
were not defined.  I.e., ignore ENOTSUP errors, and proceed with
testing.

Change-Id: Iea68ff8b9937570726154f36610c48ef96101871
---
 gdb/testsuite/gdb.threads/pthreads.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.threads/pthreads.c b/gdb/testsuite/gdb.threads/pthreads.c
index 547bf0fe3f0..4b8b283b048 100644
--- a/gdb/testsuite/gdb.threads/pthreads.c
+++ b/gdb/testsuite/gdb.threads/pthreads.c
@@ -24,6 +24,7 @@
 #include <pthread.h>
 #include <unistd.h>
 #include <string.h>
+#include <errno.h>
 
 static int verbose = 0;
 
@@ -135,7 +136,7 @@ main (int argc, char **argv)
 
 #ifdef PTHREAD_SCOPE_SYSTEM
   res = pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
-  if (res != 0)
+  if (res != 0 && res != ENOTSUP)
     {
       print_error ("pthread_attr_setscope 1", res);
       exit (1);
-- 
2.34.1


  parent reply	other threads:[~2023-09-20 18:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 17:59 [PATCH 0/5] Adjust/fix gdb.thread/pthreads.exp for Cygwin Pedro Alves
2023-09-20 17:59 ` [PATCH 1/5] gdb.threads/pthreads.c, K&R -> ANSI function style Pedro Alves
2023-09-20 17:59 ` [PATCH 2/5] Fix gdb.threads/pthreads.c formatting Pedro Alves
2023-09-20 17:59 ` [PATCH 3/5] Fix gdb.threads/pthreads.exp error handling/printing Pedro Alves
2023-09-20 17:59 ` Pedro Alves [this message]
2023-09-20 17:59 ` [PATCH 5/5] Adjust gdb.thread/pthreads.exp for Cygwin Pedro Alves
2023-09-21 19:21 ` [PATCH 0/5] Adjust/fix " Tom Tromey

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=20230920175959.2305271-5-pedro@palves.net \
    --to=pedro@palves.net \
    --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).