• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisão4a7dabea39556979cbf6bcbdd98a9413ce129fd0 (tree)
Hora2019-11-11 02:44:50
AutorTom Tromey <tom@trom...>
CommiterTom Tromey

Mensagem de Log

Set names of worker threads

This adds some configury so that gdb can set the names of worker
threads. This makes them show up more nicely when debugging gdb
itself.

2019-10-19 Tom Tromey <tom@tromey.com>

* gdbsupport/thread-pool.c (thread_pool::set_thread_count): Set
name of worker thread.
* gdbsupport/common.m4 (GDB_AC_COMMON): Check for
pthread_setname_np.
* configure, config.in: Rebuild.

gdb/gdbserver/ChangeLog
2019-10-19 Tom Tromey <tom@tromey.com>

* configure, config.in: Rebuild.

Change-Id: I60473d65ae9ae14d8c56ddde39684240c16aaf35

Mudança Sumário

Diff

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
11 2019-10-19 Tom Tromey <tom@tromey.com>
22
3+ * gdbsupport/thread-pool.c (thread_pool::set_thread_count): Set
4+ name of worker thread.
5+ * gdbsupport/common.m4 (GDB_AC_COMMON): Check for
6+ pthread_setname_np.
7+ * configure, config.in: Rebuild.
8+
9+2019-10-19 Tom Tromey <tom@tromey.com>
10+
311 * python/python.c (class gdbpy_gil): New.
412 (struct gdbpy_event): Add constructor, destructor, operator().
513 (gdbpy_post_event): Use run_on_main_thread.
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -342,6 +342,9 @@
342342 /* Have PTHREAD_PRIO_INHERIT. */
343343 #undef HAVE_PTHREAD_PRIO_INHERIT
344344
345+/* Define to 1 if you have the `pthread_setname_np' function. */
346+#undef HAVE_PTHREAD_SETNAME_NP
347+
345348 /* Define to 1 if you have the `pthread_sigmask' function. */
346349 #undef HAVE_PTHREAD_SIGMASK
347350
--- a/gdb/configure
+++ b/gdb/configure
@@ -14337,12 +14337,13 @@ $as_echo "$gdb_cv_cxx_std_thread" >&6; }
1433714337
1433814338 # This check must be here, while LIBS includes any necessary
1433914339 # threading library.
14340- for ac_func in pthread_sigmask
14340+ for ac_func in pthread_sigmask pthread_setname_np
1434114341 do :
14342- ac_fn_cxx_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask"
14343-if test "x$ac_cv_func_pthread_sigmask" = xyes; then :
14342+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
14343+ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
14344+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
1434414345 cat >>confdefs.h <<_ACEOF
14345-#define HAVE_PTHREAD_SIGMASK 1
14346+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
1434614347 _ACEOF
1434714348
1434814349 fi
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,9 @@
11 2019-10-19 Tom Tromey <tom@tromey.com>
22
3+ * configure, config.in: Rebuild.
4+
5+2019-10-19 Tom Tromey <tom@tromey.com>
6+
37 * remote-utils.c (block_unblock_async_io): Use gdb_sigmask.
48 * linux-low.c (linux_wait_for_event_filtered, linux_async): Use
59 gdb_sigmask.
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -195,6 +195,9 @@
195195 /* Have PTHREAD_PRIO_INHERIT. */
196196 #undef HAVE_PTHREAD_PRIO_INHERIT
197197
198+/* Define to 1 if you have the `pthread_setname_np' function. */
199+#undef HAVE_PTHREAD_SETNAME_NP
200+
198201 /* Define to 1 if you have the `pthread_sigmask' function. */
199202 #undef HAVE_PTHREAD_SIGMASK
200203
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -7725,12 +7725,13 @@ $as_echo "$gdb_cv_cxx_std_thread" >&6; }
77257725
77267726 # This check must be here, while LIBS includes any necessary
77277727 # threading library.
7728- for ac_func in pthread_sigmask
7728+ for ac_func in pthread_sigmask pthread_setname_np
77297729 do :
7730- ac_fn_cxx_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask"
7731-if test "x$ac_cv_func_pthread_sigmask" = xyes; then :
7730+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
7731+ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
7732+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
77327733 cat >>confdefs.h <<_ACEOF
7733-#define HAVE_PTHREAD_SIGMASK 1
7734+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
77347735 _ACEOF
77357736
77367737 fi
--- a/gdb/gdbsupport/common.m4
+++ b/gdb/gdbsupport/common.m4
@@ -57,7 +57,7 @@ AC_DEFUN([GDB_AC_COMMON], [
5757
5858 # This check must be here, while LIBS includes any necessary
5959 # threading library.
60- AC_CHECK_FUNCS([pthread_sigmask])
60+ AC_CHECK_FUNCS([pthread_sigmask pthread_setname_np])
6161
6262 LIBS="$save_LIBS"
6363 CXXFLAGS="$save_CXXFLAGS"
--- a/gdb/gdbsupport/thread-pool.c
+++ b/gdb/gdbsupport/thread-pool.c
@@ -23,6 +23,15 @@
2323 #include "gdbsupport/block-signals.h"
2424 #include <algorithm>
2525
26+/* On the off chance that we have the pthread library on a Windows
27+ host, but std::thread is not using it, avoid calling
28+ pthread_setname_np on Windows. */
29+#ifndef _WIN32
30+#ifdef HAVE_PTHREAD_SETNAME_NP
31+#include <pthread.h>
32+#endif
33+#endif
34+
2635 namespace gdb
2736 {
2837
@@ -59,6 +68,11 @@ thread_pool::set_thread_count (size_t num_threads)
5968 for (size_t i = m_count; i < num_threads; ++i)
6069 {
6170 std::thread thread (&thread_pool::thread_function, this);
71+#ifndef _WIN32 /* See the comment at the top of the file. */
72+#ifdef HAVE_PTHREAD_SETNAME_NP
73+ pthread_setname_np (thread.native_handle (), "gdb worker");
74+#endif
75+#endif
6276 thread.detach ();
6377 }
6478 }