]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* elf32-m68k.c (elf_m68k_grok_prstatus): New function.
authorAndreas Schwab <schwab@linux-m68k.org>
Mon, 21 May 2012 08:17:15 +0000 (08:17 +0000)
committerAndreas Schwab <schwab@linux-m68k.org>
Mon, 21 May 2012 08:17:15 +0000 (08:17 +0000)
(elf_m68k_grok_psinfo): New function.
(elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Define.

bfd/ChangeLog
bfd/elf32-m68k.c

index efa6cb7b4c4d9d3789da08bc156f00b40af6e54c..a77a28c9ab038e39a37eab4e345d5c6f29a91b13 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * elf32-m68k.c (elf_m68k_grok_prstatus): New function.
+       (elf_m68k_grok_psinfo): New function.
+       (elf_backend_grok_prstatus): Define.
+       (elf_backend_grok_psinfo): Define.
+
 2012-05-19  Maciej W. Rozycki  <macro@linux-mips.org>
 
        * elf64-mips.c (elf_backend_got_header_size): Correct definition.
index bba4c791b27b7f5e65152f8004c6797fc6f30c70..573003bfb3ccb52f5879eb13c160d32ccd58b09f 100644 (file)
@@ -4821,6 +4821,69 @@ elf_m68k_plt_sym_val (bfd_vma i, const asection *plt,
   return plt->vma + (i + 1) * elf_m68k_get_plt_info (plt->owner)->size;
 }
 
+/* Support for core dump NOTE sections.  */
+
+static bfd_boolean
+elf_m68k_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
+{
+  int offset;
+  size_t size;
+
+  switch (note->descsz)
+    {
+    default:
+      return FALSE;
+
+    case 154:          /* Linux/m68k */
+      /* pr_cursig */
+      elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+      /* pr_pid */
+      elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
+
+      /* pr_reg */
+      offset = 70;
+      size = 80;
+
+      break;
+    }
+
+  /* Make a ".reg/999" section.  */
+  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+                                         size, note->descpos + offset);
+}
+
+static bfd_boolean
+elf_m68k_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
+{
+  switch (note->descsz)
+    {
+    default:
+      return FALSE;
+
+    case 124:          /* Linux/m68k elf_prpsinfo.  */
+      elf_tdata (abfd)->core_pid
+       = bfd_get_32 (abfd, note->descdata + 12);
+      elf_tdata (abfd)->core_program
+       = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+      elf_tdata (abfd)->core_command
+       = _bfd_elfcore_strndup (abfd, note->descdata + 44, 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 (n > 0 && command[n - 1] == ' ')
+      command[n - 1] = '\0';
+  }
+
+  return TRUE;
+}
+
 #define TARGET_BIG_SYM                 bfd_elf32_m68k_vec
 #define TARGET_BIG_NAME                        "elf32-m68k"
 #define ELF_MACHINE_CODE               EM_68K
@@ -4860,6 +4923,8 @@ elf_m68k_plt_sym_val (bfd_vma i, const asection *plt,
 #define elf_backend_reloc_type_class   elf32_m68k_reloc_type_class
 #define elf_backend_plt_sym_val                elf_m68k_plt_sym_val
 #define elf_backend_object_p           elf32_m68k_object_p
+#define elf_backend_grok_prstatus      elf_m68k_grok_prstatus
+#define elf_backend_grok_psinfo                elf_m68k_grok_psinfo
 
 #define elf_backend_can_gc_sections 1
 #define elf_backend_can_refcount 1