This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: long long considered harmful?
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Kris Warkentin <kewarken at qnx dot com>
- Cc: gdb at sources dot redhat dot com
- Date: Tue, 22 Apr 2003 13:45:22 -0400
- Subject: Re: long long considered harmful?
- References: <076701c308f6$2f017eb0$0202040a@catdog>
On Tue, Apr 22, 2003 at 01:39:53PM -0400, Kris Warkentin wrote:
> Below is a clipping from our debug.h header which defines the register
> structures for QNX Neutrino. I've been in conversation with Mark Kettenis
> about our gdb submission and it looks like portability issues in this header
> are one of the few remaining stumbling blocks, at least from his
> perspective. I guess that conceivably some older systems might not be able
> to deal with a 64 bit int type. The question I want to ask is, "how do I
> deal with this in a portable way?"
>
> I don't believe that any of these structures are ever manipulated in any way
> other than to read/write bytes of data into and out of them. Would it be
> best just to define any long long members as arrays of char? It doesn't
> seem very pretty but it would certainly do the trick.
>
> ie. "char u64[8]" instead of "long long u64" is fine but "char gpr_hi[32 *
> 8]" instead of "long long gpr_hi[32]" seems a bit nasty.
>
> comments?
Several things come to my eye as problems here:
> >>>>>>>>>>>>>debug.h clip<<<<<<<<<<<<<<<<<<<<<
> 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.
> 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.
> #ifdef __BIGREGS__
Eh?
> typedef union
> {
> unsigned long long u64[2];
> unsigned u32[4];
> unsigned char u8[16];
> float f32[4];
> } ppcvmx;
As above.
I recommend something like 'typedef char qnx_reg64[8];'; then you can
still say 'qnx_reg64 gpr[32]' and get the right result.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer