forked from Imagelibrary/binutils-gdb
[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
This commit is contained in:
23
gdb/maint.c
23
gdb/maint.c
@@ -871,14 +871,23 @@ maintenance_show_worker_threads (struct ui_file *file, int from_tty,
|
|||||||
struct cmd_list_element *c,
|
struct cmd_list_element *c,
|
||||||
const char *value)
|
const char *value)
|
||||||
{
|
{
|
||||||
|
#if CXX_STD_THREAD
|
||||||
if (n_worker_threads == -1)
|
if (n_worker_threads == -1)
|
||||||
fprintf_filtered (file, _("The number of worker threads GDB "
|
{
|
||||||
"can use is unlimited (currently %zu).\n"),
|
fprintf_filtered (file, _("The number of worker threads GDB "
|
||||||
gdb::thread_pool::g_thread_pool->thread_count ());
|
"can use is unlimited (currently %zu).\n"),
|
||||||
else
|
gdb::thread_pool::g_thread_pool->thread_count ());
|
||||||
fprintf_filtered (file, _("The number of worker threads GDB "
|
return;
|
||||||
"can use is %d.\n"),
|
}
|
||||||
n_worker_threads);
|
#endif
|
||||||
|
|
||||||
|
int report_threads = 0;
|
||||||
|
#if CXX_STD_THREAD
|
||||||
|
report_threads = n_worker_threads;
|
||||||
|
#endif
|
||||||
|
fprintf_filtered (file, _("The number of worker threads GDB "
|
||||||
|
"can use is %d.\n"),
|
||||||
|
report_threads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user