public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [elf64-hppa] Add grok_{prstatus,psinfo} methods
@ 2005-12-22 15:56 Randolph Chung
  2005-12-27 16:56 ` Nick Clifton
  0 siblings, 1 reply; 7+ messages in thread
From: Randolph Chung @ 2005-12-22 15:56 UTC (permalink / raw)
  To: binutils

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

This adds the grok_prstatus/psinfo methods for the elf64-hppa target for 
Linux core dumps.

Tested on hppa64-gnu-linux. Please commit if okay.

randolph

[-- Attachment #2: elfpa.diff --]
[-- Type: text/x-patch, Size: 2514 bytes --]

2005-12-22  Randolph Chung  <tausq@debian.org>

	* elf64-hppa.c (elf64_hppa_grok_prstatus): New function.
	(elf64_hppa_grok_psinfo): Likewise.
	(elf_backend_grok_pstatus, elf_backend_grok_psinfo): Define.

Index: elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.67
diff -u -p -r1.67 elf64-hppa.c
--- elf64-hppa.c	4 Dec 2005 14:58:11 -0000	1.67
+++ elf64-hppa.c	22 Dec 2005 15:51:21 -0000
@@ -2542,6 +2542,67 @@ elf64_hppa_finish_dynamic_sections (outp
   return TRUE;
 }
 
+/* Support for core dump NOTE sections.  */
+
+static bfd_boolean
+elf64_hppa_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+{
+  int offset;
+  size_t size;
+
+  switch (note->descsz)
+    {
+      default:
+	return FALSE;
+
+      case 760:		/* Linux/hppa */
+	/* pr_cursig */
+	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+	/* pr_pid */
+	elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32);
+
+	/* pr_reg */
+	offset = 112;
+	size = 640;
+
+	break;
+    }
+
+  /* Make a ".reg/999" section.  */
+  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+					  size, note->descpos + offset);
+}
+
+static bfd_boolean
+elf64_hppa_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+  switch (note->descsz)
+    {
+      default:
+	return FALSE;
+
+      case 136:		/* Linux/hppa elf_prpsinfo.  */
+	elf_tdata (abfd)->core_program
+	  = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
+	elf_tdata (abfd)->core_command
+	  = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
+    }
+
+  /* Note that for some reason, a spurious space is tacked
+     onto the end of the args in some (at least one anyway)
+     implementations, so strip it off if it exists.  */
+  {
+    char *command = elf_tdata (abfd)->core_command;
+    int n = strlen (command);
+
+    if (0 < n && command[n - 1] == ' ')
+      command[n - 1] = '\0';
+  }
+
+  return TRUE;
+}
+
 /* Return the number of additional phdrs we will need.
 
    The generic ELF code only creates PT_PHDRs for executables.  The HP
@@ -2775,6 +2836,8 @@ const struct elf_size_info hppa64_elf_si
 					elf64_hppa_finish_dynamic_symbol
 #define elf_backend_finish_dynamic_sections \
 					elf64_hppa_finish_dynamic_sections
+#define elf_backend_grok_prstatus	     elf64_hppa_grok_prstatus
+#define elf_backend_grok_psinfo		     elf64_hppa_grok_psinfo
 
 /* Stuff for the BFD linker: */
 #define bfd_elf64_bfd_link_hash_table_create \

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

end of thread, other threads:[~2006-04-07 14:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-22 15:56 [elf64-hppa] Add grok_{prstatus,psinfo} methods Randolph Chung
2005-12-27 16:56 ` Nick Clifton
2005-12-28  4:18   ` Randolph Chung
2006-03-13 22:44   ` Randolph Chung
2006-03-21  2:19     ` [ping] " Randolph Chung
2006-04-01  1:19       ` [ping^2] " Randolph Chung
2006-04-07 14:57         ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).