[PATCH] gcc-gdb-test.exp: Handle old GDB "short int" and "long int" types.

Jakub Jelinek jakub@redhat.com
Mon Sep 22 10:05:00 GMT 2014


On Sat, Sep 20, 2014 at 11:21:25PM +0200, Mark Wielaard wrote:
> Old GDB might show short and long as short int and long int. This made 
> gcc.dg/guality/const-volatile.c ans restrict.c fail on older GDBs.
> According to the patch that changed this in newer versions of GDB
> this was a bug: https://sourceware.org/ml/gdb-patches/2012-09/msg00455.html
> 
> The patch transforms the types "short int" and "long int" coming from
> GDB to plain "short" and "long". And a variant has been added to the
> const-volatile.c testcase to make sure short and long long are handled
> correctly now with older GDB.
> 
> Tested against GDB 7.7.1 and 7.4.50.
> 
> gcc/testsuite/ChangeLog
> 
> 	* lib/gcc-gdb-test.exp (gdb-test): Transform gdb types "short int"
> 	and "long int" to plain "short" and "long".
> 	* gcc.dg/guality/const-volatile.c (struct bar): New struct
> 	containing short and long long fields.
> 	(bar): New variable to test the type.

Ok, with a minor nit:

> --- a/gcc/testsuite/lib/gcc-gdb-test.exp
> +++ b/gcc/testsuite/lib/gcc-gdb-test.exp
> @@ -111,6 +111,10 @@ proc gdb-test { args } {
>  	    # Squash all extra whitespace/newlines that gdb might use for
>  	    # "pretty printing" into one so result is just one line.
>  	    regsub -all {[\n\r\t ]+} $type " " type
> +	    # Old gdb might output "long int" instead of just "long"
> +	    # and "short int" instead of just "short". Canonicalize.
> +            regsub -all {\mlong int\M} $type "long" type
> +            regsub -all {\mshort int\M} $type "short" type

Please fix whitespace on the above 2 lines, should be tab + 4 spaces
instead of 12 spaces.

	Jakub



More information about the Gcc-patches mailing list