This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: readelf -S and long section name
On Mon, Jul 28, 2003 at 10:21:13AM -0700, H. J. Lu wrote:
> On Mon, Jul 28, 2003 at 05:45:51PM +0100, Nick Clifton wrote:
> > Hi H.J.
> >
> > > readelf -S won't display the full section name if it is longer than
> > > certain chars. Sometimes, I want to know the full section name. Is
> > > there a switch to do that?
> >
> > At the moment no, although this is something that ought to be enabled
> > with the --wide switch.
> >
>
> Like this?
>
>
> H.J.
> ----
> 2003-07-28 H.J. Lu <hongjiu.lu@intel.com>
>
> * readelf.c (process_section_headers): Print out the full
> section name if do_wide is not zero.
>
> --- binutils/readelf.c.wide 2003-07-07 07:12:00.000000000 -0700
> +++ binutils/readelf.c 2003-07-28 10:17:48.000000000 -0700
> @@ -3872,10 +3872,16 @@ process_section_headers (file)
> i < elf_header.e_shnum;
> i++, section++)
> {
> - printf (" [%2u] %-17.17s %-15.15s ",
> - SECTION_HEADER_NUM (i),
> - SECTION_NAME (section),
> - get_section_type_name (section->sh_type));
> + if (do_wide)
> + printf (" [%2u] %-17s %-15.15s ",
> + SECTION_HEADER_NUM (i),
> + SECTION_NAME (section),
> + get_section_type_name (section->sh_type));
> + else
> + printf (" [%2u] %-17.17s %-15.15s ",
> + SECTION_HEADER_NUM (i),
> + SECTION_NAME (section),
> + get_section_type_name (section->sh_type));
>
> if (is_32bit_elf)
> {
As section name is in second, not last column, I think it would be better
to compute maximum section name length and move the remaining columns to the
right if there is any section with name longer than 17 chars.
Jakub