* [PATCH] New --enable-threading configure option to control use of threads in GDB/GDBserver
@ 2021-12-02 19:06 Luis Machado
2021-12-07 18:51 ` Tom Tromey
0 siblings, 1 reply; 5+ messages in thread
From: Luis Machado @ 2021-12-02 19:06 UTC (permalink / raw)
To: gdb-patches
Add the --enable-threading configure option so multithreading can be disabled
at configure time. This is useful for statically-linked builds of
GDB/GDBserver, since the thread library doesn't play well with that setup.
If you try to run a statically-linked GDB built with threading, it will crash
when setting up the number of worker threads.
This new option is also convenient when debugging GDB in a system with lots of
threads, where the thread discovery code in GDB will emit too many messages,
like so:
[New Thread 0xfffff74d3a50 (LWP 2625599)]
If you have X threads, that message will be repeated X times.
The default for --enable-threading is "yes".
OK?
---
gdb/configure | 24 +++++++++++++++++++++++-
gdbserver/configure | 24 +++++++++++++++++++++++-
gdbsupport/common.m4 | 22 +++++++++++++++++++---
gdbsupport/configure | 24 +++++++++++++++++++++++-
4 files changed, 88 insertions(+), 6 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index 448167f3c6d..d13ab374050 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -910,6 +910,7 @@ with_python
with_python_libdir
with_guile
enable_source_highlight
+enable_threading
with_intel_pt
with_libipt_prefix
with_libipt_type
@@ -1597,6 +1598,8 @@ Optional Features:
--disable-rpath do not hardcode runtime library paths
--enable-source-highlight
enable source-highlight for source listings
+ --enable-threading include support for parallel processing of data
+ (yes/no)
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings if gcc is used
--enable-gdb-build-warnings
@@ -14065,6 +14068,22 @@ fi
done
+ # ----------------------- #
+ # Check for threading. #
+ # ----------------------- #
+
+ # Check whether --enable-threading was given.
+if test "${enable_threading+set}" = set; then :
+ enableval=$enable_threading; case "$enableval" in
+ yes) want_threading=yes ;;
+ no) want_threading=no ;;
+ *) as_fn_error $? "bad value $enableval for threading" "$LINENO" 5 ;;
+ esac
+else
+ want_threading=yes
+fi
+
+
# Check for std::thread. This does not work on some platforms, like
# mingw and DJGPP.
ac_ext=cpp
@@ -14762,10 +14781,13 @@ done
LIBS="$save_LIBS"
CXXFLAGS="$save_CXXFLAGS"
fi
- if test "$gdb_cv_cxx_std_thread" = "yes"; then
+
+ if test "$want_threading" = "yes"; then
+ if test "$gdb_cv_cxx_std_thread" = "yes"; then
$as_echo "#define CXX_STD_THREAD 1" >>confdefs.h
+ fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
diff --git a/gdbserver/configure b/gdbserver/configure
index 8e2bd4e1ba5..d90135be45c 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -746,6 +746,7 @@ ac_user_opts='
enable_option_checking
enable_maintainer_mode
enable_largefile
+enable_threading
with_intel_pt
with_gnu_ld
enable_rpath
@@ -1396,6 +1397,8 @@ Optional Features:
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
--disable-largefile omit support for large files
+ --enable-threading include support for parallel processing of data
+ (yes/no)
--disable-rpath do not hardcode runtime library paths
--enable-unit-tests Enable the inclusion of unit tests when compiling
GDB
@@ -7264,6 +7267,22 @@ fi
done
+ # ----------------------- #
+ # Check for threading. #
+ # ----------------------- #
+
+ # Check whether --enable-threading was given.
+if test "${enable_threading+set}" = set; then :
+ enableval=$enable_threading; case "$enableval" in
+ yes) want_threading=yes ;;
+ no) want_threading=no ;;
+ *) as_fn_error $? "bad value $enableval for threading" "$LINENO" 5 ;;
+ esac
+else
+ want_threading=yes
+fi
+
+
# Check for std::thread. This does not work on some platforms, like
# mingw and DJGPP.
ac_ext=cpp
@@ -7961,10 +7980,13 @@ done
LIBS="$save_LIBS"
CXXFLAGS="$save_CXXFLAGS"
fi
- if test "$gdb_cv_cxx_std_thread" = "yes"; then
+
+ if test "$want_threading" = "yes"; then
+ if test "$gdb_cv_cxx_std_thread" = "yes"; then
$as_echo "#define CXX_STD_THREAD 1" >>confdefs.h
+ fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
index 81e7c75f51d..430d66b5558 100644
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -76,6 +76,19 @@ AC_DEFUN([GDB_AC_COMMON], [
# Define HAVE_KINFO_GETFILE if kinfo_getfile is available.
AC_CHECK_FUNCS(kinfo_getfile)
+ # ----------------------- #
+ # Check for threading. #
+ # ----------------------- #
+
+ AC_ARG_ENABLE(threading,
+ AS_HELP_STRING([--enable-threading], [include support for parallel processing of data (yes/no)]),
+ [case "$enableval" in
+ yes) want_threading=yes ;;
+ no) want_threading=no ;;
+ *) AC_MSG_ERROR([bad value $enableval for threading]) ;;
+ esac],
+ [want_threading=yes])
+
# Check for std::thread. This does not work on some platforms, like
# mingw and DJGPP.
AC_LANG_PUSH([C++])
@@ -101,9 +114,12 @@ AC_DEFUN([GDB_AC_COMMON], [
LIBS="$save_LIBS"
CXXFLAGS="$save_CXXFLAGS"
fi
- if test "$gdb_cv_cxx_std_thread" = "yes"; then
- AC_DEFINE(CXX_STD_THREAD, 1,
- [Define to 1 if std::thread works.])
+
+ if test "$want_threading" = "yes"; then
+ if test "$gdb_cv_cxx_std_thread" = "yes"; then
+ AC_DEFINE(CXX_STD_THREAD, 1,
+ [Define to 1 if std::thread works.])
+ fi
fi
AC_LANG_POP
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 0b4e81a9c16..8b4cb7e098d 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -767,6 +767,7 @@ enable_silent_rules
enable_dependency_tracking
enable_plugins
enable_largefile
+enable_threading
with_intel_pt
with_gnu_ld
enable_rpath
@@ -1419,6 +1420,8 @@ Optional Features:
speeds up one-time build
--enable-plugins Enable support for plugins
--disable-largefile omit support for large files
+ --enable-threading include support for parallel processing of data
+ (yes/no)
--disable-rpath do not hardcode runtime library paths
--enable-unit-tests Enable the inclusion of unit tests when compiling
GDB
@@ -8277,6 +8280,22 @@ fi
done
+ # ----------------------- #
+ # Check for threading. #
+ # ----------------------- #
+
+ # Check whether --enable-threading was given.
+if test "${enable_threading+set}" = set; then :
+ enableval=$enable_threading; case "$enableval" in
+ yes) want_threading=yes ;;
+ no) want_threading=no ;;
+ *) as_fn_error $? "bad value $enableval for threading" "$LINENO" 5 ;;
+ esac
+else
+ want_threading=yes
+fi
+
+
# Check for std::thread. This does not work on some platforms, like
# mingw and DJGPP.
ac_ext=cpp
@@ -8974,10 +8993,13 @@ done
LIBS="$save_LIBS"
CXXFLAGS="$save_CXXFLAGS"
fi
- if test "$gdb_cv_cxx_std_thread" = "yes"; then
+
+ if test "$want_threading" = "yes"; then
+ if test "$gdb_cv_cxx_std_thread" = "yes"; then
$as_echo "#define CXX_STD_THREAD 1" >>confdefs.h
+ fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] New --enable-threading configure option to control use of threads in GDB/GDBserver
2021-12-02 19:06 [PATCH] New --enable-threading configure option to control use of threads in GDB/GDBserver Luis Machado
@ 2021-12-07 18:51 ` Tom Tromey
2021-12-15 17:17 ` Luis Machado
0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2021-12-07 18:51 UTC (permalink / raw)
To: Luis Machado via Gdb-patches
>>>>> "Luis" == Luis Machado via Gdb-patches <gdb-patches@sourceware.org> writes:
Luis> Add the --enable-threading configure option so multithreading can be disabled
Luis> at configure time. This is useful for statically-linked builds of
Luis> GDB/GDBserver, since the thread library doesn't play well with that setup.
This is ok.
thanks,
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] New --enable-threading configure option to control use of threads in GDB/GDBserver
2021-12-07 18:51 ` Tom Tromey
@ 2021-12-15 17:17 ` Luis Machado
2021-12-15 19:27 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Luis Machado @ 2021-12-15 17:17 UTC (permalink / raw)
To: Tom Tromey, Luis Machado via Gdb-patches
On 12/7/21 3:51 PM, Tom Tromey wrote:
>>>>>> "Luis" == Luis Machado via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Luis> Add the --enable-threading configure option so multithreading can be disabled
> Luis> at configure time. This is useful for statically-linked builds of
> Luis> GDB/GDBserver, since the thread library doesn't play well with that setup.
>
> This is ok.
>
> thanks,
> Tom
>
Thanks. As I was going to push this, I noticed I forgot to add a NEWS
entry to make it more obvious this option exists.
Here's what I plan to push alongside this patch:
diff --git a/gdb/NEWS b/gdb/NEWS
index 13b66286876..3f78ace82bb 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,17 @@
*** Changes since GDB 11
+* Configure changes
+
+--enable-threading
+
+ Enable or disable multithreaded symbol loading. This is enabled
+ by default, but passing --disable-threading or --enable-threading=no
+ to configure will disable it.
+
+ Disabling this can cause a performance penalty when there are a lot of
+ symbols to load, but is useful for debugging purposes.
+
* New commands
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] New --enable-threading configure option to control use of threads in GDB/GDBserver
2021-12-15 17:17 ` Luis Machado
@ 2021-12-15 19:27 ` Eli Zaretskii
2021-12-15 20:00 ` Luis Machado
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2021-12-15 19:27 UTC (permalink / raw)
To: Luis Machado; +Cc: tom, gdb-patches
> Cc: Eli Zaretskii <eliz@gnu.org>
> From: Luis Machado <luis.machado@linaro.org>
> Date: Wed, 15 Dec 2021 14:17:55 -0300
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 13b66286876..3f78ace82bb 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -3,6 +3,17 @@
>
> *** Changes since GDB 11
>
> +* Configure changes
> +
> +--enable-threading
> +
> + Enable or disable multithreaded symbol loading. This is enabled
> + by default, but passing --disable-threading or --enable-threading=no
> + to configure will disable it.
> +
> + Disabling this can cause a performance penalty when there are a lot of
> + symbols to load, but is useful for debugging purposes.
> +
> * New commands
Thanks, this is OK.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] New --enable-threading configure option to control use of threads in GDB/GDBserver
2021-12-15 19:27 ` Eli Zaretskii
@ 2021-12-15 20:00 ` Luis Machado
0 siblings, 0 replies; 5+ messages in thread
From: Luis Machado @ 2021-12-15 20:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: tom, gdb-patches
On 12/15/21 4:27 PM, Eli Zaretskii wrote:
>> Cc: Eli Zaretskii <eliz@gnu.org>
>> From: Luis Machado <luis.machado@linaro.org>
>> Date: Wed, 15 Dec 2021 14:17:55 -0300
>>
>> diff --git a/gdb/NEWS b/gdb/NEWS
>> index 13b66286876..3f78ace82bb 100644
>> --- a/gdb/NEWS
>> +++ b/gdb/NEWS
>> @@ -3,6 +3,17 @@
>>
>> *** Changes since GDB 11
>>
>> +* Configure changes
>> +
>> +--enable-threading
>> +
>> + Enable or disable multithreaded symbol loading. This is enabled
>> + by default, but passing --disable-threading or --enable-threading=no
>> + to configure will disable it.
>> +
>> + Disabling this can cause a performance penalty when there are a lot of
>> + symbols to load, but is useful for debugging purposes.
>> +
>> * New commands
>
> Thanks, this is OK.
>
Pushed now.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-15 20:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 19:06 [PATCH] New --enable-threading configure option to control use of threads in GDB/GDBserver Luis Machado
2021-12-07 18:51 ` Tom Tromey
2021-12-15 17:17 ` Luis Machado
2021-12-15 19:27 ` Eli Zaretskii
2021-12-15 20:00 ` Luis Machado
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).