Bug 28312 - maintenance_show_worker_threads lacks CXX_STD_THREAD guard
Summary: maintenance_show_worker_threads lacks CXX_STD_THREAD guard
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 12.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-07 09:20 UTC by trass3r
Modified: 2021-09-08 07:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description trass3r 2021-09-07 09:20:37 UTC
https://github.com/bminor/binutils-gdb/blob/b4d9dd5c3576a8d6b1a59b11f8af1a3a2abd5fdc/gdb/maint.c#L850-L882

On MinGW this fails with:

gdb/maint.c:877:14: error: 'gdb::thread_pool' has not been declared
gdb::thread_pool::g_thread_pool->thread_count ());
Comment 1 Christian Biesinger 2021-09-07 16:02:21 UTC
does mingw not support std::thread?!
Comment 2 Tom de Vries 2021-09-08 07:04:10 UTC
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=42f46152849a2d4bd06a87c2dc795de1f7fc1af7 :

[gdb/build] Fix build with undefined CXX_STD_THREAD

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.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28312
Comment 3 Tom de Vries 2021-09-08 07:08:31 UTC
(In reply to Christian Biesinger from comment #1)
> does mingw not support std::thread?!

gdbsupport/common.m4:
...
  # Check for std::thread.  This does not work on some platforms, like                             
  # mingw and DJGPP.                                                                               ...