about summary refs log tree commit diff
path: root/nptl/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r--nptl/sysdeps/alpha/td_ta_map_lwp2thr.c46
-rw-r--r--nptl/sysdeps/alpha/tls.h4
-rw-r--r--nptl/sysdeps/generic/td_ta_map_lwp2thr.c45
-rw-r--r--nptl/sysdeps/i386/td_ta_map_lwp2thr.c48
-rw-r--r--nptl/sysdeps/i386/tls.h5
-rw-r--r--nptl/sysdeps/ia64/td_ta_map_lwp2thr.c44
-rw-r--r--nptl/sysdeps/ia64/tls.h3
-rw-r--r--nptl/sysdeps/powerpc/td_ta_map_lwp2thr.c44
-rw-r--r--nptl/sysdeps/powerpc/tls.h7
-rw-r--r--nptl/sysdeps/s390/td_ta_map_lwp2thr.c45
-rw-r--r--nptl/sysdeps/s390/tls.h3
-rw-r--r--nptl/sysdeps/sh/td_ta_map_lwp2thr.c44
-rw-r--r--nptl/sysdeps/sh/tls.h3
-rw-r--r--nptl/sysdeps/sparc/td_ta_map_lwp2thr.c44
-rw-r--r--nptl/sysdeps/sparc/tls.h5
-rw-r--r--nptl/sysdeps/x86_64/td_ta_map_lwp2thr.c43
-rw-r--r--nptl/sysdeps/x86_64/tls.h3
17 files changed, 33 insertions, 403 deletions
diff --git a/nptl/sysdeps/alpha/td_ta_map_lwp2thr.c b/nptl/sysdeps/alpha/td_ta_map_lwp2thr.c
deleted file mode 100644
index b30b10b123..0000000000
--- a/nptl/sysdeps/alpha/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Which thread is running on an LWP?  PowerPC version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  prgregset_t regs;
-  if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
-    return TD_ERR;
-
-  /* The uniq value is stored in slot 33 in recent gdb; it isn't stored
-     anywhere otherwise.  */
-  th->th_unique = ((void *) regs[32]
-		   - TLS_TCB_OFFSET - TLS_TCB_SIZE - TLS_PRE_TCB_SIZE);
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/alpha/tls.h b/nptl/sysdeps/alpha/tls.h
index 1718b3e466..8f61bb7409 100644
--- a/nptl/sysdeps/alpha/tls.h
+++ b/nptl/sysdeps/alpha/tls.h
@@ -118,6 +118,10 @@ typedef struct
     ((struct pthread *) (__builtin_thread_pointer () \
 			 - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+# define DB_THREAD_SELF \
+  REGISTER (64, 32 * 8, - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
+
 /* Identifier for the current thread.  THREAD_SELF is usable but
    sometimes more expensive than necessary as in this case.  */
 # define THREAD_ID (__builtin_thread_pointer ())
diff --git a/nptl/sysdeps/generic/td_ta_map_lwp2thr.c b/nptl/sysdeps/generic/td_ta_map_lwp2thr.c
deleted file mode 100644
index 126673e9af..0000000000
--- a/nptl/sysdeps/generic/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Which thread is running on an LWP?  Stub version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-#include <sys/reg.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  prgregset_t regs;
-  if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
-    return TD_ERR;
-
-# error port this file
-  // th->th_unique = thread register;
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/i386/td_ta_map_lwp2thr.c b/nptl/sysdeps/i386/td_ta_map_lwp2thr.c
deleted file mode 100644
index 94f6d34987..0000000000
--- a/nptl/sysdeps/i386/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Which thread is running on an LWP?  i386 version.
-   Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-#include <sys/reg.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  prgregset_t regs;
-  if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
-    return TD_ERR;
-
-  /* Get the thread area for the addressed thread.  */
-  if (ps_get_thread_area (ta->ph, lwpid, regs[GS] >> 3, &th->th_unique)
-      != PS_OK)
-    return TD_ERR;	/* XXX Other error value?  */
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index 85d6473380..873467ca77 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -251,6 +251,11 @@ union user_desc_init
 	  : "i" (offsetof (struct pthread, header.self)));		      \
      __self;})
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+# define DB_THREAD_SELF \
+  REGISTER_THREAD_AREA (32, offsetof (struct user_regs_struct, xgs), 3) \
+  REGISTER_THREAD_AREA (64, 26 * 8, 3) /* x86-64's user_regs_struct->gs */
+
 
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) \
diff --git a/nptl/sysdeps/ia64/td_ta_map_lwp2thr.c b/nptl/sysdeps/ia64/td_ta_map_lwp2thr.c
deleted file mode 100644
index b9f32eb8a1..0000000000
--- a/nptl/sysdeps/ia64/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Which thread is running on an LWP?  IA-64 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  prgregset_t regs;
-  if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
-    return TD_ERR;
-
-  /* IA-64 thread register is r13.  */
-  th->th_unique = (void *) (((struct pthread *) regs[13]) - 1);
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/ia64/tls.h b/nptl/sysdeps/ia64/tls.h
index 8a13a59d30..b6b20c0f50 100644
--- a/nptl/sysdeps/ia64/tls.h
+++ b/nptl/sysdeps/ia64/tls.h
@@ -113,6 +113,9 @@ register struct pthread *__thread_self __asm__("r13");
 /* Return the thread descriptor for the current thread.  */
 # define THREAD_SELF (__thread_self - 1)
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+# define DB_THREAD_SELF REGISTER (64, 13 * 8, -sizeof (struct pthread))
+
 /* Access to data in the thread descriptor is easy.  */
 #define THREAD_GETMEM(descr, member) \
   descr->member
