diff options
author | Alan Modra <amodra@gmail.com> | 2007-02-01 05:35:58 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2007-02-01 05:35:58 +0000 |
commit | 183e98bed26941bb85b3170a4620ac32b1f8f686 (patch) | |
tree | ccdf42b35e549d13775da37fbc4a7a1697621945 /bfd/elf64-ppc.c | |
parent | b25b09cb7ee16880b59f80848071b623d1a20c8f (diff) | |
download | gdb-183e98bed26941bb85b3170a4620ac32b1f8f686.zip gdb-183e98bed26941bb85b3170a4620ac32b1f8f686.tar.gz gdb-183e98bed26941bb85b3170a4620ac32b1f8f686.tar.bz2 |
* elf-bfd.h (struct elf_backend_data): Add elf_backend_write_core_note.
* elfxx-target.h (elf_backend_write_core_note): Define and use.
* elf.c (elfcore_write_prpsinfo): Call the above. Add support for
32-bit core note on 64-bit target.
(elfcore_write_prstatus): Likewise.
(elfcore_write_lwpstatus): Make note_name const.
(elfcore_write_prfpreg): Likewise.
(elfcore_write_pstatus): Add support for 32-bit core note on 64-bit
target.
* elf32-ppc.c (ppc_elf_write_core_note): New function.
(elf_backend_write_core_note): Define.
* elf64-ppc.c (ppc64_elf_write_core_note): New function.
(elf_backend_write_core_note): Define.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r-- | bfd/elf64-ppc.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 35f7cdf..a354957 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -25,6 +25,7 @@ http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and http://www.linuxbase.org/spec/ELF/ppc64/spec/book1.html */ +#include <stdarg.h> #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" @@ -84,6 +85,7 @@ static bfd_vma opd_entry_value #define elf_backend_object_p ppc64_elf_object_p #define elf_backend_grok_prstatus ppc64_elf_grok_prstatus #define elf_backend_grok_psinfo ppc64_elf_grok_psinfo +#define elf_backend_write_core_note ppc64_elf_write_core_note #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections #define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol #define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook @@ -2484,6 +2486,53 @@ ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } +static char * +ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, + ...) +{ + switch (note_type) + { + default: + return NULL; + + case NT_PRPSINFO: + { + char data[136]; + va_list ap; + + va_start (ap, note_type); + memset (data, 0, 40); + strncpy (data + 40, va_arg (ap, const char *), 16); + strncpy (data + 56, va_arg (ap, const char *), 80); + va_end (ap); + return elfcore_write_note (abfd, buf, bufsiz, + "CORE", note_type, data, sizeof (data)); + } + + case NT_PRSTATUS: + { + char data[504]; + va_list ap; + long pid; + int cursig; + const void *greg; + + va_start (ap, note_type); + memset (data, 0, 112); + pid = va_arg (ap, long); + bfd_put_32 (abfd, pid, data + 32); + cursig = va_arg (ap, int); + bfd_put_16 (abfd, cursig, data + 12); + greg = va_arg (ap, const void *); + memcpy (data + 112, greg, 384); + memset (data + 496, 0, 8); + va_end (ap); + return elfcore_write_note (abfd, buf, bufsiz, + "CORE", note_type, data, sizeof (data)); + } + } +} + /* Merge backend specific data from an object file to the output object file when linking. */ |