diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2012-03-08 13:35:41 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@linux-m68k.org> | 2012-03-08 13:35:41 +0000 |
commit | 7b8b6d6d0d48c23ec36080b7d190c830a73c499e (patch) | |
tree | 54d34a62d7a19e817cd253131a24a8c6bb7cd9ec | |
parent | bba74b36f00976564d8bf209834b3c528d361ade (diff) | |
download | gdb-7b8b6d6d0d48c23ec36080b7d190c830a73c499e.zip gdb-7b8b6d6d0d48c23ec36080b7d190c830a73c499e.tar.gz gdb-7b8b6d6d0d48c23ec36080b7d190c830a73c499e.tar.bz2 |
* m68klinux-nat.c: Include "gdb_proc_service.h".
(PTRACE_GET_THREAD_AREA): Define.
(ps_get_thread_area): New function.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/m68klinux-nat.c | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a824d2d..0680f00 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +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. + 2012-03-08 Yao Qi <yao@codesourcery.com> * remote.c (remote_get_noisy_reply): Replace `sprintf' with 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 /* 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, } +/* 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; +} + + /* Register that we are able to handle GNU/Linux ELF core file formats. */ |