[PATCH] Print vector registers in natural format, not hex

Klee Dienes klee@mit.edu
Fri Oct 4 14:11:00 GMT 2002


On Friday, October 4, 2002, at 04:53 PM, Daniel Jacobowitz wrote:

> Just got one nit.
>
> First of all, in characters
>   v16_int8 = {'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', '@', 'I', 
> '\017', '°', 'Z', '@', '-', '°', 'Z', 'T'}
>
> is more natural to me.  It's a vector of chars, not a string.
>
> Secondly, this is an 'int8' type.  Are characters really the way to go?

Although I agree with you, that's not really a result of this patch, 
but rather long-standing GDB behavior.  The patch is only causing $v1 
to be printed according to its type declaration, which in this case is:

type = union __gdb_builtin_type_vec128 {
     int128_t uint128;
     float v4_float[4];
     int32_t v4_int32[4];
     int16_t v8_int16[8];
     int8_t v16_int8[16];
}

Then the following code in c-valprint.c causes it to be printed as a 
string:

           /* For an array of chars, print with string syntax.  */
           if (eltlen == 1 &&
               ((TYPE_CODE (elttype) == TYPE_CODE_INT)
                || ((current_language->la_language == language_m2)
                    && (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
               && (format == 0 || format == 's'))

You could probably make a good case that arrays of 'int' should be 
printed as you describe, but that's a debate I'll leave to someone else.



More information about the Gdb-patches mailing list