Re: GDB support
Corey Minyard <[email protected]>
| Newsgroups | gmane.linux.ngpt.devel |
|---|---|
| Message-ID | <[email protected]> |
Since the issue is up and I thought about it, you will need the attached patch to GDB (if you have not already figured it out). It's not a 100% clean patch (meaning it's not ready for acceptance into gdb), but it does work. It makes gdb use tkill to deliver the signals properly. With this patch, I can debug using my threads library that uses THREAD_CLONE. -Corey
gdb-5.2.patch
(text/plain, 1.3 KB)
--- orig/gdb-5.2/gdb/lin-lwp.c Sun Feb 24 15:53:02 2002
+++ gdb-5.2/gdb/lin-lwp.c Sat May 18 14:28:53 2002
@@ -629,6 +629,28 @@
/* Send a SIGSTOP to LP. */
+#ifndef __NR_tkill
+#if defined(__powerpc)
+#define __NR_tkill 208
+#elif defined(i386)
+#define __NR_tkill 238
+#endif
+#endif
+
+#ifdef __NR_tkill
+static inline int
+tkill(pid_t pid, int sig)
+{
+ int rv;
+ rv = syscall(__NR_tkill, pid, sig);
+ if (rv && (errno == ENOSYS))
+ rv = kill(pid, sig);
+ return rv;
+}
+#else
+#define tkill(pid, sig) kill((pid), (sig))
+#endif
+
static int
stop_callback (struct lwp_info *lp, void *data)
{
@@ -636,7 +658,7 @@
{
int ret;
- ret = kill (GET_LWP (lp->ptid), SIGSTOP);
+ ret = tkill (GET_LWP (lp->ptid), SIGSTOP);
gdb_assert (ret == 0);
lp->signalled = 1;
@@ -728,7 +750,7 @@
stop_wait_callback (lp, data);
/* If there's another event, throw it back into the queue. */
if (lp->status)
- kill (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
+ tkill (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
/* Save the sigtrap event. */
lp->status = status;
return 0;
@@ -756,7 +778,7 @@
if (lp->status == 0)
lp->status = status;
else
- kill (GET_LWP (lp->ptid), WSTOPSIG (status));
+ tkill (GET_LWP (lp->ptid), WSTOPSIG (status));
return 0;
}
}