aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2009-12-21 21:23:43 +0000
committerDoug Evans <dje@google.com>2009-12-21 21:23:43 +0000
commitc5f62d5ff9f52f2170a401631240af7bf7a850e3 (patch)
tree079fddc53cc70fd018f2e5e7716cf5a0f8375142 /gdb
parent10e86dd77848e00024b5de420c18e13db9a103c9 (diff)
downloadbinutils-c5f62d5ff9f52f2170a401631240af7bf7a850e3.zip
binutils-c5f62d5ff9f52f2170a401631240af7bf7a850e3.tar.gz
binutils-c5f62d5ff9f52f2170a401631240af7bf7a850e3.tar.bz2
gdb/
* linux-nat.c (kill_lwp): Minor cleanup, move definition of tkill_failed into ifdef HAVE_TKILL_SYSCALL. Move setting of errno there too. Delete unnecessary resetting of errno after syscall. Minor comment changes to match gdbserver/linux-low.c:kill_lwp. gdbserver/ * linux-low.c (kill_lwp): Use __NR_tkill instead of SYS_tkill. Move definition of tkill_failed to ifdef __NR_tkill to avoid gcc warning ifndef __NR_tkill. Move setting of errno there too. Delete unnecessary resetting of errno after syscall. Minor comment changes to match gdb/linux-nat.c:kill_lwp.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/linux-low.c30
-rw-r--r--gdb/linux-nat.c32
4 files changed, 47 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1c82ebc..0d9691a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-21 Doug Evans <dje@google.com>
+
+ * linux-nat.c (kill_lwp): Minor cleanup, move definition of
+ tkill_failed into ifdef HAVE_TKILL_SYSCALL. Move setting of errno
+ there too. Delete unnecessary resetting of errno after syscall.
+ Minor comment changes to match gdbserver/linux-low.c:kill_lwp.
+
2009-12-21 Alan Modra <amodra@gmail.com>
* MAINTAINERS: Update my email address.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 6cd1b79..2e388df 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,11 @@
2009-12-21 Doug Evans <dje@google.com>
+ * linux-low.c (kill_lwp): Use __NR_tkill instead of SYS_tkill.
+ Move definition of tkill_failed to ifdef __NR_tkill to avoid gcc
+ warning ifndef __NR_tkill. Move setting of errno there too.
+ Delete unnecessary resetting of errno after syscall.
+ Minor comment changes to match gdb/linux-nat.c:kill_lwp.
+
* configure.ac: Check for dladdr.
* config.in: Regenerate.
* configure: Regenerate.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 8b7d9e8..8e91d2b 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1572,25 +1572,29 @@ linux_wait (ptid_t ptid,
return event_ptid;
}
-/* Send a signal to an LWP. For LinuxThreads, kill is enough; however, if
- thread groups are in use, we need to use tkill. */
+/* Send a signal to an LWP. */
static int
kill_lwp (unsigned long lwpid, int signo)
{
- static int tkill_failed;
+ /* Use tkill, if possible, in case we are using nptl threads. If tkill
+ fails, then we are not using nptl threads and we should be using kill. */
- errno = 0;
+#ifdef __NR_tkill
+ {
+ static int tkill_failed;
-#ifdef SYS_tkill
- if (!tkill_failed)
- {
- int ret = syscall (SYS_tkill, lwpid, signo);
- if (errno != ENOSYS)
- return ret;
- errno = 0;
- tkill_failed = 1;
- }
+ if (!tkill_failed)
+ {
+ int ret;
+
+ errno = 0;
+ ret = syscall (__NR_tkill, lwpid, signo);
+ if (errno != ENOSYS)
+ return ret;
+ tkill_failed = 1;
+ }
+ }
#endif
return kill (lwpid, signo);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index c0afecd..c3bc516 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2034,27 +2034,29 @@ linux_nat_resume (struct target_ops *ops,
target_async (inferior_event_handler, 0);
}
-/* Issue kill to specified lwp. */
-
-static int tkill_failed;
+/* Send a signal to an LWP. */
static int
kill_lwp (int lwpid, int signo)
{
- errno = 0;
-
-/* Use tkill, if possible, in case we are using nptl threads. If tkill
- fails, then we are not using nptl threads and we should be using kill. */
+ /* Use tkill, if possible, in case we are using nptl threads. If tkill
+ fails, then we are not using nptl threads and we should be using kill. */
#ifdef HAVE_TKILL_SYSCALL
- if (!tkill_failed)
- {
- int ret = syscall (__NR_tkill, lwpid, signo);
- if (errno != ENOSYS)
- return ret;
- errno = 0;
- tkill_failed = 1;
- }
+ {
+ static int tkill_failed;
+
+ if (!tkill_failed)
+ {
+ int ret;
+
+ errno = 0;
+ ret = syscall (__NR_tkill, lwpid, signo);
+ if (errno != ENOSYS)
+ return ret;
+ tkill_failed = 1;
+ }
+ }
#endif
return kill (lwpid, signo);