This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] hppa64-hpux core file tweak


The attached patch tweaks the core file support recently committed by
Randolph Chung a bit.  It does two things:

1. Make sure that the .regs pseudo-section is listing after the proc
   sections it's generated from.  This makes things more similar to
   the normal ELF core file support where the .reg pseudo-section is
   listed after the note section it's generated from.

2. Add a .kernel pseudo section.  This will allow Randolph to
   implement proper detection of HP-UX core files by checking the
   contents of this section for the string "HP-UX".

Ok?

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* elf64-hppa.c (elf64_hppa_section_from_phdr): Create .kernel
	pseudo-section.  Make sure .reg section comes after the proc
	section it's generated from.

Index: elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.66
diff -u -p -r1.66 elf64-hppa.c
--- elf64-hppa.c 18 Nov 2005 00:48:50 -0000 1.66
+++ elf64-hppa.c 20 Nov 2005 21:10:54 -0000
@@ -2652,6 +2652,22 @@ static bfd_boolean
 elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
 			      const char *typename)
 {
+  if (hdr->p_type == PT_HP_CORE_KERNEL)
+    {
+      asection *sect;
+
+      if (!_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename))
+	return FALSE;
+
+      sect = bfd_make_section_anyway (abfd, ".kernel");
+      if (sect == NULL)
+	return FALSE;
+      sect->size = hdr->p_filesz;
+      sect->filepos = hdr->p_offset;
+      sect->flags = SEC_HAS_CONTENTS | SEC_READONLY;
+      return TRUE;
+    }
+
   if (hdr->p_type == PT_HP_CORE_PROC)
     {
       int sig;
@@ -2663,10 +2679,12 @@ elf64_hppa_section_from_phdr (bfd *abfd,
 
       elf_tdata (abfd)->core_signal = sig;
 
-      /* gdb uses the ".reg" section to read register contents.  */
-      if (!_bfd_elfcore_make_pseudosection (abfd, ".reg", hdr->p_filesz,
-	  				    hdr->p_offset))
+      if (!_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename))
 	return FALSE;
+
+      /* GDB uses the ".reg" section to read register contents.  */
+      return _bfd_elfcore_make_pseudosection (abfd, ".reg", hdr->p_filesz,
+					      hdr->p_offset);
     }
 
   if (hdr->p_type == PT_HP_CORE_LOADABLE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]