diff --git a/nptl/sysdeps/powerpc/td_ta_map_lwp2thr.c b/nptl/sysdeps/powerpc/td_ta_map_lwp2thr.c
deleted file mode 100644
index d1a93681a3..0000000000
--- a/nptl/sysdeps/powerpc/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Which thread is running on an LWP?  PowerPC version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  prgregset_t regs;
-  if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
-    return TD_ERR;
-
-  th->th_unique = ((void *) regs[PT_THREAD_POINTER]
-		   - TLS_TCB_OFFSET - TLS_TCB_SIZE - TLS_PRE_TCB_SIZE);
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/powerpc/tls.h b/nptl/sysdeps/powerpc/tls.h
index 6573bb6b04..02595637c7 100644
--- a/nptl/sysdeps/powerpc/tls.h
+++ b/nptl/sysdeps/powerpc/tls.h
@@ -129,6 +129,13 @@ register void *__thread_register __asm__ ("r13");
     ((struct pthread *) (__thread_register \
 			 - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+# define DB_THREAD_SELF							      \
+  REGISTER (32, PT_THREAD_POINTER * 4,					      \
+	    - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)			      \
+  REGISTER (64, PT_THREAD_POINTER * 8,					      \
+	    - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
+
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) ((void)(descr), (THREAD_SELF)->member)
 
diff --git a/nptl/sysdeps/s390/td_ta_map_lwp2thr.c b/nptl/sysdeps/s390/td_ta_map_lwp2thr.c
deleted file mode 100644
index 5b0bf840d8..0000000000
--- a/nptl/sysdeps/s390/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Which thread is running on an LWP?  i386 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  prgregset_t regs;
-  if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
-    return TD_ERR;
-
-  /* S390 thread register is ACR0, aka register 18.  */
-  th->th_unique = (void *) regs[18];
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/s390/tls.h b/nptl/sysdeps/s390/tls.h
index 06237ae15b..7b38e3389d 100644
--- a/nptl/sysdeps/s390/tls.h
+++ b/nptl/sysdeps/s390/tls.h
@@ -137,6 +137,9 @@ typedef struct
 /* Return the thread descriptor for the current thread.  */
 # define THREAD_SELF ((struct pthread *) __builtin_thread_pointer ())
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+# define DB_THREAD_SELF REGISTER (32, 18 * 4, 0) REGISTER (64, 18 * 8, 0)
+
 /* Access to data in the thread descriptor is easy.  */
 #define THREAD_GETMEM(descr, member) \
   descr->member
diff --git a/nptl/sysdeps/sh/td_ta_map_lwp2thr.c b/nptl/sysdeps/sh/td_ta_map_lwp2thr.c
deleted file mode 100644
index 75853009da..0000000000
--- a/nptl/sysdeps/sh/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Which thread is running on an LWP?  Stub version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-#include <sys/reg.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  prgregset_t regs;
-  if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
-    return TD_ERR;
-
-  th->th_unique = regs[REG_GBR];
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/sh/tls.h b/nptl/sysdeps/sh/tls.h
index 1e27b987e0..b6d8428bf6 100644
--- a/nptl/sysdeps/sh/tls.h
+++ b/nptl/sysdeps/sh/tls.h
@@ -117,6 +117,9 @@ typedef struct
      __asm ("stc gbr,%0" : "=r" (__self));				      \
      __self - 1;})
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+# define DB_THREAD_SELF REGISTER (32, REG_GBR * 4, 0)
+
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) (descr->member)
 
