aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-12-17 14:20:51 +0000
committerPedro Alves <palves@redhat.com>2015-12-17 14:20:51 +0000
commit4a6ed09b0f70c79b11bc1e0973a7333d9316a287 (patch)
treeae9cc273c4c4d5239b525a2c2941b4671d7fc712 /gdb/nat
parentc3c874459bf57a70ccbf71a39a3a7dc3c472a201 (diff)
downloadgdb-4a6ed09b0f70c79b11bc1e0973a7333d9316a287.zip
gdb-4a6ed09b0f70c79b11bc1e0973a7333d9316a287.tar.gz
gdb-4a6ed09b0f70c79b11bc1e0973a7333d9316a287.tar.bz2
Remove support for LinuxThreads and vendor 2.4 kernels w/ backported NPTL
Since we now rely on PTRACE_EVENT_CLONE being available (added in Linux 2.5.46), we're relying on NPTL. This commit removes the support for older LinuxThreads, as well as the workarounds for vendor 2.4 kernels with NPTL backported. - Rely on tkill being available. - Assume gdb doesn't get cancel signals. - Remove code that checks the LinuxThreads restart and cancel signals in the inferior. - Assume that __WALL is available. - Assume that non-leader threads report WIFEXITED. - Thus, no longer need to send signal 0 to check whether threads are still alive. - Update comments throughout. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ChangeLog: * configure.ac: Remove tkill checks. * configure, config.in: Regenerate. * linux-nat.c: Remove HAVE_TKILL_SYSCALL check. Update top level comments. (linux_nat_post_attach_wait): Remove 'cloned' parameter. Use __WALL. (attach_proc_task_lwp_callback): Don't set the cloned flag. (linux_nat_attach): Adjust. (kill_lwp): Remove HAVE_TKILL_SYSCALL check. No longer fall back to 'kill'. (linux_handle_extended_wait): Use __WALL. Don't set the cloned flag. (wait_lwp): Use __WALL. Update comments. (running_callback, stop_and_resume_callback): Delete. (linux_nat_filter_event): Don't stop and resume all lwps. Don't check if the event LWP has previously exited. (check_zombie_leaders): Update comments. (linux_nat_wait_1): Use __WALL. (kill_wait_callback): Don't handle clone processes separately. Use __WALL instead. (linux_thread_alive): Delete. (linux_nat_thread_alive): Return true as long as the LWP is in the LWP list. (linux_nat_update_thread_list): Assume the kernel supports PTRACE_EVENT_CLONE. (get_signo): Delete. (lin_thread_get_thread_signals): Remove LinuxThreads references. No longer check __pthread_sig_restart / __pthread_sig_cancel in the inferior. * linux-nat.h (struct lwp_info) <cloned>: Delete field. * linux-thread-db.c: Update comments. (_initialize_thread_db): Remove LinuxThreads references. * nat/linux-waitpid.c (my_waitpid): No longer emulate __WALL. Pass down flags unmodified. * linux-waitpid.h (my_waitpid): Update documentation. gdb/gdbserver/ChangeLog: * linux-low.c (linux_kill_one_lwp): Remove references to LinuxThreads. (kill_lwp): Remove HAVE_TKILL_SYSCALL check. No longer fall back to 'kill'. (linux_init_signals): Delete. (initialize_low): Adjust. * thread-db.c (thread_db_init): Remove LinuxThreads reference.
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/linux-waitpid.c63
-rw-r--r--gdb/nat/linux-waitpid.h3
2 files changed, 6 insertions, 60 deletions
diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index cbcdd95..2d80e0a 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -74,8 +74,7 @@ status_to_str (int status)
return buf;
}
-/* Wrapper function for waitpid which handles EINTR, and emulates
- __WALL for systems where that is not available. */
+/* See linux-waitpid.h. */
int
my_waitpid (int pid, int *status, int flags)
@@ -84,64 +83,12 @@ my_waitpid (int pid, int *status, int flags)
linux_debug ("my_waitpid (%d, 0x%x)\n", pid, flags);
- if (flags & __WALL)
+ do
{
- sigset_t block_mask, org_mask, wake_mask;
- int wnohang;
-
- wnohang = (flags & WNOHANG) != 0;
- flags &= ~(__WALL | __WCLONE);
-
- if (!wnohang)
- {
- flags |= WNOHANG;
-
- /* Block all signals while here. This avoids knowing about
- LinuxThread's signals. */
- sigfillset (&block_mask);
- sigprocmask (SIG_BLOCK, &block_mask, &org_mask);
-
- /* ... except during the sigsuspend below. */
- sigemptyset (&wake_mask);
- }
-
- while (1)
- {
- /* Since all signals are blocked, there's no need to check
- for EINTR here. */
- ret = waitpid (pid, status, flags);
- out_errno = errno;
-
- if (ret == -1 && out_errno != ECHILD)
- break;
- else if (ret > 0)
- break;
-
- if (flags & __WCLONE)
- {
- /* We've tried both flavors now. If WNOHANG is set,
- there's nothing else to do, just bail out. */
- if (wnohang)
- break;
-
- linux_debug ("blocking\n");
-
- /* Block waiting for signals. */
- sigsuspend (&wake_mask);
- }
- flags ^= __WCLONE;
- }
-
- if (!wnohang)
- sigprocmask (SIG_SETMASK, &org_mask, NULL);
- }
- else
- {
- do
- ret = waitpid (pid, status, flags);
- while (ret == -1 && errno == EINTR);
- out_errno = errno;
+ ret = waitpid (pid, status, flags);
}
+ while (ret == -1 && errno == EINTR);
+ out_errno = errno;
linux_debug ("my_waitpid (%d, 0x%x): status(%x), %d\n",
pid, flags, (ret > 0 && status != NULL) ? *status : -1, ret);
diff --git a/gdb/nat/linux-waitpid.h b/gdb/nat/linux-waitpid.h
index bc5e8d2..1a15fdc 100644
--- a/gdb/nat/linux-waitpid.h
+++ b/gdb/nat/linux-waitpid.h
@@ -20,8 +20,7 @@
#ifndef LINUX_WAITPID_H
#define LINUX_WAITPID_H
-/* Wrapper function for waitpid which handles EINTR, and emulates
- __WALL for systems where that is not available. */
+/* Wrapper function for waitpid which handles EINTR. */
extern int my_waitpid (int pid, int *status, int flags);
/* Convert wait status STATUS to a string. Used for printing debug