This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] ada support patch


On Fri, Sep 13, 2002 at 04:30:37PM -0400, Andrew Cagney wrote

> > This patch contains a few changes which are necessary to enable the
> > ada-* files to build and turn on ada support.

[snippage]

Ok, I'm splitting this into two patches, this one doing defs.h, ada-lang.h
and expression.h, and another for the rest.

ChangeLog:

	* defs.h (language): Add language_ada.
	* ada-lang.h (ada_demangle, ada_attribute_name): Declare.
	* expression.h (exp_opcode): Add BINOP_MEMBER_OF,
	TERNOP_MEMBER_OF, OP_UNRESOLVED_VALUE, OP_ADA_ATTRIBUTE,
	UNOP_QUAL, UNOP_MEMBER_OF.	

Patch:

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.97
diff -u -r1.97 defs.h
--- defs.h	19 Sep 2002 03:58:41 -0000	1.97
+++ defs.h	22 Sep 2002 17:13:13 -0000
@@ -214,7 +214,8 @@
     language_m2,		/* Modula-2 */
     language_asm,		/* Assembly language */
     language_scm,    		/* Scheme / Guile */
-    language_pascal		/* Pascal */
+    language_pascal,		/* Pascal */
+    language_ada		/* Ada */
   };
 
 enum precision_type
Index: ada-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.h,v
retrieving revision 1.2
diff -u -r1.2 ada-lang.h
--- ada-lang.h	18 Aug 2002 18:07:17 -0000	1.2
+++ ada-lang.h	22 Sep 2002 17:13:13 -0000
@@ -364,6 +364,10 @@
 
 extern char *ada_breakpoint_rewrite (char *, int *);
 
+extern char *ada_demangle (const char*);
+
+extern const char *ada_attribute_name (int);
+
 /* Tasking-related: ada-tasks.c */
 
 extern int valid_task_id (int);
Index: expression.h
===================================================================
RCS file: /cvs/src/src/gdb/expression.h,v
retrieving revision 1.6
diff -u -r1.6 expression.h
--- expression.h	19 Sep 2002 03:58:41 -0000	1.6
+++ expression.h	22 Sep 2002 17:13:14 -0000
@@ -90,6 +90,10 @@
 
     /* end of C++.  */
 
+    /* Ada:  exp IN exp'RANGE(N).  N is an immediate operand, surrounded by 
+       BINOP_MEMBER_OF before and after.  */
+    BINOP_MEMBER_OF,
+
     /* For Modula-2 integer division DIV */
     BINOP_INTDIV,
 
@@ -131,6 +135,9 @@
        element OP2. */
     TERNOP_SLICE_COUNT,
 
+    /* Ada: exp IN exp .. exp */
+    TERNOP_MEMBER_OF,
+
     /* Multidimensional subscript operator, such as Modula-2 x[a,b,...].
        The dimensionality is encoded in the operator, like the number of
        function arguments in OP_FUNCALL, I.E. <OP><dimension><OP>.
@@ -158,6 +165,17 @@
        executing in that block; if the block is NULL use the selected frame.  */
     OP_VAR_VALUE,
 
+    /* OP_UNRESOLVED_VALUE takes a single struct block* and a char* in the 
+       following exp_elements, followed by another OP_UNRESOLVED_VALUE.   The
+       block indicates where to begin looking for matching symbols.
+       This is for use with overloaded names in Ada, and must 
+       be resolved into an OP_VAR_VALUE before evaluation in EVAL_NORMAL
+       mode.  When evaluated in EVAL_AVOID_SIDE_EFFECTS mode, it is
+       resolved (if possible) to an OP_VAR_VALUE entry, with its block and
+       symbol entries replaced by the block and symbol from the resolving
+       entry. */
+    OP_UNRESOLVED_VALUE,
+
     /* OP_LAST is followed by an integer in the next exp_element.
        The integer is zero for the last value printed,
        or it is the absolute number of a history element.
@@ -192,6 +210,14 @@
        literal. It is followed by exactly two args that are doubles.  */
     OP_COMPLEX,
 
+    /* Ada attribute call.  OP_ADA_ATTRIBUTE is followed by an integer in the
+       next exp_element, which is the number of extra arguments to the attribute
+       (thus, x'tag would specify 0, whereas x'length would specify 1).  
+       The integer is followed by another integer indicating the identity of 
+       the attribute (of type enum ada_attribute, see ada-lang.h), and then
+       by a repeat of OP_ADA_ATTRIBUTE */
+    OP_ADA_ATTRIBUTE,
+
     /* OP_STRING represents a string constant.
        Its format is the same as that of a STRUCTOP, but the string
        data is just made into a string constant when the operation
@@ -220,6 +246,10 @@
        It casts the value of the following subexpression.  */
     UNOP_CAST,
 
+    /* UNOP_QUAL is Ada type qualification.  It is encoded as for
+       UNOP_CAST, above, and denotes the TYPE'(EXPR) construct. */
+    UNOP_QUAL,
+
     /* UNOP_MEMVAL is followed by a type pointer in the next exp_element
        With another UNOP_MEMVAL at the end, this makes three exp_elements.
        It casts the contents of the word addressed by the value of the
@@ -256,7 +286,11 @@
     /* (OBSOLETE) Chill (OBSOLETE) builtin functions. */
     UNOP_LOWER, UNOP_UPPER, UNOP_LENGTH, UNOP_CARD, UNOP_CHMAX, UNOP_CHMIN,
 
+    /* Ada: exp IN type.  The `type' argument is immediate, with UNOP_MEMBER_OF 
+       before and after it. */
+    UNOP_MEMBER_OF,
+
     OP_BOOL,			/* Modula-2 builtin BOOLEAN type */
     OP_M2_STRING,		/* Modula-2 string constants */



- Aidan

-- 
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

Attachment: msg00627/pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]