[RFC][PATCH] Fix AIX core file handling: prevent crashes during GDB quit
Alan Modra
amodra@gmail.com
Wed Mar 25 12:14:11 GMT 2026
On Tue, Mar 24, 2026 at 08:08:36PM +0530, Aditya Vidyadhar Kamath wrote:
> 1. AIX core files store a pointer to 'struct core_dumpxx' in abfd->tdata.any
> 2. COFF object files store a pointer to 'struct coff_data_type' in the same field
Correct. However other COFF/PE core files can be read as for object
files, for instance bfd/coff-x86_64.c has as part of its bfd_target:
/* Note that we allow an object file to be treated as a core file as well. */
{ /* bfd_check_format. */
_bfd_dummy_target,
amd64coff_object_p,
bfd_generic_archive_p,
amd64coff_object_p
},
This means a bfd_core will have the expected coff_data_type for
x86_64, and thus
> 3. The condition checked: (bfd_get_format(abfd) == bfd_object ||
> bfd_get_format(abfd) == bfd_core)
is correct for x86_64 and other targets. xcoff is the odd one out
here. The proper fix will involve an xcoff specific free_cached_info.
void
_bfd_xcoff_bfd_free_cached_info (bfd *abfd)
{
/* xcoff bfd_core does not have a coff_tdata. */
if (bfd_get_format (abfd) == bfd_object)
return _bfd_coff_free_cached_info (abfd);
return _bfd_generic_bfd_free_cached_info (abfd);
}
I have a patch in my tree which I'll push after testing, probably
tomorrow.
--
Alan Modra
More information about the Binutils
mailing list