aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-mips.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-06-30 03:15:46 +0000
committerAlan Modra <amodra@gmail.com>2001-06-30 03:15:46 +0000
commitbb0082d686d9a84f29c7e6bb36736f68aa65169e (patch)
tree2933920838b2b1c92be2905e6f923281367f2d21 /bfd/elf32-mips.c
parentb64977c5ff2661a4e20d2dcbf999b143670ac742 (diff)
downloadgdb-bb0082d686d9a84f29c7e6bb36736f68aa65169e.zip
gdb-bb0082d686d9a84f29c7e6bb36736f68aa65169e.tar.gz
gdb-bb0082d686d9a84f29c7e6bb36736f68aa65169e.tar.bz2
* elf-bfd.h: Add prototypes for _bfd_elfcore_make_pseudosection
and _bfd_elfcore_strndup. (struct elf_backend_data): Add elf_backend_grok_prstatus and elf_backend_grok_psinfo. * elf.c (_bfd_elfcore_make_pseudosection): New function. (elfcore_grok_prstatus): Use it. (elfcore_make_note_pseudosection): Likewise. (elfcore_strndup): Rename to... (_bfd_elfcore_strndup): Here, and make global. (elfcore_grok_psinfo): Use _bfd_elfcore_strndup. (elfcore_grok_note): Call elf_backend_grok_prstatus and elf_backend_grok_psinfo if available. * elf32-mips.c (_bfd_elf32_mips_grok_prstatus): New function. (_bfd_elf32_mips_grok_psinfo): New function. (elf_backend_grok_prstatus): Define. (elf_backend_grok_psinfo): Define. * elfxx-target.h (elf_backend_grok_prstatus): Default to NULL. (elf_backend_grok_psinfo): Likewise. (elfNN_bed): Include elf_backend_grok_prstatus and elf_backend_grok_psinfo.
Diffstat (limited to 'bfd/elf32-mips.c')
-rw-r--r--bfd/elf32-mips.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 0ac7b5a..44c2a4c 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -9134,6 +9134,73 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
return true;
}
+/* Support for core dump NOTE sections */
+static boolean
+_bfd_elf32_mips_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 256: /* Linux/MIPS */
+ /* 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 + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 180;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ if (! _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset))
+ return false;
+
+ return true;
+}
+
+static boolean _bfd_elf32_mips_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 128: /* Linux/MIPS elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 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;
+}
+
/* This is almost identical to bfd_generic_get_... except that some
MIPS relocations need to be handled specially. Sigh. */
@@ -9421,6 +9488,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
_bfd_mips_elf_copy_indirect_symbol
#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
+#define elf_backend_grok_prstatus _bfd_elf32_mips_grok_prstatus
+#define elf_backend_grok_psinfo _bfd_elf32_mips_grok_psinfo
#define bfd_elf32_bfd_is_local_label_name \
mips_elf_is_local_label_name