diff options
author | Nick Clifton <nickc@redhat.com> | 2004-01-02 17:39:51 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2004-01-02 17:39:51 +0000 |
commit | 61adc1a4d5a4dcffb221f1d562c2a92969bb371a (patch) | |
tree | 90753a57bc12158022a84e029baa16a0a57ae838 /bfd/elf32-i386.c | |
parent | e42c953419c841c0a2b90f9488e6f519e6e49f0b (diff) | |
download | gdb-61adc1a4d5a4dcffb221f1d562c2a92969bb371a.zip gdb-61adc1a4d5a4dcffb221f1d562c2a92969bb371a.tar.gz gdb-61adc1a4d5a4dcffb221f1d562c2a92969bb371a.tar.bz2 |
Add support for FreeBSD cores
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 876efc6..0a3d83f 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1,5 +1,5 @@ /* Intel 80386/80486-specific support for 32-bit ELF - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -346,29 +346,50 @@ elf_i386_is_local_label_name (bfd *abfd, const char *name) } /* Support for core dump NOTE sections. */ + static bfd_boolean elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; size_t raw_size; - switch (note->descsz) + if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0) { - default: - return FALSE; + int pr_version = bfd_get_32 (abfd, note->descdata); + + if (pr_version != 1) + return FALSE; + + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 20); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 28; + raw_size = bfd_get_32 (abfd, note->descdata + 8); + } + else + { + switch (note->descsz) + { + default: + return FALSE; - case 144: /* Linux/i386 */ - /* pr_cursig */ - elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + case 144: /* Linux/i386 */ + /* 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_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); - /* pr_reg */ - offset = 72; - raw_size = 68; + /* pr_reg */ + offset = 72; + raw_size = 68; - break; + break; + } } /* Make a ".reg/999" section. */ @@ -379,22 +400,36 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) static bfd_boolean elf_i386_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { - switch (note->descsz) + if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0) { - default: + int pr_version = bfd_get_32 (abfd, note->descdata); + + if (pr_version != 1) return FALSE; - case 124: /* Linux/i386 elf_prpsinfo */ - 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); + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 8, 17); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 25, 81); + } + else + { + switch (note->descsz) + { + default: + return FALSE; + + case 124: /* Linux/i386 elf_prpsinfo. */ + 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); |