Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@is.elta.co.il>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Denis Joseph Barrow <DJBARROW@de.ibm.com>,
	gdb-patches@sourceware.cygnus.com, s390-patches@gnu.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: New gdb 31 & 64 bit patches for S/390
Date: Sun, 08 Jul 2001 00:53:00 -0000	[thread overview]
Message-ID: <Pine.SUN.3.91.1010708105329.24414B-100000@is> (raw)
In-Reply-To: <3B44C429.8090007@cygnus.com>

On Thu, 5 Jul 2001, Andrew Cagney wrote:

> > What about using the __attribute__(packed) gcc extension.
> > & add a
> > #ifndef gcc
> > define __attribute__
> > #endif
> 
> No.  So far GDB has managed to avoid a dependency on GCCoteric features, 
> I don't see any reason to change this.
> 
> With regard to the other target specific structures, I suggested moving 
> them to s390-nat.c since (I think) only that file would be using them 
> (?correct). s390-nat.c is very host=target specific - it needs to 
> correctly unpack the data returned from ptrace/procfs.  However, even 
> there, the __attribute__(packed) should be removed.

If taken at face value, IMHO this is too harsh to the developers.

I agree that compiler-specific extensions should be kept at the bare
minimum, but why are you opposed to __attribute__((packed)) in native
files?  Some functionality is impossible to get right without that.
How else can I define a struct which fits some external OS data
structure which is not under my control?  The only way I know of is to
use a char array with ugly, hand-computed, error-prone offsets into it
and lots of type casts to fetch and store data there.  Do we really
want that kind of ugliness in GDB?

For example, here's a definition of an ia32 segment descriptor:

    struct seg_descr {
      unsigned short limit0          __attribute__((packed));
      unsigned short base0           __attribute__((packed));
      unsigned char  base1           __attribute__((packed));
      unsigned       stype:5         __attribute__((packed));
      unsigned       dpl:2           __attribute__((packed));
      unsigned       present:1       __attribute__((packed));
      unsigned       limit1:4        __attribute__((packed));
      unsigned       available:1     __attribute__((packed));
      unsigned       dummy:1         __attribute__((packed));
      unsigned       bit32:1         __attribute__((packed));
      unsigned       page_granular:1 __attribute__((packed));
      unsigned char  base2           __attribute__((packed));
    };

How do I define something like that without packing, and make sure it
works with any version of GCC, past and future?

It's clear that something like this can only be put into a native file
which is only compiled by GCC.  But given that those constraints are
satisfied, what's the problem with having this in GDB?


  reply	other threads:[~2001-07-08  0:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-05 10:24 Denis Joseph Barrow
2001-07-05 12:46 ` Andrew Cagney
2001-07-08  0:53   ` Eli Zaretskii [this message]
2001-07-08 19:23     ` Andrew Cagney
     [not found] <OFEFF0AD94.761C34C1-ONC1256AB6.005503EE@de.ibm.com>
2001-08-28 16:33 ` Daniel Jacobowitz
2001-09-05 21:45   ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2001-08-15  2:22 Denis Joseph Barrow
2001-08-15  9:03 ` Andrew Cagney
2001-08-15  9:54 ` Andrew Cagney
2001-08-13  9:47 Denis Joseph Barrow
2001-08-13  3:06 Denis Joseph Barrow
2001-08-13  9:31 ` Andrew Cagney
2001-07-06  2:31 Denis Joseph Barrow
2001-07-05  9:19 Denis Joseph Barrow
2001-07-05 12:36 ` Andrew Cagney
2001-07-05  9:15 Denis Joseph Barrow
2001-07-05  5:04 Denis Joseph Barrow
2001-07-05  3:57 Denis Joseph Barrow
2001-07-05 10:11 ` Andrew Cagney
2001-07-05 10:11 ` Andrew Cagney
2001-07-05  3:12 Denis Joseph Barrow
2001-06-18  3:32 DJBARROW
     [not found] <C1256A02.00573066.00@d12mta09.de.ibm.com>
2001-03-01 10:39 ` Nick Clifton
2001-03-01  2:50 DJBARROW
2001-03-01 10:37 ` Nick Clifton
2001-02-27 12:39 DJBARROW
2001-02-28 16:13 ` Nick Clifton
2001-06-15  9:53 ` Andrew Cagney
2001-06-15 11:46   ` Andreas Jaeger
2001-06-15 12:22     ` Andrew Cagney
2001-07-04 11:25 ` Andrew Cagney
2001-07-04 21:02 ` Andrew Cagney
2001-07-04 21:02 ` Andrew Cagney
2001-07-04 21:02 ` Andrew Cagney

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=Pine.SUN.3.91.1010708105329.24414B-100000@is \
    --to=eliz@is.elta.co.il \
    --cc=DJBARROW@de.ibm.com \
    --cc=ac131313@cygnus.com \
    --cc=gdb-patches@sourceware.cygnus.com \
    --cc=s390-patches@gnu.org \
    --cc=schwidefsky@de.ibm.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