This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] BFD patch for solaris (was: gcore fix for native gdb on solaris)
- From: Daniel Gutson <dgutson at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Thu, 12 Nov 2009 19:42:00 -0300
- Subject: [PATCH] BFD patch for solaris (was: gcore fix for native gdb on solaris)
Hi, I posted this patch in the gdb-patches list, but was told that the
BFD part had to be posted here.
Please let me know if the BFD part (description and changelog below) is
OK to commit.
Thanks,
Daniel.
-------- Original Message --------
Subject: [PATCH] gcore fix for native gdb on solaris
Date: Tue, 10 Nov 2009 19:14:21 -0300
From: Daniel Gutson <dgutson@codesourcery.com>
Organization: CodeSourcery
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>
The attached patch solves a bug that caused GDB to wrongly read core
dump files generated with the gcore command, running on solaris.
A define (_STRUCTURE_PROC) was needed before including procfs.h.
Additionally, fp regs are properly read.
I tested this with the gdb test suite, comparing results before and
after (the only differences were caused by timeouts).
Please let me know any comments, or commit it for me since I don't have
write access.
Thanks,
Daniel.
2009-11-10 Daniel Gutson <dgutson@codesourcery.com>
bfd/
* bfd.m4 (BFD_HAVE_SYS_PROCFS_TYPE): Define _STRUCTURE_PROC
before including procfs.h.
(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Likewise.
* configure.in: Added autoconf probe for the pr_fpreg member.
* configure: Regenerated.
* config.in: Regenerated.
* elf.c: Define _STRUCTURE_PROC before including procfs.h.
gdb/
* procfs.c: (procfs_do_thread_registers) Use
elfcore_write_lwpstatus.
--
Daniel Gutson
CodeSourcery
www.codesourcery.com
--
Daniel Gutson
CodeSourcery
www.codesourcery.com
Index: bfd/bfd.m4
===================================================================
RCS file: /cvs/src/src/bfd/bfd.m4,v
retrieving revision 1.6
diff -u -p -r1.6 bfd.m4
--- bfd/bfd.m4 7 Sep 2009 09:15:27 -0000 1.6
+++ bfd/bfd.m4 10 Nov 2009 22:06:31 -0000
@@ -8,6 +8,8 @@ AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
[AC_TRY_COMPILE([
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>],
[$1 avar],
bfd_cv_have_sys_procfs_type_$1=yes,
@@ -27,6 +29,8 @@ AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBE
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
[AC_TRY_COMPILE([
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>],
[$1 avar; void* aref = (void*) &avar.$2],
bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
Index: bfd/config.in
===================================================================
RCS file: /cvs/src/src/bfd/config.in,v
retrieving revision 1.45
diff -u -p -r1.45 config.in
--- bfd/config.in 7 Sep 2009 09:15:27 -0000 1.45
+++ bfd/config.in 10 Nov 2009 22:06:31 -0000
@@ -114,6 +114,9 @@
/* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
#undef HAVE_LWPSTATUS_T_PR_CONTEXT
+/* Define if <sys/procfs.h> has lwpstatus_t.pr_fpreg. */
+#undef HAVE_LWPSTATUS_T_PR_FPREG
+
/* Define if <sys/procfs.h> has lwpstatus_t.pr_reg. */
#undef HAVE_LWPSTATUS_T_PR_REG
Index: bfd/configure
===================================================================
RCS file: /cvs/src/src/bfd/configure,v
retrieving revision 1.317
diff -u -p -r1.317 configure
--- bfd/configure 29 Sep 2009 14:17:03 -0000 1.317
+++ bfd/configure 10 Nov 2009 22:06:31 -0000
@@ -13923,6 +13923,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -13958,6 +13960,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -13993,6 +13997,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14028,6 +14034,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14063,6 +14071,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14098,6 +14108,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14133,6 +14145,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14168,6 +14182,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14203,6 +14219,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14238,6 +14256,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14273,6 +14293,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14308,6 +14330,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14343,6 +14367,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14378,6 +14404,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14413,6 +14441,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
@@ -14448,6 +14478,8 @@ else
/* end confdefs.h. */
#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
int
main ()
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.272
diff -u -p -r1.272 configure.in
--- bfd/configure.in 29 Sep 2009 14:17:03 -0000 1.272
+++ bfd/configure.in 10 Nov 2009 22:06:31 -0000
@@ -500,6 +500,7 @@ changequote([,])dnl
BFD_HAVE_SYS_PROCFS_TYPE(lwpxstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_reg)
+ BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_fpreg)
BFD_HAVE_SYS_PROCFS_TYPE(win32_pstatus_t)
fi
fi
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.493
diff -u -p -r1.493 elf.c
--- bfd/elf.c 28 Sep 2009 09:45:33 -0000 1.493
+++ bfd/elf.c 10 Nov 2009 22:06:31 -0000
@@ -7420,6 +7420,8 @@ _bfd_elf_rel_vtable_reloc_fn
out details about the corefile. */
#ifdef HAVE_SYS_PROCFS_H
+/* Needed for new procfs interface on sparc-solaris. */
+# define _STRUCTURED_PROC 1
# include <sys/procfs.h>
#endif
Index: gdb/procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.120
diff -u -p -r1.120 procfs.c
--- gdb/procfs.c 10 Nov 2009 21:00:41 -0000 1.120
+++ gdb/procfs.c 10 Nov 2009 22:06:31 -0000
@@ -6074,7 +6074,7 @@ procfs_do_thread_registers (bfd *obfd, p
target_fetch_registers (regcache, -1);
fill_gregset (regcache, &gregs, -1);
-#if defined (UNIXWARE)
+#if defined (UNIXWARE) || defined (NEW_PROC_API)
note_data = (char *) elfcore_write_lwpstatus (obfd,
note_data,
note_size,