OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [bfd/] [rs6000-core.c] - Diff between revs 157 and 225

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 157 Rev 225
Line 1... Line 1...
/* IBM RS/6000 "XCOFF" back-end for BFD.
/* IBM RS/6000 "XCOFF" back-end for BFD.
   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
   2001, 2002, 2004, 2006, 2007
   2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
   Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
   Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
   Archive support from Damon A. Permezel.
   Archive support from Damon A. Permezel.
   Contributed by IBM Corporation and Cygnus Support.
   Contributed by IBM Corporation and Cygnus Support.
 
 
Line 105... Line 105...
 
 
/* Union of old and new core dump structures.  */
/* Union of old and new core dump structures.  */
 
 
typedef union {
typedef union {
#ifdef AIX_CORE_DUMPX_CORE
#ifdef AIX_CORE_DUMPX_CORE
  struct core_dumpx new;        /* new AIX 4.3+ core dump */
  struct core_dumpx new_dump;   /* new AIX 4.3+ core dump */
#else
#else
  struct core_dump new;         /* for simpler coding */
  struct core_dump new_dump;            /* for simpler coding */
#endif
#endif
  struct core_dump old;         /* old AIX 4.2- core dump, still used on
  struct core_dump old;         /* old AIX 4.2- core dump, still used on
                                   4.3+ with appropriate SMIT config */
                                   4.3+ with appropriate SMIT config */
} CoreHdr;
} CoreHdr;
 
 
/* Union of old and new vm_info structures.  */
/* Union of old and new vm_info structures.  */
 
 
#ifdef CORE_VERSION_1
#ifdef CORE_VERSION_1
typedef union {
typedef union {
#ifdef AIX_CORE_DUMPX_CORE
#ifdef AIX_CORE_DUMPX_CORE
  struct vm_infox new;
  struct vm_infox new_dump;
#else
#else
  struct vm_info new;
  struct vm_info new_dump;
#endif
#endif
  struct vm_info old;
  struct vm_info old;
} VmInfo;
} VmInfo;
#endif
#endif
 
 
Line 134... Line 134...
# define CORE_NEW(c)    (!(c).old.c_entries)
# define CORE_NEW(c)    (!(c).old.c_entries)
#else
#else
# define CORE_NEW(c)    0
# define CORE_NEW(c)    0
#endif
#endif
 
 
 
/* Return whether CoreHdr C usese core_dumpxx structure.
 
 
 
   FIXME: the core file format version number used here definitely indicates
 
   that struct core_dumpxx should be used to represent the core file header,
 
   but that may not be the only such format version number.  */
 
 
 
#ifdef AIX_5_CORE
 
# define CORE_DUMPXX_VERSION    267312562
 
# define CNEW_IS_CORE_DUMPXX(c) ((c).new_dump.c_version == CORE_DUMPXX_VERSION)
 
#else
 
# define CNEW_IS_CORE_DUMPXX(c) 0
 
