From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15745 invoked by alias); 22 Apr 2003 17:45:38 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 15732 invoked from network); 22 Apr 2003 17:45:37 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 22 Apr 2003 17:45:37 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 1981pq-0004on-00; Tue, 22 Apr 2003 12:45:38 -0500 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 1981pa-0000Cw-00; Tue, 22 Apr 2003 13:45:22 -0400 Date: Tue, 22 Apr 2003 17:45:00 -0000 From: Daniel Jacobowitz To: Kris Warkentin Cc: gdb@sources.redhat.com Subject: Re: long long considered harmful? Message-ID: <20030422174522.GA728@nevyn.them.org> Mail-Followup-To: Kris Warkentin , gdb@sources.redhat.com References: <076701c308f6$2f017eb0$0202040a@catdog> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <076701c308f6$2f017eb0$0202040a@catdog> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-04/txt/msg00250.txt.bz2 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