This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: New gdb 31 & 64 bit patches for S/390
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Subject: Re: New gdb 31 & 64 bit patches for S/390
- From: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Date: Sun, 8 Jul 2001 10:55:07 +0300 (IDT)
- cc: Denis Joseph Barrow <DJBARROW at de dot ibm dot com>, gdb-patches at sourceware dot cygnus dot com, s390-patches at gnu dot org, Martin Schwidefsky <schwidefsky at de dot ibm dot 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?