This is the mail archive of the gdb@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: long long considered harmful?


On Tue, Apr 22, 2003 at 02:08:54PM -0400, Kris Warkentin wrote:
> <disclaimer> I didn't write this stuff - it's taken from our system headers
> and reflects the way that the kernel stores registers when you ask it to.
> </disclaimer>
> 
> > > typedef union
> > > {
> > >   unsigned long long u64;
> > >   double f;
> > > } mipsfloat;
> >
> > This is a target entity isn't it?  You've got no business using
> > "double" for a target float.  Use the gdb type mechanism instead.
> 
> Can you point to an example of how this is done?

Check out floatformat_to_doublest.  You may not even need it if you
only pass the data to supply_register...

> > > typedef struct mips_cpu_registers {
> > >   unsigned regs[74];
> > >   unsigned long long regs_alignment;
> > > } MIPS_CPU_REGISTERS;
> >
> > What's the purpose of the alignment entry?  I doubt it does what you
> > want it to.
> 
> I believe it's padding to handle whether we're dealing with a little or big
> endian target.  I'll ask the kernel guys when I find them.  Regardless of
> whether it does anything, the structure has to be the appropriate size for
> the kernel to fill in.  "Mine is not to reason why, mine is just to do or
> die."

We're talking about code in the host now though, right?  You can not
rely on any structure alignment to match.  If any of these must match
target structures, you must use gdbarch and the type mechanism for
them.  See gnu-v3-abi.c for an example; or just define the offsets that
you need.

-- 
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]