Beispiel #1
0
int
rs6000coff_core_file_failing_signal (bfd *abfd)
{
  CoreHdr *core = core_hdr (abfd);
#ifndef BFD64
  return CORE_NEW (*core) ? core->new_dump.c_signo : core->old.c_signo;
#else
  return  core->new_dump.c_signo;
#endif
}
Beispiel #2
0
int
xcoff64_core_file_failing_signal (bfd *abfd)
{
  struct core_dumpxx *c = core_hdr (abfd);
  int return_value = 0;

  if (NULL != c)
    return_value = c->c_signo;

  return return_value;
}
Beispiel #3
0
char *
xcoff64_core_file_failing_command (bfd *abfd)
{
  struct core_dumpxx *c = core_hdr (abfd);
  char *return_value = 0;

  if (NULL != c)
    return_value = c->c_u.U_proc.pi_comm;

  return return_value;
}
Beispiel #4
0
char *
rs6000coff_core_file_failing_command (bfd *abfd)
{
  CoreHdr *core = core_hdr (abfd);
  char *com = CORE_NEW (*core) ?
    CNEW_COMM (core->new_dump) : COLD_COMM (core->old);

  if (*com)
    return com;
  else
    return 0;
}
Beispiel #5
0
static const bfd_target *
irix_core_core_file_p (bfd *abfd)
{
  int val;
  struct coreout coreout;
  struct idesc *idg, *idf, *ids;
  bfd_size_type amt;

  val = bfd_bread ((PTR) &coreout, (bfd_size_type) sizeof coreout, abfd);
  if (val != sizeof coreout)
    {
      if (bfd_get_error () != bfd_error_system_call)
	bfd_set_error (bfd_error_wrong_format);
      return 0;
    }

  if (coreout.c_version != CORE_VERSION1)
    return 0;

  /* Have we got a corefile?  */
  switch (coreout.c_magic)
    {
    case CORE_MAGIC:	break;
#ifdef CORE_MAGIC64
    case CORE_MAGIC64:	break;
#endif
#ifdef CORE_MAGICN32
    case CORE_MAGICN32:	break;
#endif
    default:		return 0;	/* Un-identifiable or not corefile.  */
    }

  amt = sizeof (struct sgi_core_struct);
  core_hdr (abfd) = (struct sgi_core_struct *) bfd_zalloc (abfd, amt);
  if (!core_hdr (abfd))
    return NULL;

  strncpy (core_command (abfd), coreout.c_name, CORE_NAMESIZE);
  core_signal (abfd) = coreout.c_sigcause;

  if (bfd_seek (abfd, coreout.c_vmapoffset, SEEK_SET) != 0)
    goto fail;

  /* Process corefile sections.  */
#ifdef CORE_MAGIC64
  if (coreout.c_magic == (int) CORE_MAGIC64)
    {
      if (! do_sections64 (abfd, & coreout))
	goto fail;
    }
  else
#endif
    if (! do_sections (abfd, & coreout))
      goto fail;

  /* Make sure that the regs are contiguous within the core file.  */

  idg = &coreout.c_idesc[I_GPREGS];
  idf = &coreout.c_idesc[I_FPREGS];
  ids = &coreout.c_idesc[I_SPECREGS];

  if (idg->i_offset + idg->i_len != idf->i_offset
      || idf->i_offset + idf->i_len != ids->i_offset)
    goto fail;			/* Can't deal with non-contig regs */

  if (bfd_seek (abfd, idg->i_offset, SEEK_SET) != 0)
    goto fail;

  if (!make_bfd_asection (abfd, ".reg",
			  SEC_HAS_CONTENTS,
			  idg->i_len + idf->i_len + ids->i_len,
			  0,
			  idg->i_offset))
    goto fail;

  /* OK, we believe you.  You're a core file (sure, sure).  */
  bfd_default_set_arch_mach (abfd, bfd_arch_mips, 0);

  return abfd->xvec;

 fail:
  bfd_release (abfd, core_hdr (abfd));
  core_hdr (abfd) = NULL;
  bfd_section_list_clear (abfd);
  return NULL;
}
Beispiel #6
0
const bfd_target *
lynx_core_file_p (bfd *abfd)
{
  int secnum;
  struct pssentry pss;
  bfd_size_type tcontext_size;
  core_st_t *threadp;
  int pagesize;
  asection *newsect;
  bfd_size_type amt;

  pagesize = getpagesize ();	/* Serious cross-target issue here...  This
				   really needs to come from a system-specific
				   header file.  */

  /* Get the pss entry from the core file */

  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
    return NULL;

  amt = sizeof pss;
  if (bfd_bread ((void *) &pss, amt, abfd) != amt)
    {
      /* Too small to be a core file */
      if (bfd_get_error () != bfd_error_system_call)
	bfd_set_error (bfd_error_wrong_format);
      return NULL;
    }

  amt = sizeof (struct lynx_core_struct);
  core_hdr (abfd) = (struct lynx_core_struct *) bfd_zalloc (abfd, amt);

  if (!core_hdr (abfd))
    return NULL;

  strncpy (core_command (abfd), pss.pname, PNMLEN + 1);

  /* Compute the size of the thread contexts */

  tcontext_size = pss.threadcnt * sizeof (core_st_t);

  /* Allocate space for the thread contexts */

  threadp = (core_st_t *) bfd_alloc (abfd, tcontext_size);
  if (!threadp)
    goto fail;

  /* Save thread contexts */

  if (bfd_seek (abfd, (file_ptr) pagesize, SEEK_SET) != 0)
    goto fail;

  if (bfd_bread ((void *) threadp, tcontext_size, abfd) != tcontext_size)
    {
      /* Probably too small to be a core file */
      if (bfd_get_error () != bfd_error_system_call)
	bfd_set_error (bfd_error_wrong_format);
      goto fail;
    }

  core_signal (abfd) = threadp->currsig;

  newsect = make_bfd_asection (abfd, ".stack",
			       SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
			       pss.ssize,
			       pss.slimit,
			       pagesize + tcontext_size);
  if (!newsect)
    goto fail;

  newsect = make_bfd_asection (abfd, ".data",
			       SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
			       pss.data_len + pss.bss_len,
			       pss.data_start,
			       pagesize + tcontext_size + pss.ssize
#if defined (SPARC) || defined (__SPARC__)
			       /* SPARC Lynx seems to start dumping
				  the .data section at a page
				  boundary.  It's OK to check a
				  #define like SPARC here because this
				  file can only be compiled on a Lynx
				  host.  */
			       + pss.data_start % pagesize
#endif
			       );
  if (!newsect)
    goto fail;

/* And, now for the .reg/XXX pseudo sections.  Each thread has it's own
   .reg/XXX section, where XXX is the thread id (without leading zeros).  The
   currently running thread (at the time of the core dump) also has an alias
   called `.reg' (just to keep GDB happy).  Note that we use `.reg/XXX' as
   opposed to `.regXXX' because GDB expects that .reg2 will be the floating-
   point registers.  */

  newsect = make_bfd_asection (abfd, ".reg",
			       SEC_HAS_CONTENTS,
			       sizeof (core_st_t),
			       0,
			       pagesize);
  if (!newsect)
    goto fail;

  for (secnum = 0; secnum < pss.threadcnt; secnum++)
    {
      char secname[100];

      sprintf (secname, ".reg/%d", BUILDPID (0, threadp[secnum].tid));
      newsect = make_bfd_asection (abfd, secname,
				   SEC_HAS_CONTENTS,
				   sizeof (core_st_t),
				   0,
				   pagesize + secnum * sizeof (core_st_t));
      if (!newsect)
	goto fail;
    }

  return abfd->xvec;

 fail:
  bfd_release (abfd, core_hdr (abfd));
  core_hdr (abfd) = NULL;
  bfd_section_list_clear (abfd);
  return NULL;
}
Beispiel #7
0
static const bfd_target *
osf_core_core_file_p (bfd *abfd)
{
    int val;
    int i;
    char *secname;
    struct core_filehdr core_header;
    bfd_size_type amt;

    amt = sizeof core_header;
    val = bfd_bread (& 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 (& 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;
}
Beispiel #8
0
int
rs6000coff_core_file_failing_signal (bfd *abfd)
{
  CoreHdr *core = core_hdr (abfd);
  return CORE_NEW (*core) ? core->new_dump.c_signo : core->old.c_signo;
}