Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH][gdb/build] Fix build with undefined CXX_STD_THREAD
Date: Tue, 7 Sep 2021 16:50:08 +0200	[thread overview]
Message-ID: <20210907145006.GA4878@delia> (raw)

Hi,

When building gdb on openSUSE Leap 42.3, we trigger the case that
CXX_STD_THREAD is undefined, and run into:
...
gdb/maint.c: In function ‘void maintenance_show_worker_threads \
  (ui_file*, int, cmd_list_element*, const char*)’:
gdb/maint.c:877:14: error: ‘gdb::thread_pool’ has not been declared
         gdb::thread_pool::g_thread_pool->thread_count ());
              ^
Makefile:1647: recipe for target 'maint.o' failed
make[1]: *** [maint.o] Error 1
...

Fix this by handling the undefined CXX_STD_THREAD case in
maintenance_show_worker_threads, such that we get:
...
$ gdb -q -batch -ex "maint show worker-thread"
The number of worker threads GDB can use is 0.
...

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/build] Fix build with undefined CXX_STD_THREAD

---
 gdb/maint.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/maint.c b/gdb/maint.c
index cbd7d4ed47b..56a197c2a14 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -871,6 +871,7 @@ maintenance_show_worker_threads (struct ui_file *file, int from_tty,
 				 struct cmd_list_element *c,
 				 const char *value)
 {
+#if CXX_STD_THREAD
   if (n_worker_threads == -1)
     fprintf_filtered (file, _("The number of worker threads GDB "
 			      "can use is unlimited (currently %zu).\n"),
@@ -879,6 +880,10 @@ maintenance_show_worker_threads (struct ui_file *file, int from_tty,
     fprintf_filtered (file, _("The number of worker threads GDB "
 			      "can use is %d.\n"),
 		      n_worker_threads);
+#else
+  fprintf_filtered (file, _("The number of worker threads GDB "
+			    "can use is 0.\n"));
+#endif
 }
 
 \f

             reply	other threads:[~2021-09-07 14:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 14:50 Tom de Vries via Gdb-patches [this message]
2021-09-07 15:19 ` Tom de Vries via Gdb-patches
2021-09-07 16:12   ` Christian Biesinger via Gdb-patches
2021-09-08  7:02     ` Tom de Vries via Gdb-patches
2021-09-08  8:06   ` Tom de Vries via Gdb-patches

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=20210907145006.GA4878@delia \
    --to=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    --cc=tom@tromey.com \
    /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