This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH/RFA] Partial Solaris SPARC cross-core support
- From: Mark Kettenis <kettenis at chello dot nl>
- To: binutils at sources dot redhat dot com
- Date: Sun, 4 Jan 2004 00:45:28 +0100 (CET)
- Subject: [PATCH/RFA] Partial Solaris SPARC cross-core support
Complete cross-core support for Solaris needs a bit more effort.
However, this fixes an actual problem in GDB with Solaris core files
from Solaris 2.6 and up. Solaris core files contain duplicate
information; there are two slightly different notes with more or less
the same information, an "old" and a "new" one. See core(4) on a
Solaris host near you for more info. Currently BFD would barf on one
of the two, and bail out completely, even if it recognized one of the
two. Now we recognize both, and retain information from the last one
read.
Ok to commit?
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* elf32-sparc.c (elf32_sparc_grok_psinfo): New function.
Index: elf32-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sparc.c,v
retrieving revision 1.60
diff -u -p -r1.60 elf32-sparc.c
--- elf32-sparc.c 4 Dec 2003 03:03:27 -0000 1.60
+++ elf32-sparc.c 3 Jan 2004 23:40:27 -0000
@@ -502,6 +502,35 @@ sparc_elf_lox10_reloc (abfd,
return bfd_reloc_ok;
}
+/* Support for core dump NOTE sections. */
+
+static bfd_boolean
+elf32_sparc_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 260: /* Solaris prpsinfo_t. */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 84, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 100, 80);
+ break;
+
+ case 336: /* Solaris psinfo_t. */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 88, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 104, 80);
+ break;
+ }
+
+ return TRUE;
+}
+
+
/* Functions for the SPARC ELF linker. */
/* The name of the dynamic interpreter. This is put in the .interp
@@ -3451,6 +3480,7 @@ elf32_sparc_reloc_type_class (rela)
elf32_sparc_final_write_processing
#define elf_backend_gc_mark_hook elf32_sparc_gc_mark_hook
#define elf_backend_gc_sweep_hook elf32_sparc_gc_sweep_hook
+#define elf_backend_grok_psinfo elf32_sparc_grok_psinfo
#define elf_backend_reloc_type_class elf32_sparc_reloc_type_class
#define elf_backend_can_gc_sections 1