Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gcore fix for native gdb on solaris
@ 2009-11-10 22:14 Daniel Gutson
  2009-11-11 15:04 ` Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Daniel Gutson @ 2009-11-10 22:14 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: procfs.patch --]
[-- Type: text/x-diff; name="procfs.patch", Size: 6703 bytes --]

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,

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-01-12 23:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-10 22:14 [PATCH] gcore fix for native gdb on solaris Daniel Gutson
2009-11-11 15:04 ` Tom Tromey
2010-01-05  0:52   ` Daniel Gutson
2010-01-05 17:51     ` Tom Tromey
2010-01-09  5:05 ` Joel Brobecker
2010-01-11 16:28 ` Jan Kratochvil
2010-01-12  3:39   ` Joel Brobecker
2010-01-12 12:27     ` Jan Kratochvil
2010-01-12 13:23       ` Joel Brobecker
2010-01-12 21:44         ` Daniel Gutson
2010-01-12 22:03           ` Jan Kratochvil
2010-01-12 23:57             ` Daniel Gutson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox