* m68k-linux: fix thread debugging
@ 2012-03-08 13:38 Andreas Schwab
2012-03-09 19:32 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2012-03-08 13:38 UTC (permalink / raw)
To: gdb-patches
2012-03-08 Andreas Schwab <schwab@linux-m68k.org>
* m68klinux-nat.c: Include "gdb_proc_service.h".
(PTRACE_GET_THREAD_AREA): Define.
(ps_get_thread_area): New function.
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
index c7137c0..d4410e6 100644
--- a/gdb/m68klinux-nat.c
+++ b/gdb/m68klinux-nat.c
@@ -51,6 +51,13 @@
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
+
+/* Defines ps_err_e, struct ps_prochandle. */
+#include "gdb_proc_service.h"
+
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
\f
/* This table must line up with gdbarch_register_name in "m68k-tdep.c". */
static const int regmap[] =
@@ -556,6 +563,24 @@ fetch_core_registers (struct regcache *regcache,
}
\f
+/* Fetch the thread-local storage pointer for libthread_db. */
+
+ps_err_e
+ps_get_thread_area (const struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+{
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) < 0)
+ return PS_ERR;
+
+ /* IDX is the bias from the thread pointer to the beginning of the
+ thread descriptor. It has to be subtracted due to implementation
+ quirks in libthread_db. */
+ *base = (char *) *base - idx;
+
+ return PS_OK;
+}
+\f
+
/* Register that we are able to handle GNU/Linux ELF core file
formats. */
--
1.7.9.3
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: m68k-linux: fix thread debugging
2012-03-08 13:38 m68k-linux: fix thread debugging Andreas Schwab
@ 2012-03-09 19:32 ` Joel Brobecker
2012-03-09 19:46 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2012-03-09 19:32 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gdb-patches
> 2012-03-08 Andreas Schwab <schwab@linux-m68k.org>
>
> * m68klinux-nat.c: Include "gdb_proc_service.h".
> (PTRACE_GET_THREAD_AREA): Define.
> (ps_get_thread_area): New function.
Looks good to me (it looks like the exact same as arm-linux)...
Does GDB build without this patch?
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: m68k-linux: fix thread debugging
2012-03-09 19:32 ` Joel Brobecker
@ 2012-03-09 19:46 ` Andreas Schwab
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2012-03-09 19:46 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Joel Brobecker <brobecker@adacore.com> writes:
> Does GDB build without this patch?
ps_get_thread_area is called by libthread_db.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-09 19:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-08 13:38 m68k-linux: fix thread debugging Andreas Schwab
2012-03-09 19:32 ` Joel Brobecker
2012-03-09 19:46 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox