[PATCH] Update ELF auxv entry types and update GDB to use them.

Pedro Alves palves@redhat.com
Thu Feb 27 20:30:00 GMT 2020


On 2/25/20 12:10 PM, Luis Machado wrote:
> I noticed GDB didn't know a particular AT tag (51) when doing some debugging.
> Turns out we're missing a few entries compared to glibc's headers.
> 
> This patch adds them to the ELF include file and GDB.
> 
> include/ChangeLog:
> 
> 	* elf/common.h (AT_L1I_CACHESIZE, AT_L1I_CACHEGEOMETRY,
> 	AT_L1D_CACHESIZE, AT_L1D_CACHEGEOMETRY, AT_L2_CACHESIZE,
> 	AT_L2_CACHEGEOMETRY, AT_L3_CACHESIZE, AT_L3_CACHEGEOMETRY,
> 	AT_MINSIGSTKSZ): New defines, imported from glibc.
> 

The standard says to split lines by closing and reopening parens,
instead of comma.  Like:

	* elf/common.h (AT_L1I_CACHESIZE, AT_L1I_CACHEGEOMETRY)
	(AT_L1D_CACHESIZE, AT_L1D_CACHEGEOMETRY, AT_L2_CACHESIZE)
	(AT_L2_CACHEGEOMETRY, AT_L3_CACHESIZE, AT_L3_CACHEGEOMETRY)
	(AT_MINSIGSTKSZ): New defines, imported from glibc.


> gdb/ChangeLog:
> 
> 	* auxv.c (default_print_auxv_entry): Add new auxv entries.
> ---
>  gdb/auxv.c           | 12 ++++++++++++
>  include/elf/common.h | 15 +++++++++++++++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/gdb/auxv.c b/gdb/auxv.c
> index eb1233527e..e7432e1852 100644
> --- a/gdb/auxv.c
> +++ b/gdb/auxv.c
> @@ -497,6 +497,18 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
>  	   AUXV_FORMAT_HEX);
>        TAG (AT_SUN_CAP_HW2, _("Machine-dependent CPU capability hints 2"),
>  	   AUXV_FORMAT_HEX);
> +      TAG (AT_L1I_CACHESIZE , _("L1 Instruction cache size"), AUXV_FORMAT_HEX);
> +      TAG (AT_L1I_CACHEGEOMETRY , _("L1 Instruction cache geometry"),
> +	   AUXV_FORMAT_HEX);
> +      TAG (AT_L1D_CACHESIZE , _("L1 Data cache size"), AUXV_FORMAT_HEX);
> +      TAG (AT_L1D_CACHEGEOMETRY , _("L1 Data cache geometry"),
> +	   AUXV_FORMAT_HEX);
> +      TAG (AT_L2_CACHESIZE , _("L2 cache size"), AUXV_FORMAT_HEX);
> +      TAG (AT_L2_CACHEGEOMETRY , _("L2 cache geometry"), AUXV_FORMAT_HEX);
> +      TAG (AT_L3_CACHESIZE , _("L3 cache size"), AUXV_FORMAT_HEX);
> +      TAG (AT_L3_CACHEGEOMETRY , _("L3 cache geometry"), AUXV_FORMAT_HEX);
> +      TAG (AT_MINSIGSTKSZ , _("Minimum stack size for signal delivery"),
> +	   AUXV_FORMAT_HEX);

Odd space before comma in all the new lines above.
How about putting these right after AT_L3_CACHESHAPE / 
before the SUN ones?

LGTM with those changes.  But ...

>      }
>  
>    fprint_auxv_entry (file, name, description, format, type, val);
> diff --git a/include/elf/common.h b/include/elf/common.h
> index 53b72445ca..18c898cf6b 100644
> --- a/include/elf/common.h
> +++ b/include/elf/common.h

... "This file is part of BFD, the Binary File Descriptor library."

You should send this part to binutils@.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list