diff options
Diffstat (limited to 'gdb/gdbserver/linux-arm-low.c')
-rw-r--r-- | gdb/gdbserver/linux-arm-low.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 7c23b17789a..2cbccd9af52 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -22,6 +22,12 @@ #include "server.h" #include "linux-low.h" +#include "../gdb_proc_service.h" + +#ifndef PTRACE_GET_THREAD_AREA +#define PTRACE_GET_THREAD_AREA 22 +#endif + #ifdef HAVE_SYS_REG_H #include <sys/reg.h> #endif @@ -94,6 +100,23 @@ arm_reinsert_addr () collect_register_by_name ("lr", &pc); return pc; } + +/* 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 = (void *) ((char *)*base - idx); + + return PS_OK; +} struct linux_target_ops the_low_target = { arm_num_regs, |