Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Functions | Variables
osf-core.c File Reference
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include <sys/user.h>

Go to the source code of this file.

Classes

struct  osf_core_struct

Defines

#define osf_core_core_file_matches_executable_p   generic_core_file_matches_executable_p
#define core_hdr(bfd)   ((bfd)->tdata.osf_core_data)
#define core_signal(bfd)   (core_hdr(bfd)->sig)
#define core_command(bfd)   (core_hdr(bfd)->cmd)
#define NO_GET   ((bfd_vma (*) (const void *)) swap_abort)
#define NO_PUT   ((void (*) (bfd_vma, void *)) swap_abort)
#define NO_GETS   ((bfd_signed_vma (*) (const void *)) swap_abort)
#define NO_GET64   ((bfd_uint64_t (*) (const void *)) swap_abort)
#define NO_PUT64   ((void (*) (bfd_uint64_t, void *)) swap_abort)
#define NO_GETS64   ((bfd_int64_t (*) (const void *)) swap_abort)

Functions

static asection *make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr))
static const bfd_target
*osf_core_core_file_p 
PARAMS ((bfd *))
static void swap_abort PARAMS ((void))
static asectionmake_bfd_asection (bfd *abfd, const char *name, flagword flags, bfd_size_type size, bfd_vma vma, file_ptr filepos)
static const bfd_targetosf_core_core_file_p (bfd *abfd)
static char * osf_core_core_file_failing_command (bfd *abfd)
static int osf_core_core_file_failing_signal (bfd *abfd)
static void swap_abort ()

Variables

const bfd_target osf_core_vec

Class Documentation

struct osf_core_struct

Definition at line 49 of file osf-core.c.

Class Members
char cmd
int sig

Define Documentation

#define core_command (   bfd)    (core_hdr(bfd)->cmd)

Definition at line 57 of file osf-core.c.

#define core_hdr (   bfd)    ((bfd)->tdata.osf_core_data)

Definition at line 55 of file osf-core.c.

#define core_signal (   bfd)    (core_hdr(bfd)->sig)

Definition at line 56 of file osf-core.c.

#define NO_GET   ((bfd_vma (*) (const void *)) swap_abort)

Definition at line 181 of file osf-core.c.

#define NO_GET64   ((bfd_uint64_t (*) (const void *)) swap_abort)

Definition at line 184 of file osf-core.c.

#define NO_GETS   ((bfd_signed_vma (*) (const void *)) swap_abort)

Definition at line 183 of file osf-core.c.

#define NO_GETS64   ((bfd_int64_t (*) (const void *)) swap_abort)

Definition at line 186 of file osf-core.c.

#define NO_PUT   ((void (*) (bfd_vma, void *)) swap_abort)

Definition at line 182 of file osf-core.c.

#define NO_PUT64   ((void (*) (bfd_uint64_t, void *)) swap_abort)

Definition at line 185 of file osf-core.c.

Definition at line 43 of file osf-core.c.


Function Documentation

static asection* make_bfd_asection ( bfd abfd,
const char *  name,
flagword  flags,
bfd_size_type  size,
bfd_vma  vma,
file_ptr  filepos 
) [static]

Definition at line 60 of file osf-core.c.

{
  asection *asect;

  asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
  if (!asect)
    return NULL;

  asect->size = size;
  asect->vma = vma;
  asect->filepos = filepos;
  asect->alignment_power = 8;

  return asect;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* osf_core_core_file_failing_command ( bfd abfd) [static]

Definition at line 161 of file osf-core.c.

{
  return core_command (abfd);
}
static int osf_core_core_file_failing_signal ( bfd abfd) [static]

Definition at line 168 of file osf-core.c.

{
  return core_signal (abfd);
}
static const bfd_target* osf_core_core_file_p ( bfd abfd) [static]

Definition at line 83 of file osf-core.c.

{
  int val;
  int i;
  char *secname;
  struct core_filehdr core_header;
  bfd_size_type amt;

  amt = sizeof core_header;
  val = bfd_bread ((PTR) &core_header, amt, abfd);
  if (val != sizeof core_header)
    return NULL;

  if (! CONST_STRNEQ (core_header.magic, "Core"))
    return NULL;

  core_hdr (abfd) = (struct osf_core_struct *)
    bfd_zalloc (abfd, (bfd_size_type) sizeof (struct osf_core_struct));
  if (!core_hdr (abfd))
    return NULL;

  strncpy (core_command (abfd), core_header.name, MAXCOMLEN + 1);
  core_signal (abfd) = core_header.signo;

  for (i = 0; i < core_header.nscns; i++)
    {
      struct core_scnhdr core_scnhdr;
      flagword flags;

      amt = sizeof core_scnhdr;
      val = bfd_bread ((PTR) &core_scnhdr, amt, abfd);
      if (val != sizeof core_scnhdr)
       break;

      /* Skip empty sections.  */
      if (core_scnhdr.size == 0 || core_scnhdr.scnptr == 0)
       continue;

      switch (core_scnhdr.scntype)
       {
       case SCNRGN:
         secname = ".data";
         flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
         break;
       case SCNSTACK:
         secname = ".stack";
         flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
         break;
       case SCNREGS:
         secname = ".reg";
         flags = SEC_HAS_CONTENTS;
         break;
       default:
         (*_bfd_error_handler) (_("Unhandled OSF/1 core file section type %d\n"),
                             core_scnhdr.scntype);
         continue;
       }

      if (!make_bfd_asection (abfd, secname, flags,
                           (bfd_size_type) core_scnhdr.size,
                           (bfd_vma) core_scnhdr.vaddr,
                           (file_ptr) core_scnhdr.scnptr))
       goto fail;
    }

  /* OK, we believe you.  You're a core file (sure, sure).  */

  return abfd->xvec;

 fail:
  bfd_release (abfd, core_hdr (abfd));
  core_hdr (abfd) = NULL;
  bfd_section_list_clear (abfd);
  return NULL;
}

Here is the call graph for this function:

static const bfd_target* osf_core_core_file_p PARAMS ( (bfd *)  ) [static]
static void swap_abort PARAMS ( (void)  ) [static]
static void swap_abort ( void  ) [static]

Definition at line 176 of file osf-core.c.

{
  abort(); /* This way doesn't require any declaration for ANSI to fuck up */
}

Variable Documentation

Definition at line 188 of file osf-core.c.