#endif
 
 
/* Return the c_stackorg field from struct core_dumpx C.  */
/* Return the c_stackorg field from struct core_dumpx C.  */
 
 
#ifdef AIX_CORE_DUMPX_CORE
#ifdef AIX_CORE_DUMPX_CORE
# define CNEW_STACKORG(c)       (c).c_stackorg
# define CNEW_STACKORG(c)       (c).c_stackorg
#else
#else
Line 276... Line 289...
  if (bfd_bread (core, size, abfd) != size)
  if (bfd_bread (core, size, abfd) != size)
    return FALSE;
    return FALSE;
 
 
  /* Read the trailing portion of the structure.  */
  /* Read the trailing portion of the structure.  */
  if (CORE_NEW (*core))
  if (CORE_NEW (*core))
    size = sizeof (core->new);
    size = sizeof (core->new_dump);
  else
  else
    size = sizeof (core->old);
    size = sizeof (core->old);
  size -= CORE_COMMONSZ;
  size -= CORE_COMMONSZ;
  return bfd_bread ((char *) core + CORE_COMMONSZ, size, abfd) == size;
  return bfd_bread ((char *) core + CORE_COMMONSZ, size, abfd) == size;
}
}
Line 327... Line 340...
      if (bfd_get_error () != bfd_error_system_call)
      if (bfd_get_error () != bfd_error_system_call)
        bfd_set_error (bfd_error_wrong_format);
        bfd_set_error (bfd_error_wrong_format);
      return NULL;
      return NULL;
    }
    }
 
 
 
  /* This isn't the right handler for 64-bit core files on AIX 5.x.  */
 
  if (CORE_NEW (core) && CNEW_IS_CORE_DUMPXX (core))
 
    {
 
      bfd_set_error (bfd_error_wrong_format);
 
      return NULL;
 
    }
 
 
  /* Copy fields from new or old core structure.  */
  /* Copy fields from new or old core structure.  */
  if (CORE_NEW (core))
  if (CORE_NEW (core))
    {
    {
      c_flag = core.new.c_flag;
      c_flag = core.new_dump.c_flag;
      c_stack = (file_ptr) core.new.c_stack;
      c_stack = (file_ptr) core.new_dump.c_stack;
      c_size = core.new.c_size;
      c_size = core.new_dump.c_size;
      c_stackend = CNEW_STACKORG (core.new) + c_size;
      c_stackend = CNEW_STACKORG (core.new_dump) + c_size;
      c_lsize = CNEW_LSIZE (core.new);
      c_lsize = CNEW_LSIZE (core.new_dump);
      c_loader = CNEW_LOADER (core.new);
      c_loader = CNEW_LOADER (core.new_dump);
      proc64 = CNEW_PROC64 (core.new);
      proc64 = CNEW_PROC64 (core.new_dump);
    }
    }
  else
  else
    {
    {
      c_flag = core.old.c_flag;
      c_flag = core.old.c_flag;
      c_stack = (file_ptr) (ptr_to_uint) core.old.c_stack;
      c_stack = (file_ptr) (ptr_to_uint) core.old.c_stack;
Line 351... Line 371...
      proc64 = 0;
      proc64 = 0;
    }
    }
 
 
  if (proc64)
  if (proc64)
    {
    {
      c_regsize = sizeof (CNEW_CONTEXT64 (core.new));
      c_regsize = sizeof (CNEW_CONTEXT64 (core.new_dump));
      c_regptr = &CNEW_CONTEXT64 (core.new);
      c_regptr = &CNEW_CONTEXT64 (core.new_dump);
    }
    }
  else if (CORE_NEW (core))
  else if (CORE_NEW (core))
    {
    {
      c_regsize = sizeof (CNEW_MSTSAVE (core.new));
      c_regsize = sizeof (CNEW_MSTSAVE (core.new_dump));
      c_regptr = &CNEW_MSTSAVE (core.new);
      c_regptr = &CNEW_MSTSAVE (core.new_dump);
    }
    }
  else
  else
    {
    {
      c_regsize = sizeof (COLD_MSTSAVE (core.old));
      c_regsize = sizeof (COLD_MSTSAVE (core.old));
      c_regptr = &COLD_MSTSAVE (core.old);
      c_regptr = &COLD_MSTSAVE (core.old);
Line 427... Line 447...
  if (c_flag & CORE_TRUNC)
  if (c_flag & CORE_TRUNC)
    (*_bfd_error_handler) (_("%s: warning core file truncated"),
    (*_bfd_error_handler) (_("%s: warning core file truncated"),
                           bfd_get_filename (abfd));
                           bfd_get_filename (abfd));
 
 
  /* Allocate core file header.  */
  /* Allocate core file header.  */
  size = CORE_NEW (core) ? sizeof (core.new) : sizeof (core.old);
  size = CORE_NEW (core) ? sizeof (core.new_dump) : sizeof (core.old);
  tmpptr = (char *) bfd_zalloc (abfd, (bfd_size_type) size);
  tmpptr = (char *) bfd_zalloc (abfd, (bfd_size_type) size);
  if (!tmpptr)
  if (!tmpptr)
    return NULL;
    return NULL;
 
 
  /* Copy core file header.  */
  /* Copy core file header.  */
Line 442... Line 462...
  if (CORE_NEW (core))
  if (CORE_NEW (core))
    {
    {
      enum bfd_architecture arch;
      enum bfd_architecture arch;
      unsigned long mach;
      unsigned long mach;
 
 
      switch (CNEW_IMPL (core.new))
      switch (CNEW_IMPL (core.new_dump))
        {
        {
        case POWER_RS1:
        case POWER_RS1:
        case POWER_RSC:
        case POWER_RSC:
        case POWER_RS2:
        case POWER_RS2:
          arch = bfd_arch_rs6000;
          arch = bfd_arch_rs6000;
Line 515... Line 535...
    bfd_size_type c_datasize, c_vmregions;
    bfd_size_type c_datasize, c_vmregions;
    file_ptr c_data, c_vmm;
    file_ptr c_data, c_vmm;
 
 
    if (CORE_NEW (core))
    if (CORE_NEW (core))
      {
      {
        c_datasize = CNEW_DATASIZE (core.new);
        c_datasize = CNEW_DATASIZE (core.new_dump);
        c_data = (file_ptr) core.new.c_data;
        c_data = (file_ptr) core.new_dump.c_data;
        c_vmregions = core.new.c_vmregions;
        c_vmregions = core.new_dump.c_vmregions;
        c_vmm = (file_ptr) core.new.c_vmm;
        c_vmm = (file_ptr) core.new_dump.c_vmm;
      }
      }
    else
    else
      {
      {
        c_datasize = core.old.c_datasize;
        c_datasize = core.old.c_datasize;
        c_data = (file_ptr) (ptr_to_uint) core.old.c_data;
        c_data = (file_ptr) (ptr_to_uint) core.old.c_data;
Line 593... Line 613...
            VmInfo vminfo;
            VmInfo vminfo;
            bfd_size_type vminfo_size;
            bfd_size_type vminfo_size;
            file_ptr vminfo_offset;
            file_ptr vminfo_offset;
            bfd_vma vminfo_addr;
            bfd_vma vminfo_addr;
 
 
            size = CORE_NEW (core) ? sizeof (vminfo.new) : sizeof (vminfo.old);
            size = CORE_NEW (core) ? sizeof (vminfo.new_dump) : sizeof (vminfo.old);
            if (bfd_bread (&vminfo, size, abfd) != size)
            if (bfd_bread (&vminfo, size, abfd) != size)
              goto fail;
              goto fail;
 
 
            if (CORE_NEW (core))
            if (CORE_NEW (core))
              {
              {
                vminfo_addr = (bfd_vma) vminfo.new.vminfo_addr;
                vminfo_addr = (bfd_vma) vminfo.new_dump.vminfo_addr;
                vminfo_size = vminfo.new.vminfo_size;
                vminfo_size = vminfo.new_dump.vminfo_size;
                vminfo_offset = vminfo.new.vminfo_offset;
                vminfo_offset = vminfo.new_dump.vminfo_offset;
              }
              }
            else
            else
              {
              {
                vminfo_addr = (bfd_vma) (long) vminfo.old.vminfo_addr;
                vminfo_addr = (bfd_vma) (long) vminfo.old.vminfo_addr;
                vminfo_size = vminfo.old.vminfo_size;
                vminfo_size = vminfo.old.vminfo_size;
Line 647... Line 667...
 
 
  if (!read_hdr (core_bfd, &core))
  if (!read_hdr (core_bfd, &core))
    return FALSE;
    return FALSE;
 
 
  if (CORE_NEW (core))
  if (CORE_NEW (core))
    c_loader = CNEW_LOADER (core.new);
    c_loader = CNEW_LOADER (core.new_dump);
  else
  else
    c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old);
    c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old);
 
 
  if (CORE_NEW (core) && CNEW_PROC64 (core.new))
  if (CORE_NEW (core) && CNEW_PROC64 (core.new_dump))
    size = (int) ((LdInfo *) 0)->l64.ldinfo_filename;
    size = (int) ((LdInfo *) 0)->l64.ldinfo_filename;
  else
  else
    size = (int) ((LdInfo *) 0)->l32.ldinfo_filename;
    size = (int) ((LdInfo *) 0)->l32.ldinfo_filename;
 
 
  if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
  if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
Line 713... Line 733...
char *
char *
rs6000coff_core_file_failing_command (bfd *abfd)
rs6000coff_core_file_failing_command (bfd *abfd)
{
{
  CoreHdr *core = core_hdr (abfd);
  CoreHdr *core = core_hdr (abfd);
  char *com = CORE_NEW (*core) ?
  char *com = CORE_NEW (*core) ?
    CNEW_COMM (core->new) : COLD_COMM (core->old);
    CNEW_COMM (core->new_dump) : COLD_COMM (core->old);
 
 
  if (*com)
  if (*com)
    return com;
    return com;
  else
  else
    return 0;
    return 0;
Line 725... Line 745...
 
 
int
int
rs6000coff_core_file_failing_signal (bfd *abfd)
rs6000coff_core_file_failing_signal (bfd *abfd)
{
{
  CoreHdr *core = core_hdr (abfd);
  CoreHdr *core = core_hdr (abfd);
  return CORE_NEW (*core) ? core->new.c_signo : core->old.c_signo;
  return CORE_NEW (*core) ? core->new_dump.c_signo : core->old.c_signo;
}
}
 
 
#endif /* AIX_CORE */
#endif /* AIX_CORE */
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.