[Patch] XCOFF: add objdump -P ldinfo

Richard Sandiford rsandifo@linux.vnet.ibm.com
Tue Jul 9 15:18:00 GMT 2013


Tristan Gingold <gingold@adacore.com> writes:
> include/coff/
> 2013-07-09  Tristan Gingold  <gingold@adacore.com>
>
> 	* rs6000.h (external_core_dumpx): New structure.
> 	(external_ld_info32): Ditto.
>
>
> binutils/
> 2013-07-09  Tristan Gingold  <gingold@adacore.com>
>
> 	* rs6000.h (external_core_dumpx): New structure.
> 	(external_ld_info32): Ditto.

Second changelog entry needs updating :-)

> @@ -85,6 +87,7 @@ For XCOFF files:\n\
>    typchk      Display type-check section\n\
>    traceback   Display traceback tags\n\
>    toc         Display toc symbols\n\
> +  ldinfo      Display loader info in core files\n\
>  "));
>  }

This should be added to the list in doc/binutils.texi.

> +/* Handle an AIX dumpx core file.  */
> +
> +static void
> +dump_dumpx_core (bfd *abfd, struct external_core_dumpx *hdr)
> +{
> +  if (options[OPT_FILE_HEADER].selected)
> +    {
> +      printf ("  signal:     %u\n", bfd_h_get_8 (abfd, hdr->c_signo));
> +      printf ("  flags:      0x%02x\n", bfd_h_get_8 (abfd, hdr->c_flag));
> +      printf ("  entries:    %u\n",
> +	      (unsigned) bfd_h_get_16 (abfd, hdr->c_entries));
> +#ifdef BFD64
> +      printf ("  fdsinfox:   offset: 0x%08" BFD_VMA_FMT "x\n",
> +	      bfd_h_get_64 (abfd, hdr->c_fdsinfox));
> +      printf ("  loader:     offset: 0x%08" BFD_VMA_FMT "x, "
> +	      "size: 0x%" BFD_VMA_FMT"x\n",
> +	      bfd_h_get_64 (abfd, hdr->c_loader),
> +	      bfd_h_get_64 (abfd, hdr->c_lsize));
> +      printf ("  thr:        offset: 0x%08" BFD_VMA_FMT "x, nbr: %u\n",
> +	      bfd_h_get_64 (abfd, hdr->c_thr),
> +	      (unsigned) bfd_h_get_32 (abfd, hdr->c_n_thr));
> +      printf ("  segregions: offset: 0x%08" BFD_VMA_FMT "x, "
> +	      "nbr: %" BFD_VMA_FMT "u\n",
> +	      bfd_h_get_64 (abfd, hdr->c_segregion),
> +	      bfd_h_get_64 (abfd, hdr->c_segs));
> +      printf ("  stack:      offset: 0x%08" BFD_VMA_FMT "x, "
> +	      "org: 0x%" BFD_VMA_FMT"x, "
> +	      "size: 0x%" BFD_VMA_FMT"x\n",
> +	      bfd_h_get_64 (abfd, hdr->c_stack),
> +	      bfd_h_get_64 (abfd, hdr->c_stackorg),
> +	      bfd_h_get_64 (abfd, hdr->c_size));
> +      printf ("  data:       offset: 0x%08" BFD_VMA_FMT "x, "
> +	      "org: 0x%" BFD_VMA_FMT"x, "
> +	      "size: 0x%" BFD_VMA_FMT"x\n",
> +	      bfd_h_get_64 (abfd, hdr->c_data),
> +	      bfd_h_get_64 (abfd, hdr->c_dataorg),
> +	      bfd_h_get_64 (abfd, hdr->c_datasize));
> +      printf ("  sdata:         org: 0x%" BFD_VMA_FMT"x, "
> +	      "size: 0x%" BFD_VMA_FMT"x\n",
> +	      bfd_h_get_64 (abfd, hdr->c_sdorg),
> +	      bfd_h_get_64 (abfd, hdr->c_sdsize));
> +      printf ("  vmmregions: offset: 0x%" BFD_VMA_FMT"x, "
> +	      "num: 0x%" BFD_VMA_FMT"x\n",
> +	      bfd_h_get_64 (abfd, hdr->c_vmm),
> +	      bfd_h_get_64 (abfd, hdr->c_vmmregions));
> +      printf ("  impl:       0x%08x\n",
> +	      (unsigned) bfd_h_get_32 (abfd, hdr->c_impl));
> +      printf ("  cprs:       0x%" BFD_VMA_FMT "x\n",
> +	      bfd_h_get_64 (abfd, hdr->c_cprs));

I wasn't sure offhand why 0x%08 was used for some lines and not others,
especially with the underlying value being 64 bits.  I'm not asking you
to change it though.  If this looks best then that's fine.

> +      ldr = xmalloc (len);
> +      if (bfd_seek (abfd, off, SEEK_SET) != 0
> +	  || bfd_bread (ldr, len, abfd) != len)
> +	{
> +	  non_fatal (_("cannot read loader info table"));
> +	}

Nit-pick: no braces for a single line.

> +      printf (_("\n"
> +		"ld info dump not supported in 32 bits environments\n"));

Maybe "ldinfo" to be consistent with the option.

OK with those changes, thanks.

Richard



More information about the Binutils mailing list