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: [RFA] gdbtypes.[ch] rs6000-tdep.c--AltiVec regs types


Andrew Cagney writes:
 > Your post prompted me to dig.  It is just that I kind of regret this 
 > exposure of a GCC internal naming convention (SI, QI, FI, HI, ...) to 
 > the innocent end user.  Is the convention really set in stone or can we 
 > reform our ways? :-)

Actually I wish we could make it more readable. Or at least add some
comments in gdbtypes.c. Or some intenal doco. 

 > 
 > The relevant thread is:
 > http://sources.redhat.com/ml/gdb-patches/1999-q4/msg00316.html
 > 

Was this discussion a precursor to Pseudoregs? It reads that way.

 > As an aside, it did take a few years but there are now both more 
 > explicit builtin fp types (see builtin_type_ieee ...); and implemented 
 > the virtual to raw register mapping the thread talks about for MMX.  The 
 > i386 MMX registers can finally be implemented as (looks in sandpit, for 
 > wip code):
 > 
 > static void
 > i386_register_read (struct gdbarch *gdbarch, int regnum, char *buf)
 > {
 >    if (is_mmx_regnum (regnum))
 >      {
 >        char *mmx_buf = alloca (MAX_REGISTER_RAW_SIZE);
 >        int fpnum = mmnum_to_fpnum (regnum);
 >        regcache_read (fpnum, mmx_buf);
 >        /* Extract (always little endian).  */
 >        memcpy (buf, mmx_buf, REGISTER_RAW_SIZE (regnum));
 >      }
 >    else
 >      regcache_read (regnum, buf);
 > }
 > 
 > (probably time to submit that patch).
 > 
 > 
 > Anyway, regarding your patch, perhaps move the construct to 
 > gdbtypes.[hc] to encourage its re-use by other Altivecish targets.
 > 

Ah, I see, there are other target specific types in there.

 > Andrew
 > 
 > PS: Check the man page for [x]calloc() GDB could benefit from its use.
 > 
 > 
 > 
 > Two questions.  
 > 
 > > +static struct type *
 > > +build_builtin_type_powerpc_altivec (void)
 > > +{
 > > +  /* Construct a type for the AltiVec registers.  The type we're building
 > > +     is this: */
 > > +#if 0
 > > +  union __gdb_builtin_type_powerpc_altivec
 > > +  {
 > > +    struct __builtin_v16qi v16qi;
 > > +    struct __builtin_v8hi v8hi;
 > > +    struct __builtin_v4si v4si;
 > > +    struct __builtin_v4sf v4sf;
 > > +    uint128_t uint128;
 > > +  };
 > > +#endif
 > > +
 > > +  struct type *t;
 > > +  struct field *f;
 > > +
 > > +  f = (struct field *) xmalloc (sizeof (*f) * 5);
 > > +  memset (f, 0, sizeof (*f) * 5);
 > > +
 > > +  FIELD_TYPE (f[0]) = builtin_type_int128;
 > > +  FIELD_NAME (f[0]) = "uint128";
 > > +
 > > +  FIELD_TYPE (f[1]) = builtin_type_v4sf;
 > > +  FIELD_NAME (f[1]) = "v4sf";
 > > +
 > > +  FIELD_TYPE (f[2]) = builtin_type_v4si;
 > > +  FIELD_NAME (f[2]) = "v4si";
 > > +
 > > +  FIELD_TYPE (f[3]) = builtin_type_v8hi;
 > > +  FIELD_NAME (f[3]) = "v8hi";
 > > +
 > > +  FIELD_TYPE (f[4]) = builtin_type_v16qi;
 > > +  FIELD_NAME (f[4]) = "v16qi";
 > > +
 > > +  /* Build a union type with those fields.  */
 > > +  t = init_type (TYPE_CODE_UNION, 16, 0, 0, 0);
 > > +  TYPE_NFIELDS (t) = 5;
 > > +  TYPE_FIELDS (t) = f;
 > > +  TYPE_TAG_NAME (t) = "__gdb_builtin_type_powerpc_altivec";
 > > +
 > > +  return t;
 > > +}
 > > +
 > > 
 > 


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