aboutsummaryrefslogtreecommitdiff
path: root/gdb/x86-64-linux-nat.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2003-07-17 12:49:52 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2003-07-17 12:49:52 +0000
commitc43af07cc890456dbf2562a836961f59f216d880 (patch)
tree808eb30c76614daefe0f6bf4d45c23d6b3342a1e /gdb/x86-64-linux-nat.c
parent5c7556e8712e1d67d4b68aff95df9a7876e5c932 (diff)
downloadfsf-binutils-gdb-c43af07cc890456dbf2562a836961f59f216d880.zip
fsf-binutils-gdb-c43af07cc890456dbf2562a836961f59f216d880.tar.gz
fsf-binutils-gdb-c43af07cc890456dbf2562a836961f59f216d880.tar.bz2
2003-07-17 Elena Zannoni <ezannoni@redhat.com>
* Makefile.in (x86-64-linux-nat.o): Update dependencies. * x86-64-linux-nat.c (ps_get_thread_area): New function. Add include of asm/prctl.h, asm/ptrace.h, and gdb_proc_service.h.
Diffstat (limited to 'gdb/x86-64-linux-nat.c')
-rw-r--r--gdb/x86-64-linux-nat.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c
index c44c35e..87b69c9 100644
--- a/gdb/x86-64-linux-nat.c
+++ b/gdb/x86-64-linux-nat.c
@@ -32,7 +32,17 @@
#include <sys/debugreg.h>
#include <sys/syscall.h>
#include <sys/procfs.h>
+#include <asm/prctl.h>
+/* FIXME ezannoni-2003-07-09: we need <sys/reg.h> to be included after
+ <asm/ptrace.h> because the latter redefines FS and GS for no apparent
+ reason, and those definitions don't match the ones that libpthread_db
+ uses, which come from <sys/reg.h>. */
+/* ezannoni-2003-07-09: I think this is fixed. The extraneous defs have
+ been removed from ptrace.h in the kernel. However, better safe than
+ sorry. */
+#include <asm/ptrace.h>
#include <sys/reg.h>
+#include "gdb_proc_service.h"
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
@@ -306,3 +316,34 @@ x86_64_linux_dr_get_status (void)
{
return x86_64_linux_dr_get (DR_STATUS);
}
+
+extern ps_err_e
+ps_get_thread_area (const struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+{
+
+/* This definition comes from prctl.h, but some kernels may not have it. */
+#ifndef PTRACE_ARCH_PRCTL
+#define PTRACE_ARCH_PRCTL 30
+#endif
+
+ /* FIXME: ezannoni-2003-07-09 see comment above about include file order.
+ We could be getting bogus values for these two. */
+ gdb_assert (FS < ELF_NGREG);
+ gdb_assert (GS < ELF_NGREG);
+ switch (idx)
+ {
+ case FS:
+ if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
+ return PS_OK;
+ break;
+ case GS:
+ if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
+ return PS_OK;
+ break;
+ default: /* Should not happen. */
+ return PS_BADADDR;
+ }
+ return PS_ERR; /* ptrace failed. */
+}
+