]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2003-07-17 Elena Zannoni <ezannoni@redhat.com>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Thu, 17 Jul 2003 12:49:52 +0000 (12:49 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Thu, 17 Jul 2003 12:49:52 +0000 (12:49 +0000)
* 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.

gdb/ChangeLog
gdb/Makefile.in
gdb/x86-64-linux-nat.c

index 35dab2eb86891f271f3707eb357ff16ec6420c0b..aa7076881716c3515779f1aed09cb8a71fad1b8e 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2003-07-16  Theodore A. Roth  <troth@openavr.org>
 
        * avr-tdep.c (avr_skip_prologue): Return PC unchanged if no prologue
index 7cf0c07fcc1692b3d911d1d0437c471fdb59251d..95e4439d2b4b1d31218564dc0386634897705430 100644 (file)
@@ -2374,7 +2374,7 @@ wince.o: wince.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcore_h) \
 wrapper.o: wrapper.c $(defs_h) $(value_h) $(wrapper_h)
 x86-64-linux-nat.o: x86-64-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
        $(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(gregset_h) \
-       $(x86_64_tdep_h)
+       $(x86_64_tdep_h) $(gdb_proc_service_h)
 x86-64-linux-tdep.o: x86-64-linux-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
        $(regcache_h) $(osabi_h) $(gdb_string_h) $(x86_64_tdep_h) 
 x86-64-tdep.o: x86-64-tdep.c $(defs_h) \
index c44c35e86472c86ba57eb00f3c01cda9f4433306..87b69c9d853b8c77a02509352b5ca007c96c7764 100644 (file)
 #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.  */
+}
+