2c2fa1
http://sourceware.org/ml/gdb-patches/2013-05/msg00042.html
2c2fa1
Subject: [patch] Fix gcore for vDSO (on ppc64)
2c2fa1
2c2fa1
Hi,
2c2fa1
2c2fa1
on ppc64 GNU/Linux one gets in live process or kernel-generated core file:
2c2fa1
2c2fa1
#0  0x00003fff9e946b3c in __pause_nocancel () from /lib64/libc.so.6
2c2fa1
#1  0x000000001000080c in handle_alrm (signo=14) at small.c:16
2c2fa1
#2  <signal handler called>
2c2fa1
#3  0x00003fff9e946b3c in __pause_nocancel () from /lib64/libc.so.6
2c2fa1
#4  0x0000000010000914 in main (argc=2, argv=0x3fffcd00dec8) at small.c:32
2c2fa1
2c2fa1
while with gcore generated core file one gets:
2c2fa1
2c2fa1
#0  0x00003fff9e946b3c in __pause_nocancel () from /lib64/libc.so.6
2c2fa1
#1  0x000000001000080c in handle_alrm (signo=14) at small.c:16
2c2fa1
#2  0x00003fff9ea70448 in ?? ()
2c2fa1
#3  0x0000000010000914 in main (argc=2, argv=0x3fffcd00dec8) at small.c:32
2c2fa1
2c2fa1
This is because on ppc64 GNU/Linux the signal handler frame is in vDSO (and
2c2fa1
not in libc as on x86_64 GNU/Linux).  And if one has kernel-debuginfo
2c2fa1
installed GDB gcore thinks it can omit the vDSO page from core file.
2c2fa1
2c2fa1
As vDSO cannot be reliably found from link_map it should be rather fully
2c2fa1
present in the core file.  Which also gcore_create_callback tries to do but it
2c2fa1
gets mistaken by the separate debug info.
2c2fa1
2c2fa1
It seems pretty obvious patch to me.
2c2fa1
2c2fa1
2c2fa1
Thanks,
2c2fa1
Jan
2c2fa1
2c2fa1
2c2fa1
gdb/
2c2fa1
2013-05-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
2c2fa1
2c2fa1
	* gcore.c (gcore_create_callback): Ignore sections with
2c2fa1
	separate_debug_objfile_backlink != NULL.
2c2fa1
2c2fa1
--- gdb-7.6-orig/gdb/gcore.c	2013-01-01 07:32:42.000000000 +0100
2c2fa1
+++ gdb-7.6/gdb/gcore.c	2013-05-03 03:31:34.795312996 +0200
2c2fa1
@@ -428,8 +428,9 @@ gcore_create_callback (CORE_ADDR vaddr,
2c2fa1
 
2c2fa1
 	     This BFD was synthesized from reading target memory,
2c2fa1
 	     we don't want to omit that.  */
2c2fa1
-	  if (((vaddr >= start && vaddr + size <= end)
2c2fa1
-	       || (start >= vaddr && end <= vaddr + size))
2c2fa1
+	  if (objfile->separate_debug_objfile_backlink == NULL
2c2fa1
+	      && ((vaddr >= start && vaddr + size <= end)
2c2fa1
+	          || (start >= vaddr && end <= vaddr + size))
2c2fa1
 	      && !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY))
2c2fa1
 	    {
2c2fa1
 	      flags &= ~(SEC_LOAD | SEC_HAS_CONTENTS);
2c2fa1