Add support for FreeBSD cores

This commit is contained in:
Nick Clifton 2004-01-02 17:39:51 +00:00
parent e42c953419
commit 61adc1a4d5
2 changed files with 61 additions and 21 deletions

View File

@ -1,3 +1,8 @@
2004-01-02 Mark Kettenis <kettenis@gnu.org>
* elf32-i386.c (elf_i386_grok_prstatus): Add support for FreeBSD.
(elf_i386_grok_psinfo): Likewise.
2004-01-02 Bernardo Innocenti <bernie@develer.com> 2004-01-02 Bernardo Innocenti <bernie@develer.com>
* config.bfd: Add m68k-uClinux target. * config.bfd: Add m68k-uClinux target.

View File

@ -1,5 +1,5 @@
/* Intel 80386/80486-specific support for 32-bit ELF /* 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. Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -346,12 +346,32 @@ elf_i386_is_local_label_name (bfd *abfd, const char *name)
} }
/* Support for core dump NOTE sections. */ /* Support for core dump NOTE sections. */
static bfd_boolean static bfd_boolean
elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{ {
int offset; int offset;
size_t raw_size; size_t raw_size;
if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0)
{
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) switch (note->descsz)
{ {
default: default:
@ -370,6 +390,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
break; break;
} }
}
/* Make a ".reg/999" section. */ /* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg", return _bfd_elfcore_make_pseudosection (abfd, ".reg",
@ -378,23 +399,37 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
static bfd_boolean static bfd_boolean
elf_i386_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) elf_i386_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
{
if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0)
{
int pr_version = bfd_get_32 (abfd, note->descdata);
if (pr_version != 1)
return FALSE;
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) switch (note->descsz)
{ {
default: default:
return FALSE; return FALSE;
case 124: /* Linux/i386 elf_prpsinfo */ case 124: /* Linux/i386 elf_prpsinfo. */
elf_tdata (abfd)->core_program elf_tdata (abfd)->core_program
= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
elf_tdata (abfd)->core_command elf_tdata (abfd)->core_command
= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
} }
}
/* Note that for some reason, a spurious space is tacked /* Note that for some reason, a spurious space is tacked
onto the end of the args in some (at least one anyway) onto the end of the args in some (at least one anyway)
implementations, so strip it off if it exists. */ implementations, so strip it off if it exists. */
{ {
char *command = elf_tdata (abfd)->core_command; char *command = elf_tdata (abfd)->core_command;
int n = strlen (command); int n = strlen (command);