gdb/doc: Add documentation for tfile description section lines.
[deliverable/binutils-gdb.git] / gdb / xtensa-linux-nat.c
index 77ad3e022155909642a1795ef06223debe712f21..54da83791ae793ef75f388764c77741316a86b23 100644 (file)
@@ -1,6 +1,6 @@
 /* Xtensa GNU/Linux native support.
 
-   Copyright (C) 2007-2015 Free Software Foundation, Inc.
+   Copyright (C) 2007-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -37,6 +37,9 @@
 #include "gregset.h"
 #include "xtensa-tdep.h"
 
+/* Defines ps_err_e, struct ps_prochandle.  */
+#include "gdb_proc_service.h"
+
 /* Extended register set depends on hardware configs.
    Keeping these definitions separately allows to introduce
    hardware-specific overlays.  */
@@ -93,7 +96,7 @@ fill_gregset (const struct regcache *regcache,
     }
 }
 
-void
+static void
 supply_gregset_reg (struct regcache *regcache,
                    const gdb_gregset_t *gregsetp, int regnum)
 {
@@ -250,7 +253,7 @@ store_xtregs (struct regcache *regcache, int regnum)
     perror_with_name (_("Couldn't write extended registers"));
 }
 
-void
+static void
 xtensa_linux_fetch_inferior_registers (struct target_ops *ops,
                                       struct regcache *regcache, int regnum)
 {
@@ -265,7 +268,7 @@ xtensa_linux_fetch_inferior_registers (struct target_ops *ops,
     fetch_xtregs (regcache, regnum);
 }
 
-void
+static void
 xtensa_linux_store_inferior_registers (struct target_ops *ops,
                                       struct regcache *regcache, int regnum)
 {
@@ -280,6 +283,25 @@ xtensa_linux_store_inferior_registers (struct target_ops *ops,
     store_xtregs (regcache, regnum);
 }
 
+/* Called by libthread_db.  */
+
+ps_err_e
+ps_get_thread_area (const struct ps_prochandle *ph,
+                    lwpid_t lwpid, int idx, void **base)
+{
+  xtensa_elf_gregset_t regs;
+
+  if (ptrace (PTRACE_GETREGS, lwpid, NULL, &regs) != 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 *) regs.threadptr - idx);
+
+  return PS_OK;
+}
+
 void _initialize_xtensa_linux_nat (void);
 
 void
This page took 0.031219 seconds and 4 git commands to generate.