Add support for threaded debugging for CRISv32.
authorRicard Wanderlof <ricard@sourceware.org>
Fri, 6 Sep 2013 08:37:17 +0000 (08:37 +0000)
committerRicard Wanderlof <ricard@sourceware.org>
Fri, 6 Sep 2013 08:37:17 +0000 (08:37 +0000)
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.

gdb/ChangeLog
gdb/cris-tdep.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-crisv32-low.c

index 36d441a6abf13478987870a9b1c3b22d018e1a29..8a30eb2990d15da5edd049a9835e49c9631ee415 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-06  Ricard Wanderlof  <ricardw@axis.com>
+
+       * cris-tdep.c (cris_gdbarch_init): Add call to
+       get_gdbarch_fetch_tls_load_module_address.
+
 2013-09-06  Ricard Wanderlof  <ricardw@axis.com>
 
        * cris-tdep.c (cris_elf_greg_t): Rename from elf_greg_t.
index 1b0e3cdec07b2ec176a0ac7c12320b49bb557f75..ef2746d7d1fa5e01ba848f545b8c0182ea6ee0fe 100644 (file)
@@ -4137,6 +4137,11 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_single_step_through_delay 
        (gdbarch, crisv32_single_step_through_delay);
 
+      /* FIXME: Ricard W/2013-09-03: Linux-specific stuff like this
+         should really go in (a new) cris-linux-tdep.c. */
+      set_gdbarch_fetch_tls_load_module_address (gdbarch,
+                                                 svr4_fetch_objfile_link_map);
+
       break;
 
     default:
index f362c342e3c3f04b725a018ea4fc4e4d708baa4c..440c5bb36d392f3d7491407c62e7dac0f95c13ef 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-06  Ricard Wanderlof  <ricardw@axis.com>
+
+       * linux-crisv32-low.c (PTRACE_GET_THREAD_AREA): New macro.
+       (ps_get_thread_area): New function.
+
 2013-09-06  Ricard Wanderlof  <ricardw@axis.com>
 
        * linux-crisv32-low.c (elf_gregset_t): Delete typedef.
index 2849d0252a7d4cb3a19f78b6c9d0a906dfa43f5d..393c3e69bd89f4f8dd03876ae728aac558344b28 100644 (file)
@@ -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)
 {