aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/linux-crisv32-low.c
diff options
context:
space:
mode:
authorRicard Wanderlof <ricard@sourceware.org>2013-09-06 08:37:17 +0000
committerRicard Wanderlof <ricard@sourceware.org>2013-09-06 08:37:17 +0000
commit8eb3d7b6ca8ba08fba66a25ffe1e26a571187c55 (patch)
tree295294c81083c765d0eec4a2733d41d59dcd1ef3 /gdb/gdbserver/linux-crisv32-low.c
parent1581d8a7b47a9c0d600d575bb91aa3e135669906 (diff)
downloadgdb-8eb3d7b6ca8ba08fba66a25ffe1e26a571187c55.zip
gdb-8eb3d7b6ca8ba08fba66a25ffe1e26a571187c55.tar.gz
gdb-8eb3d7b6ca8ba08fba66a25ffe1e26a571187c55.tar.bz2
Add support for threaded debugging for CRISv32.
2013-09-06 Ricard Wanderlof <ricardw@axis.com> * cris-tdep.c (cris_gdbarch_init): Add call to get_gdbarch_fetch_tls_load_module_address. gdbserver * linux-crisv32-low.c (PTRACE_GET_THREAD_AREA): New macro. (ps_get_thread_area): New function.
Diffstat (limited to 'gdb/gdbserver/linux-crisv32-low.c')
-rw-r--r--gdb/gdbserver/linux-crisv32-low.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index 2849d02..393c3e6 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -27,6 +27,10 @@ extern const struct target_desc *tdesc_crisv32;
/* CRISv32 */
#define cris_num_regs 49
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
+
/* Note: Ignoring USP (having the stack pointer in two locations causes trouble
without any significant gain). */
@@ -339,6 +343,20 @@ cris_stopped_data_address (void)
return eda;
}
+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;
+}
+
static void
cris_fill_gregset (struct regcache *regcache, void *buf)
{