/[gcl]/gcl/binutils/bfd/rs6000-core.c
ViewVC logotype

Diff of /gcl/binutils/bfd/rs6000-core.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by camm, Fri Aug 9 05:35:43 2002 UTC revision 1.1.1.1.20.1 by camm, Fri Sep 30 02:09:06 2005 UTC
# Line 1  Line 1 
1  /* IBM RS/6000 "XCOFF" back-end for BFD.  /* IBM RS/6000 "XCOFF" back-end for BFD.
2     Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,     Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
3     2001, 2002     2001, 2002, 2004
4     Free Software Foundation, Inc.     Free Software Foundation, Inc.
5     FIXME: Can someone provide a transliteration of this name into ASCII?     FIXME: Can someone provide a transliteration of this name into ASCII?
6     Using the following chars caused a compiler warning on HIUX (so I replaced     Using the following chars caused a compiler warning on HIUX (so I replaced
# Line 253  typedef union { Line 253  typedef union {
253  /* Try to read into CORE the header from the core file associated with ABFD.  /* Try to read into CORE the header from the core file associated with ABFD.
254     Return success.  */     Return success.  */
255    
256  static boolean  static bfd_boolean
257  read_hdr (bfd *abfd, CoreHdr *core)  read_hdr (bfd *abfd, CoreHdr *core)
258  {  {
259    bfd_size_type size;    bfd_size_type size;
260    
261    if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)    if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
262      return false;      return FALSE;
263    
264    /* Read the leading portion that old and new core dump structures have in    /* Read the leading portion that old and new core dump structures have in
265       common.  */       common.  */
266    size = CORE_COMMONSZ;    size = CORE_COMMONSZ;
267    if (bfd_bread (core, size, abfd) != size)    if (bfd_bread (core, size, abfd) != size)
268      return false;      return FALSE;
269    
270    /* Read the trailing portion of the structure.  */    /* Read the trailing portion of the structure.  */
271    if (CORE_NEW (*core))    if (CORE_NEW (*core))
# Line 277  read_hdr (bfd *abfd, CoreHdr *core) Line 277  read_hdr (bfd *abfd, CoreHdr *core)
277  }  }
278    
279  static asection *  static asection *
280  make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)  make_bfd_asection (abfd, name, flags, size, vma, filepos)
281       bfd *abfd;       bfd *abfd;
282       const char *name;       const char *name;
283       flagword flags;       flagword flags;
284       bfd_size_type _raw_size;       bfd_size_type size;
285       bfd_vma vma;       bfd_vma vma;
286       file_ptr filepos;       file_ptr filepos;
287  {  {
# Line 292  make_bfd_asection (abfd, name, flags, _r Line 292  make_bfd_asection (abfd, name, flags, _r
292      return NULL;      return NULL;
293    
294    asect->flags = flags;    asect->flags = flags;
295    asect->_raw_size = _raw_size;    asect->size = size;
296    asect->vma = vma;    asect->vma = vma;
297    asect->filepos = filepos;    asect->filepos = filepos;
298    asect->alignment_power = 8;    asect->alignment_power = 8;
# Line 630  rs6000coff_core_p (abfd) Line 630  rs6000coff_core_p (abfd)
630    return NULL;    return NULL;
631  }  }
632    
633  /* Return `true' if given core is from the given executable.  */  /* Return `TRUE' if given core is from the given executable.  */
634    
635  boolean  bfd_boolean
636  rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)  rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
637       bfd *core_bfd;       bfd *core_bfd;
638       bfd *exec_bfd;       bfd *exec_bfd;
# Line 642  rs6000coff_core_file_matches_executable_ Line 642  rs6000coff_core_file_matches_executable_
642    char *path, *s;    char *path, *s;
643    size_t alloc;    size_t alloc;
644    const char *str1, *str2;    const char *str1, *str2;
645    boolean ret;    bfd_boolean ret;
646    file_ptr c_loader;    file_ptr c_loader;
647    
648    if (!read_hdr (core_bfd, &core))    if (!read_hdr (core_bfd, &core))
649      return false;      return FALSE;
650    
651    if (CORE_NEW (core))    if (CORE_NEW (core))
652      c_loader = CNEW_LOADER (core.new);      c_loader = CNEW_LOADER (core.new);
# Line 659  rs6000coff_core_file_matches_executable_ Line 659  rs6000coff_core_file_matches_executable_
659      size = (int) ((LdInfo *) 0)->l32.ldinfo_filename;      size = (int) ((LdInfo *) 0)->l32.ldinfo_filename;
660    
661    if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)    if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
662      return false;      return FALSE;
663    
664    alloc = 100;    alloc = 100;
665    path = bfd_malloc ((bfd_size_type) alloc);    path = bfd_malloc ((bfd_size_type) alloc);
666    if (path == NULL)    if (path == NULL)
667      return false;      return FALSE;
668    s = path;    s = path;
669    
670    while (1)    while (1)
# Line 672  rs6000coff_core_file_matches_executable_ Line 672  rs6000coff_core_file_matches_executable_
672        if (bfd_bread (s, (bfd_size_type) 1, core_bfd) != 1)        if (bfd_bread (s, (bfd_size_type) 1, core_bfd) != 1)
673          {          {
674            free (path);            free (path);
675            return false;            return FALSE;
676          }          }
677        if (*s == '\0')        if (*s == '\0')
678          break;          break;
# Line 686  rs6000coff_core_file_matches_executable_ Line 686  rs6000coff_core_file_matches_executable_
686            if (n == NULL)            if (n == NULL)
687              {              {
688                free (path);                free (path);
689                return false;                return FALSE;
690              }              }
691            s = n + (path - s);            s = n + (path - s);
692            path = n;            path = n;
# Line 701  rs6000coff_core_file_matches_executable_ Line 701  rs6000coff_core_file_matches_executable_
701    str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;    str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;
702    
703    if (strcmp (str1, str2) == 0)    if (strcmp (str1, str2) == 0)
704      ret = true;      ret = TRUE;
705    else    else
706      ret = false;      ret = FALSE;
707    
708    free (path);    free (path);
709    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.1.20.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26