public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Kris Warkentin" <kewarken@qnx.com>
To: "Daniel Jacobowitz" <drow@mvista.com>
Cc: <gdb@sources.redhat.com>
Subject: Re: long long considered harmful?
Date: Wed, 23 Apr 2003 13:39:00 -0000	[thread overview]
Message-ID: <096e01c3099d$ba1f3a30$0202040a@catdog> (raw)
In-Reply-To: <20030422193013.GA25488@nevyn.them.org>

> > Pardon me, by overall structure, I mean the starting address of the
> > structure.  Having a 64 bit entry causes the compiler to align the
structure
> > on a 64 bit boundary.
>
> Whoever told you this is mistaken.  A long long member of a structure
> only has four byte alignment on i386-linux, for example.  That's
> mandated by the psABI.
>
> This is exactly one of those reasons why you can not use structures
> on the host to describe data on the target.

I'm not talking about host vs. target here.  These are the structures used
by our Mips and PowerPC kernels.  I believe the mips compiler will do the
alignment as mentioned above.  You are correct that you can't rely on it
being the same on host and target but this is not something that matters in
this case.  All that's important is that when the data comes over the wire,
we can get at it.  In this case, because of the awkward define (data below
is unsigned regs[74]), we wind up extracting the mips registers like so:

static void regset_fetch( int   endian, unsigned first, unsigned last,
unsigned *data )
{
 if( endian) data += 1; /* data in second word for big endian */
 for(; first <= last; ++first) {
  supply_register(first, (char *)data);
  data+=2;
 }
}

I know it's not 100% portable.  I personally don't really care as long as it
works on the hosts that we support.  The only reason I'm asking all this is
because I want to know what level of portability is required for the GDB
project to accept this patch.  I was trying to eliminate the long longs in a
relatively painless way and the char array seems to be not too bad.  Are you
really trying to tell me that gdb wouldn't blow up on a 32 bit char host as
it stands right now?  If you really feel that the only way for me to make
this acceptable is to just use a blob of memory and a table of offsets into
it, then that's what I'll do.  My mandate is to get our stuff accepted so I
don't really have a choice.  (I'd really rather not though. ;-)

cheers,

Kris

  reply	other threads:[~2003-04-23 13:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-22 17:39 Kris Warkentin
2003-04-22 17:45 ` Daniel Jacobowitz
2003-04-22 18:08   ` Kris Warkentin
2003-04-22 18:21     ` Daniel Jacobowitz
2003-04-22 18:41       ` Kris Warkentin
2003-04-22 19:31         ` Daniel Jacobowitz
2003-04-22 19:12   ` Kris Warkentin
2003-04-22 19:25     ` Kris Warkentin
2003-04-22 19:30       ` Daniel Jacobowitz
2003-04-23 13:39         ` Kris Warkentin [this message]
2003-04-23 21:17           ` Daniel Jacobowitz
2003-04-23 21:23             ` Kris Warkentin
2003-04-23 21:44               ` Kris Warkentin
2003-04-23 21:47                 ` Daniel Jacobowitz
2003-04-23 22:09                   ` Kris Warkentin
2003-04-23 22:11                     ` Daniel Jacobowitz
2003-04-23 22:17                       ` Kris Warkentin
2003-04-24 21:05               ` Andrew Cagney
2003-04-24 23:51                 ` Kris Warkentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='096e01c3099d$ba1f3a30$0202040a@catdog' \
    --to=kewarken@qnx.com \
    --cc=drow@mvista.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).