Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This port currently only handles reading object files, except when
compiled on an RS/6000 host. -- no archive support, no core files.
/* Return the c_impl field from struct core_dumpx C. */
-#ifdef AIX_CORE_DUMPX_CORE
+#if defined (HAVE_ST_C_IMPL) || defined (AIX_5_CORE)
# define CNEW_IMPL(c) (c).c_impl
#else
# define CNEW_IMPL(c) 0
/* Try to read into CORE the header from the core file associated with ABFD.
Return success. */
-static boolean
+static bfd_boolean
read_hdr (bfd *abfd, CoreHdr *core)
{
bfd_size_type size;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return false;
+ return FALSE;
/* Read the leading portion that old and new core dump structures have in
common. */
size = CORE_COMMONSZ;
if (bfd_bread (core, size, abfd) != size)
- return false;
+ return FALSE;
/* Read the trailing portion of the structure. */
if (CORE_NEW (*core))
return NULL;
}
-/* Return `true' if given core is from the given executable. */
+/* Return `TRUE' if given core is from the given executable. */
-boolean
+bfd_boolean
rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd;
bfd *exec_bfd;
char *path, *s;
size_t alloc;
const char *str1, *str2;
- boolean ret;
+ bfd_boolean ret;
file_ptr c_loader;
if (!read_hdr (core_bfd, &core))
- return false;
+ return FALSE;
if (CORE_NEW (core))
c_loader = CNEW_LOADER (core.new);
size = (int) ((LdInfo *) 0)->l32.ldinfo_filename;
if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
- return false;
+ return FALSE;
alloc = 100;
path = bfd_malloc ((bfd_size_type) alloc);
if (path == NULL)
- return false;
+ return FALSE;
s = path;
while (1)
if (bfd_bread (s, (bfd_size_type) 1, core_bfd) != 1)
{
free (path);
- return false;
+ return FALSE;
}
if (*s == '\0')
break;
if (n == NULL)
{
free (path);
- return false;
+ return FALSE;
}
s = n + (path - s);
path = n;
str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;
if (strcmp (str1, str2) == 0)
- ret = true;
+ ret = TRUE;
else
- ret = false;
+ ret = FALSE;
free (path);