]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add n64 core file support for Linux/MIPS.
authorKevin Buettner <kevinb@redhat.com>
Thu, 5 Dec 2002 05:04:00 +0000 (05:04 +0000)
committerKevin Buettner <kevinb@redhat.com>
Thu, 5 Dec 2002 05:04:00 +0000 (05:04 +0000)
bfd/ChangeLog
bfd/elf64-mips.c

index 6c66b1fa7f448a508e5cdd25da8a14d8394f4985..85487191bca39ccfd3ddff8d4085a1da5cd66489 100644 (file)
@@ -1,3 +1,9 @@
+2002-12-04  Kevin Buettner  <kevinb@redhat.com>
+
+       * elf64-mips.c (elf64_mips_grok_prstatus, elf64_mips_grok_psinfo):
+       New functions.
+       (elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define.
+
 2002-12-04  David Mosberger  <davidm@hpl.hp.com>
 
        * cpu-ia64-opc.c: Add operand constant "ar.csd".
index fda989fde987c4ac9219a2a8285e4d4c3761a3cf..50fcfbabf19696152657b5262a5e5c8fc040c269 100644 (file)
@@ -125,6 +125,10 @@ static bfd_boolean mips_elf64_object_p
   PARAMS ((bfd *));
 static irix_compat_t elf64_mips_irix_compat
   PARAMS ((bfd *));
+static bfd_boolean elf64_mips_grok_prstatus
+  PARAMS ((bfd *, Elf_Internal_Note *));
+static bfd_boolean elf64_mips_grok_psinfo
+  PARAMS ((bfd *, Elf_Internal_Note *));
 
 extern const bfd_target bfd_elf64_bigmips_vec;
 extern const bfd_target bfd_elf64_littlemips_vec;
@@ -2529,6 +2533,71 @@ elf64_mips_irix_compat (abfd)
     return ict_none;
 }
 \f
+/* Support for core dump NOTE sections.  */
+static bfd_boolean
+elf64_mips_grok_prstatus (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+{
+  int offset;
+  unsigned int raw_size;
+
+  switch (note->descsz)
+    {
+      default:
+       return FALSE;
+
+      case 480:                /* Linux/MIPS - N64 kernel */
+       /* 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;
+       raw_size = 360;
+
+       break;
+    }
+
+  /* Make a ".reg/999" section.  */
+  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+                                         raw_size, note->descpos + offset);
+}
+
+static bfd_boolean
+elf64_mips_grok_psinfo (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+{
+  switch (note->descsz)
+    {
+      default:
+       return FALSE;
+
+      case 136:                /* Linux/MIPS - N64 kernel 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;
+}
+\f
 /* ECOFF swapping routines.  These are used when dealing with the
    .mdebug section, which is in the ECOFF debugging format.  */
 static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap =
@@ -2659,6 +2728,9 @@ const struct elf_size_info mips_elf64_size_info =
 #define elf_backend_ecoff_debug_swap   &mips_elf64_ecoff_debug_swap
 #define elf_backend_size_info          mips_elf64_size_info
 
+#define elf_backend_grok_prstatus      elf64_mips_grok_prstatus
+#define elf_backend_grok_psinfo                elf64_mips_grok_psinfo
+
 #define elf_backend_got_header_size    (4 * MIPS_RESERVED_GOTNO)
 #define elf_backend_plt_header_size    0