From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22103 invoked by alias); 26 Sep 2002 03:00:51 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22080 invoked from network); 26 Sep 2002 03:00:47 -0000 Received: from unknown (HELO crushed.velvet.net) (62.49.231.23) by sources.redhat.com with SMTP; 26 Sep 2002 03:00:47 -0000 Received: from aidan by crushed.velvet.net with local (Exim 3.33 #1) id 17uOtQ-00046D-00 for gdb-patches@sources.redhat.com; Thu, 26 Sep 2002 04:00:44 +0100 Date: Wed, 25 Sep 2002 20:00:00 -0000 From: Aidan Skinner To: gdb-patches@sources.redhat.com Subject: [RFA] Add type support for Ada Message-ID: <20020926040044.I32211@velvet.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="uh9ZiVrAOUUm9fzH" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-SW-Source: 2002-09/txt/msg00630.txt.bz2 --uh9ZiVrAOUUm9fzH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 6010 This patch adds some stuff to gdbtypes.h, parse.c, parser-defs.h and valarith.c to support the ada-* files, and provide the infrastructure needed for some of the more intrusive changes that are needed. ChangeLog: * gdbtypes.h (TYPE_FLAG_FIXED_INSTANCE, TYPE_FIXED_INSTANCE) New definitions. (base_type): Declare. * parser-defs.h (add_name_string_cleanup): Declare. * parse.c (name_list): New type. (temp_name_list): New variable. (add_name_string_cleanup): New function. * valarith.c (base_type): New function. Patch: Index: gdbtypes.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/gdbtypes.h,v retrieving revision 1.36 diff -u -r1.36 gdbtypes.h --- gdbtypes.h 14 Sep 2002 02:09:39 -0000 1.36 +++ gdbtypes.h 26 Sep 2002 02:35:55 -0000 @@ -197,7 +197,6 @@ #define TYPE_FLAG_VOLATILE (1 << 6) #define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_VOLATILE) =20 - /* This is a function type which appears to have a prototype. We need this for function calls in order to tell us if it's necessary to coerce the = args, or to just do the standard conversions. This is used with a short fiel= d. */ @@ -253,6 +252,13 @@ #define TYPE_FLAG_VECTOR (1 << 12) #define TYPE_VECTOR(t) (TYPE_FLAGS (t) & TYPE_FLAG_VECTOR) =20 +/* Marks a type that has been created from a template for a + dynamically sized type (e.g., GNAT arrays whose bounds are runtime + quantities). Optionally marks an ordinary, fixed-size GDB type. */ + +#define TYPE_FLAG_FIXED_INSTANCE (1 << 13) +#define TYPE_FIXED_INSTANCE(t) (TYPE_FLAGS (t) & TYPE_FLAG_FIXED_INSTANCE) + struct main_type { /* Code for kind of type */ @@ -335,6 +341,9 @@ For a function or method type, describes the type of the return value. For a range type, describes the type of the full range. For a complex type, describes the type of each coordinate. + For a special record or union type encoding a dynamic-sized type + in GNAT, a memoized pointer to a corresponding static version of + the type. Unused otherwise. */ =20 struct type *target_type; @@ -394,7 +403,10 @@ says how many bytes the field occupies. A value of -1 or -2 indicates a static field; -1 means the location is specified by the label loc.physname; -2 means that loc.physaddr - specifies the actual address. */ + specifies the actual address. + If non-zero in an array type, indicates the element size in + bits (used only in Ada at the moment).=09=20 + */ =20 int bitsize; =20 @@ -1249,5 +1261,8 @@ extern int is_integral_type (struct type *); =20 extern void maintenance_print_type (char *, int); +/* valarith.c */ +=20 +extern struct type* base_type (struct type*); =20 #endif /* GDBTYPES_H */ Index: parse.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/parse.c,v retrieving revision 1.28 diff -u -r1.28 parse.c --- parse.c 25 Sep 2002 20:30:37 -0000 1.28 +++ parse.c 26 Sep 2002 02:35:58 -0000 @@ -105,6 +105,15 @@ =20 static struct funcall *funcall_chain; =20 +/* List of strings. */ + +struct name_list { + struct name_list* next; + char* name; +}; + +static struct name_list *temp_name_list; + /* Begin counting arguments for a function call, saving the data about any containing call. */ =20 @@ -396,6 +405,20 @@ write_exp_elt_opcode (UNOP_MEMVAL); } =0C + +/* Add S to the list of strings that will eventually have to be=20 + released after parsing and must also be released on error. */ +void +add_name_string_cleanup (char *s) +{ + struct name_list* elt =3D=20 + (struct name_list*) xmalloc (sizeof (struct name_list)); + + elt -> name =3D s; + elt -> next =3D temp_name_list; + temp_name_list =3D elt; +} + /* Recognize tokens that start with '$'. These include: =20 $regname A native register name or a "standard Index: parser-defs.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/parser-defs.h,v retrieving revision 1.14 diff -u -r1.14 parser-defs.h --- parser-defs.h 25 Sep 2002 20:30:37 -0000 1.14 +++ parser-defs.h 26 Sep 2002 02:35:58 -0000 @@ -101,6 +101,8 @@ extern union type_stack_elt *type_stack; extern int type_stack_depth, type_stack_size; =20 +extern void add_name_string_cleanup (char*); + extern void write_exp_elt (union exp_element); =20 extern void write_exp_elt_opcode (enum exp_opcode); Index: valarith.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/valarith.c,v retrieving revision 1.16 diff -u -r1.16 valarith.c --- valarith.c 1 Aug 2002 17:18:33 -0000 1.16 +++ valarith.c 26 Sep 2002 02:36:00 -0000 @@ -1162,6 +1162,22 @@ return val; } =0C +/* The identity on non-range types. For range types, the underlying */ +/* non-range scalar type. */=20=20 + +struct type* +base_type (struct type* type) +{ + while (type !=3D NULL && TYPE_CODE (type) =3D=3D TYPE_CODE_RANGE) + { + if (type =3D=3D TYPE_TARGET_TYPE (type)=20 + || TYPE_TARGET_TYPE (type) =3D=3D NULL)=09 + return type; + type =3D TYPE_TARGET_TYPE (type); + } + return type; +} + /* Simulate the C operator ! -- return 1 if ARG1 contains zero. */ =20 int - Aidan --=20 aidan@velvet.net http://www.velvet.net/~aidan/ aim:aidans42 http://www.livejournal.com/users/aidan_skinner/ finger for pgp key: 01AA 1594 2DB0 09E3 B850 C2D0 9A2C 4CC9 3EC4 75E1 --uh9ZiVrAOUUm9fzH Content-Type: application/pgp-signature Content-Disposition: inline Content-length: 230 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (OpenBSD) Comment: For info see http://www.gnupg.org iD8DBQE9knhcmixMyT7EdeERAlTsAJwPshkWVFCBlLpEQvsJEx1AvnrzRQCglhZp Ykqe8oEN/5iym3+o8hnrCT0= =g6S0 -----END PGP SIGNATURE----- --uh9ZiVrAOUUm9fzH--