This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Daniel Jacobowitz writes:
 > On Fri, Oct 04, 2002 at 05:11:27PM -0400, Klee Dienes wrote:
 > > 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.
 > 
 > Ah, you're right.  Thanks for the detail.
 > 

And you haven't noticed this comment in the testfile, I take it :-) I
discovered this while writing the vector support, but didn't fix it. I
don't know that it actually needs to be fixed. It's a feature, not a
bug, one could argue.

# Note: in LE case, the char array is printed WITHOUT the last character.
# Gdb treats the terminating null char in the array like the terminating
# null char in a string and doesn't print it. This is not a failure, but
# the way gdb works.

Elena


 > Otherwise, I like Klee's patch... anyone else?
 > 
 > -- 
 > Daniel Jacobowitz
 > MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]