diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2012-05-21 08:17:15 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@linux-m68k.org> | 2012-05-21 08:17:15 +0000 |
commit | 8bbeae90c581eef4bd6c060952c372dc8e7d7a75 (patch) | |
tree | f4fe579813ff7019eb1848c10c88984170e23f74 /bfd/elf32-m68k.c | |
parent | 2a2e1f8e32410ddf8db8b412b90c3c31ee16b937 (diff) | |
download | gdb-8bbeae90c581eef4bd6c060952c372dc8e7d7a75.zip gdb-8bbeae90c581eef4bd6c060952c372dc8e7d7a75.tar.gz gdb-8bbeae90c581eef4bd6c060952c372dc8e7d7a75.tar.bz2 |
* 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.
Diffstat (limited to 'bfd/elf32-m68k.c')
-rw-r--r-- | bfd/elf32-m68k.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index bba4c79..573003b 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -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 |