diff options
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/config.in | 3 | ||||
-rwxr-xr-x | gdb/gdbserver/configure | 128 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 17 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 3 |
5 files changed, 149 insertions, 9 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index eee4b81..00b0a0d 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,12 @@ 2019-11-26 Tom Tromey <tom@tromey.com> + * remote-utils.c (block_unblock_async_io): Use gdb_sigmask. + * linux-low.c (linux_wait_for_event_filtered, linux_async): Use + gdb_sigmask. + * configure, config.in: Rebuild. + +2019-11-26 Tom Tromey <tom@tromey.com> + * Makefile.in (PTHREAD_CFLAGS, PTHREAD_LIBS): New variables. (INTERNAL_CFLAGS_BASE): Use PTHREAD_CFLAGS. (GDBSERVER_LIBS): Use PTHREAD_LIBS. diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index 4276bce..3027ffa 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -195,6 +195,9 @@ /* Have PTHREAD_PRIO_INHERIT. */ #undef HAVE_PTHREAD_PRIO_INHERIT +/* Define to 1 if you have the `pthread_sigmask' function. */ +#undef HAVE_PTHREAD_SIGMASK + /* Define if the target supports PTRACE_GETFPXREGS for extended register access. */ #undef HAVE_PTRACE_GETFPXREGS diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 882c192..8d34a6c 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -1972,6 +1972,119 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_decl +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_cxx_check_func LINENO FUNC VAR +# ------------------------------------ +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_cxx_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_func + # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes @@ -7609,6 +7722,21 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_cxx_std_thread" >&5 $as_echo "$gdb_cv_cxx_std_thread" >&6; } + + # This check must be here, while LIBS includes any necessary + # threading library. + for ac_func in pthread_sigmask +do : + ac_fn_cxx_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask" +if test "x$ac_cv_func_pthread_sigmask" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_SIGMASK 1 +_ACEOF + +fi +done + + LIBS="$save_LIBS" CXXFLAGS="$save_CXXFLAGS" fi diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index f34811c..688a395 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -50,6 +50,7 @@ #include "gdbsupport/common-inferior.h" #include "nat/fork-inferior.h" #include "gdbsupport/environ.h" +#include "gdbsupport/gdb-sigmask.h" #include "gdbsupport/scoped_restore.h" #ifndef ELFMAG0 /* Don't include <linux/elf.h> here. If it got included by gdb_proc_service.h @@ -2689,7 +2690,7 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, /* Make sure SIGCHLD is blocked until the sigsuspend below. Block all signals while here. */ sigfillset (&block_mask); - sigprocmask (SIG_BLOCK, &block_mask, &prev_mask); + gdb_sigmask (SIG_BLOCK, &block_mask, &prev_mask); /* Always pull all events out of the kernel. We'll randomly select an event LWP out of all that have events, to prevent @@ -2775,7 +2776,7 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, { if (debug_threads) debug_printf ("LLW: exit (no unwaited-for LWP)\n"); - sigprocmask (SIG_SETMASK, &prev_mask, NULL); + gdb_sigmask (SIG_SETMASK, &prev_mask, NULL); return -1; } @@ -2785,7 +2786,7 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, if (debug_threads) debug_printf ("WNOHANG set, no event found\n"); - sigprocmask (SIG_SETMASK, &prev_mask, NULL); + gdb_sigmask (SIG_SETMASK, &prev_mask, NULL); return 0; } @@ -2794,11 +2795,11 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, debug_printf ("sigsuspend'ing\n"); sigsuspend (&prev_mask); - sigprocmask (SIG_SETMASK, &prev_mask, NULL); + gdb_sigmask (SIG_SETMASK, &prev_mask, NULL); goto retry; } - sigprocmask (SIG_SETMASK, &prev_mask, NULL); + gdb_sigmask (SIG_SETMASK, &prev_mask, NULL); current_thread = event_thread; @@ -6215,7 +6216,7 @@ linux_async (int enable) sigemptyset (&mask); sigaddset (&mask, SIGCHLD); - sigprocmask (SIG_BLOCK, &mask, NULL); + gdb_sigmask (SIG_BLOCK, &mask, NULL); if (enable) { @@ -6223,7 +6224,7 @@ linux_async (int enable) { linux_event_pipe[0] = -1; linux_event_pipe[1] = -1; - sigprocmask (SIG_UNBLOCK, &mask, NULL); + gdb_sigmask (SIG_UNBLOCK, &mask, NULL); warning ("creating event pipe failed."); return previous; @@ -6249,7 +6250,7 @@ linux_async (int enable) linux_event_pipe[1] = -1; } - sigprocmask (SIG_UNBLOCK, &mask, NULL); + gdb_sigmask (SIG_UNBLOCK, &mask, NULL); } return previous; diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index d7da4b7..c7f97f3 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -28,6 +28,7 @@ #include "gdbsupport/rsp-low.h" #include "gdbsupport/netstuff.h" #include "gdbsupport/filestuff.h" +#include "gdbsupport/gdb-sigmask.h" #include <ctype.h> #if HAVE_SYS_IOCTL_H #include <sys/ioctl.h> @@ -807,7 +808,7 @@ block_unblock_async_io (int block) sigemptyset (&sigio_set); sigaddset (&sigio_set, SIGIO); - sigprocmask (block ? SIG_BLOCK : SIG_UNBLOCK, &sigio_set, NULL); + gdb_sigmask (block ? SIG_BLOCK : SIG_UNBLOCK, &sigio_set, NULL); #endif } |