diff --git a/nptl/sysdeps/sparc/td_ta_map_lwp2thr.c b/nptl/sysdeps/sparc/td_ta_map_lwp2thr.c
deleted file mode 100644
index f120b96e73..0000000000
--- a/nptl/sysdeps/sparc/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Which thread is running on an LWP?  SPARC version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  prgregset_t regs;
-  if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
-    return TD_ERR;
-
-  /* SPARC thread register is %g7.  */
-  th->th_unique = (void *) regs[7];
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/sparc/tls.h b/nptl/sysdeps/sparc/tls.h
index 87255941c1..8c4264f24f 100644
--- a/nptl/sysdeps/sparc/tls.h
+++ b/nptl/sysdeps/sparc/tls.h
@@ -104,6 +104,11 @@ register struct pthread *__thread_self __asm__("%g7");
 /* Return the thread descriptor for the current thread.  */
 #define THREAD_SELF  __thread_self
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+# define DB_THREAD_SELF_INCLUDE <sys/ucontext.h>
+# define DB_THREAD_SELF \
+  REGISTER (32, REG_G7 * 4, 0) REGISTER (64, REG_G7 * 8, 0)
+
 /* Access to data in the thread descriptor is easy.  */
 #define THREAD_GETMEM(descr, member) \
   descr->member
diff --git a/nptl/sysdeps/x86_64/td_ta_map_lwp2thr.c b/nptl/sysdeps/x86_64/td_ta_map_lwp2thr.c
deleted file mode 100644
index d49d00c277..0000000000
--- a/nptl/sysdeps/x86_64/td_ta_map_lwp2thr.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Which thread is running on an LWP?  x86-64 version.
-   Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "thread_dbP.h"
-#include <tls.h>
-#include <sys/reg.h>
-
-
-td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th)
-{
-  LOG ("td_ta_map_lwp2thr");
-
-  /* Test whether the TA parameter is ok.  */
-  if (! ta_ok (ta))
-    return TD_BADTA;
-
-  /* Get the %fs segment register base address for the addressed thread.  */
-  if (ps_get_thread_area (ta->ph, lwpid, FS, &th->th_unique) != PS_OK)
-    return TD_ERR;	/* XXX Other error value?  */
-
-  /* Found it.  Now complete the `td_thrhandle_t' object.  */
-  th->th_ta_p = (td_thragent_t *) ta;
-
-  return TD_OK;
-}
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index 999c3aa55a..3d6111f4e3 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -161,6 +161,9 @@ typedef struct
 	  : "i" (offsetof (struct pthread, header.self)));	 	      \
      __self;})
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
+# define DB_THREAD_SELF_INCLUDE  <sys/reg.h> /* For the FS constant.  */
+# define DB_THREAD_SELF CONST_THREAD_AREA (64, FS)
 
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) \