1 From gdb-patches-return-33536-listarch-gdb-patches=sources dot redhat dot com at sources dot redhat dot com Wed Jun 02 10:17:17 2004
2 Return-Path: <gdb-patches-return-33536-listarch-gdb-patches=sources dot redhat dot com at sources dot redhat dot com>
3 Delivered-To: listarch-gdb-patches at sources dot redhat dot com
4 Received: (qmail 11944 invoked by alias); 2 Jun 2004 10:17:15 -0000
5 Mailing-List: contact gdb-patches-help at sources dot redhat dot com; run by ezmlm
7 List-Subscribe: <mailto:gdb-patches-subscribe at sources dot redhat dot com>
8 List-Archive: <http://sources.redhat.com/ml/gdb-patches/>
9 List-Post: <mailto:gdb-patches at sources dot redhat dot com>
10 List-Help: <mailto:gdb-patches-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
11 Sender: gdb-patches-owner at sources dot redhat dot com
12 Delivered-To: mailing list gdb-patches at sources dot redhat dot com
13 Received: (qmail 11801 invoked from network); 2 Jun 2004 10:16:55 -0000
14 Received: from unknown (HELO nile.gnat.com) (205.232.38.5)
15 by sourceware dot org with SMTP; 2 Jun 2004 10:16:55 -0000
16 Received: from localhost (localhost [127.0.0.1])
17 by nile dot gnat dot com (Postfix) with ESMTP id E93EEF28CC
18 for <gdb-patches at sources dot redhat dot com>; Wed, 2 Jun 2004 06:16:49 -0400 (EDT)
19 Received: from nile.gnat.com ([127.0.0.1])
20 by localhost (nile dot gnat dot com [127 dot 0 dot 0 dot 1]) (amavisd-new, port 10024) with LMTP
21 id 16597-01-4 for <gdb-patches at sources dot redhat dot com>;
22 Wed, 2 Jun 2004 06:16:49 -0400 (EDT)
23 Received: by nile.gnat.com (Postfix, from userid 1345)
24 id 1C85DF28D3; Wed, 2 Jun 2004 06:16:49 -0400 (EDT)
25 From: Paul Hilfinger <hilfingr at gnat dot com>
26 To: gdb-patches at sources dot redhat dot com
27 Subject: [PATCH]: Updates to Ada sources, part 2b (long)
28 Message-Id: <20040602101649.1C85DF28D3@nile.gnat.com>
29 Date: Wed, 2 Jun 2004 06:16:49 -0400 (EDT)
30 X-Virus-Scanned: by amavisd-new at nile.gnat.com
36 ===================================================================
37 RCS file: /cvs/src/src/gdb/ada-lang.c,v
38 retrieving revision 1.35
39 diff -u -p -r1.35 ada-lang.c
40 --- gdb/ada-lang.c 23 Jan 2004 23:03:28 -0000 1.35
41 +++ gdb/ada-lang.c 2 Jun 2004 09:52:56 -0000
42 @@ -6573,26 +8293,25 @@ ada_is_string_type (struct type *type)
44 /* True if TYPE is a struct type introduced by the compiler to force the
45 alignment of a value. Such types have a single field with a
46 - distinctive name. */
47 + distinctive name. */
50 ada_is_aligner_type (struct type *type)
53 return (TYPE_CODE (type) == TYPE_CODE_STRUCT
54 - && TYPE_NFIELDS (type) == 1
55 - && DEPRECATED_STREQ (TYPE_FIELD_NAME (type, 0), "F"));
56 + && TYPE_NFIELDS (type) == 1
57 + && strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
60 /* If there is an ___XVS-convention type parallel to SUBTYPE, return
61 - the parallel type. */
62 + the parallel type. */
65 ada_get_base_type (struct type *raw_type)
67 struct type *real_type_namer;
68 struct type *raw_real_type;
69 - struct type *real_type;
71 if (raw_type == NULL || TYPE_CODE (raw_type) != TYPE_CODE_STRUCT)
73 @@ -6610,7 +8329,7 @@ ada_get_base_type (struct type *raw_type
77 -/* The type of value designated by TYPE, with all aligners removed. */
78 +/* The type of value designated by TYPE, with all aligners removed. */
81 ada_aligned_type (struct type *type)
82 @@ -6623,82 +8342,110 @@ ada_aligned_type (struct type *type)
85 /* The address of the aligned value in an object at address VALADDR
86 - having type TYPE. Assumes ada_is_aligner_type (TYPE). */
87 + having type TYPE. Assumes ada_is_aligner_type (TYPE). */
90 ada_aligned_value_addr (struct type *type, char *valaddr)
92 if (ada_is_aligner_type (type))
93 return ada_aligned_value_addr (TYPE_FIELD_TYPE (type, 0),
95 - TYPE_FIELD_BITPOS (type,
96 - 0) / TARGET_CHAR_BIT);
98 + TYPE_FIELD_BITPOS (type,
99 + 0) / TARGET_CHAR_BIT);
106 /* The printed representation of an enumeration literal with encoded
107 - name NAME. The value is good to the next call of ada_enum_name. */
108 + name NAME. The value is good to the next call of ada_enum_name. */
110 ada_enum_name (const char *name)
112 + static char *result;
113 + static size_t result_len = 0;
118 - if ((tmp = strstr (name, "__")) != NULL)
120 - else if ((tmp = strchr (name, '.')) != NULL)
124 + /* First, unqualify the enumeration name:
125 + 1. Search for the last '.' character. If we find one, then skip
126 + all the preceeding characters, the unqualified name starts
127 + right after that dot.
128 + 2. Otherwise, we may be debugging on a target where the compiler
129 + translates dots into "__". Search forward for double underscores,
130 + but stop searching when we hit an overloading suffix, which is
131 + of the form "__" followed by digits. */
133 + if ((tmp = strrchr (name, '.')) != NULL)
137 + while ((tmp = strstr (name, "__")) != NULL)
139 + if (isdigit (tmp[2]))
148 - static char result[16];
150 if (name[1] == 'U' || name[1] == 'W')
152 - if (sscanf (name + 2, "%x", &v) != 1)
156 + if (sscanf (name + 2, "%x", &v) != 1)
163 + GROW_VECT (result, result_len, 16);
164 if (isascii (v) && isprint (v))
165 - sprintf (result, "'%c'", v);
166 + sprintf (result, "'%c'", v);
167 else if (name[1] == 'U')
168 - sprintf (result, "[\"%02x\"]", v);
169 + sprintf (result, "[\"%02x\"]", v);
171 - sprintf (result, "[\"%04x\"]", v);
172 + sprintf (result, "[\"%04x\"]", v);
179 + if ((tmp = strstr (name, "__")) != NULL
180 + || (tmp = strstr (name, "$")) != NULL)
182 + GROW_VECT (result, result_len, tmp - name + 1);
183 + strncpy (result, name, tmp - name);
184 + result[tmp - name] = '\0';
192 static struct value *
193 evaluate_subexp (struct type *expect_type, struct expression *exp, int *pos,
194 - enum noside noside)
195 + enum noside noside)
197 - return (*exp->language_defn->evaluate_exp) (expect_type, exp, pos, noside);
198 + return (*exp->language_defn->la_exp_desc->evaluate_exp)
199 + (expect_type, exp, pos, noside);
202 /* Evaluate the subexpression of EXP starting at *POS as for
203 evaluate_type, updating *POS to point just past the evaluated
207 static struct value *
208 evaluate_subexp_type (struct expression *exp, int *pos)
210 - return (*exp->language_defn->evaluate_exp)
211 + return (*exp->language_defn->la_exp_desc->evaluate_exp)
212 (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
215 /* If VAL is wrapped in an aligner or subtype wrapper, return the
219 static struct value *
220 unwrap_value (struct value *val)
221 @@ -6707,26 +8454,26 @@ unwrap_value (struct value *val)
222 if (ada_is_aligner_type (type))
224 struct value *v = value_struct_elt (&val, NULL, "F",
225 - NULL, "internal structure");
226 + NULL, "internal structure");
227 struct type *val_type = check_typedef (VALUE_TYPE (v));
228 if (ada_type_name (val_type) == NULL)
229 - TYPE_NAME (val_type) = ada_type_name (type);
230 + TYPE_NAME (val_type) = ada_type_name (type);
232 return unwrap_value (v);
236 struct type *raw_real_type =
237 - ada_completed_type (ada_get_base_type (type));
238 + ada_completed_type (ada_get_base_type (type));
240 if (type == raw_real_type)
245 - coerce_unspec_val_to_type
246 - (val, 0, ada_to_fixed_type (raw_real_type, 0,
247 - VALUE_ADDRESS (val) + VALUE_OFFSET (val),
249 + coerce_unspec_val_to_type
250 + (val, ada_to_fixed_type (raw_real_type, 0,
251 + VALUE_ADDRESS (val) + VALUE_OFFSET (val),
256 @@ -6739,12 +8486,12 @@ cast_to_fixed (struct type *type, struct
258 else if (ada_is_fixed_point_type (VALUE_TYPE (arg)))
259 val = ada_float_to_fixed (type,
260 - ada_fixed_to_float (VALUE_TYPE (arg),
261 - value_as_long (arg)));
262 + ada_fixed_to_float (VALUE_TYPE (arg),
263 + value_as_long (arg)));
267 - value_as_double (value_cast (builtin_type_double, value_copy (arg)));
268 + value_as_double (value_cast (builtin_type_double, value_copy (arg)));
269 val = ada_float_to_fixed (type, argd);
272 @@ -6755,12 +8502,13 @@ static struct value *
273 cast_from_fixed_to_double (struct value *arg)
275 DOUBLEST val = ada_fixed_to_float (VALUE_TYPE (arg),
276 - value_as_long (arg));
277 + value_as_long (arg));
278 return value_from_double (builtin_type_double, val);
281 -/* Coerce VAL as necessary for assignment to an lval of type TYPE, and
282 - * return the converted value. */
283 +/* Coerce VAL as necessary for assignment to an lval of type TYPE, and
284 + return the converted value. */
286 static struct value *
287 coerce_for_assign (struct type *type, struct value *val)
289 @@ -6782,20 +8530,98 @@ coerce_for_assign (struct type *type, st
290 && TYPE_CODE (type) == TYPE_CODE_ARRAY)
292 if (TYPE_LENGTH (type2) != TYPE_LENGTH (type)
293 - || TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
294 - != TYPE_LENGTH (TYPE_TARGET_TYPE (type2)))
295 - error ("Incompatible types in assignment");
296 + || TYPE_LENGTH (TYPE_TARGET_TYPE (type2))
297 + != TYPE_LENGTH (TYPE_TARGET_TYPE (type2)))
298 + error ("Incompatible types in assignment");
299 VALUE_TYPE (val) = type;
304 +static struct value *
305 +ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
308 + struct type *type1, *type2;
313 + type1 = base_type (check_typedef (VALUE_TYPE (arg1)));
314 + type2 = base_type (check_typedef (VALUE_TYPE (arg2)));
316 + if (TYPE_CODE (type1) != TYPE_CODE_INT || TYPE_CODE (type2) != TYPE_CODE_INT)
317 + return value_binop (arg1, arg2, op);
326 + return value_binop (arg1, arg2, op);
329 + v2 = value_as_long (arg2);
331 + error ("second operand of %s must not be zero.", op_string (op));
333 + if (TYPE_UNSIGNED (type1) || op == BINOP_MOD)
334 + return value_binop (arg1, arg2, op);
336 + v1 = value_as_long (arg1);
341 + if (! TRUNCATION_TOWARDS_ZERO && v1 * (v1%v2) < 0)
342 + v += v > 0 ? -1 : 1;
350 + /* Should not reach this point. */
354 + val = allocate_value (type1);
355 + store_unsigned_integer (VALUE_CONTENTS_RAW (val),
356 + TYPE_LENGTH (VALUE_TYPE (val)),
362 +ada_value_equal (struct value *arg1, struct value *arg2)
364 + if (ada_is_direct_array_type (VALUE_TYPE (arg1))
365 + || ada_is_direct_array_type (VALUE_TYPE (arg2)))
367 + arg1 = ada_coerce_to_simple_array (arg1);
368 + arg2 = ada_coerce_to_simple_array (arg2);
369 + if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_ARRAY
370 + || TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_ARRAY)
371 + error ("Attempt to compare array with non-array");
372 + /* FIXME: The following works only for types whose
373 + representations use all bits (no padding or undefined bits)
374 + and do not have user-defined equality. */
376 + TYPE_LENGTH (VALUE_TYPE (arg1)) == TYPE_LENGTH (VALUE_TYPE (arg2))
377 + && memcmp (VALUE_CONTENTS (arg1), VALUE_CONTENTS (arg2),
378 + TYPE_LENGTH (VALUE_TYPE (arg1))) == 0;
380 + return value_equal (arg1, arg2);
384 ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
385 - int *pos, enum noside noside)
386 + int *pos, enum noside noside)
389 - enum ada_attribute atr;
392 struct value *arg1 = NULL, *arg2 = NULL, *arg3;
393 @@ -6812,752 +8638,734 @@ ada_evaluate_subexp (struct type *expect
397 - unwrap_value (evaluate_subexp_standard
398 - (expect_type, exp, pos, noside));
399 + unwrap_value (evaluate_subexp_standard
400 + (expect_type, exp, pos, noside));
404 + struct value *result;
406 + result = evaluate_subexp_standard (expect_type, exp, pos, noside);
407 + /* The result type will have code OP_STRING, bashed there from
408 + OP_ARRAY. Bash it back. */
409 + if (TYPE_CODE (VALUE_TYPE (result)) == TYPE_CODE_STRING)
410 + TYPE_CODE (VALUE_TYPE (result)) = TYPE_CODE_ARRAY;
416 type = exp->elts[pc + 1].type;
417 arg1 = evaluate_subexp (type, exp, pos, noside);
418 if (noside == EVAL_SKIP)
421 if (type != check_typedef (VALUE_TYPE (arg1)))
423 - if (ada_is_fixed_point_type (type))
424 - arg1 = cast_to_fixed (type, arg1);
425 - else if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
426 - arg1 = value_cast (type, cast_from_fixed_to_double (arg1));
427 - else if (VALUE_LVAL (arg1) == lval_memory)
429 - /* This is in case of the really obscure (and undocumented,
430 - but apparently expected) case of (Foo) Bar.all, where Bar
431 - is an integer constant and Foo is a dynamic-sized type.
432 - If we don't do this, ARG1 will simply be relabeled with
434 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
435 - return value_zero (to_static_fixed_type (type), not_lval);
438 - (type, 0, VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1), 0);
441 - arg1 = value_cast (type, arg1);
444 + if (ada_is_fixed_point_type (type))
445 + arg1 = cast_to_fixed (type, arg1);
446 + else if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
447 + arg1 = value_cast (type, cast_from_fixed_to_double (arg1));
448 + else if (VALUE_LVAL (arg1) == lval_memory)
450 + /* This is in case of the really obscure (and undocumented,
451 + but apparently expected) case of (Foo) Bar.all, where Bar
452 + is an integer constant and Foo is a dynamic-sized type.
453 + If we don't do this, ARG1 will simply be relabeled with
455 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
456 + return value_zero (to_static_fixed_type (type), not_lval);
458 + ada_to_fixed_value_create
459 + (type, VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1), 0);
462 + arg1 = value_cast (type, arg1);
466 - /* FIXME: UNOP_QUAL should be defined in expression.h */
469 - type = exp->elts[pc + 1].type;
470 - return ada_evaluate_subexp (type, exp, pos, noside);
474 + type = exp->elts[pc + 1].type;
475 + return ada_evaluate_subexp (type, exp, pos, noside);
478 arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
479 arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
480 if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
482 - if (binop_user_defined_p (op, arg1, arg2))
483 - return value_x_binop (arg1, arg2, op, OP_NULL, EVAL_NORMAL);
485 + if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
486 + arg2 = cast_to_fixed (VALUE_TYPE (arg1), arg2);
487 + else if (ada_is_fixed_point_type (VALUE_TYPE (arg2)))
489 + ("Fixed-point values must be assigned to fixed-point variables");
492 - if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
493 - arg2 = cast_to_fixed (VALUE_TYPE (arg1), arg2);
494 - else if (ada_is_fixed_point_type (VALUE_TYPE (arg2)))
496 - ("Fixed-point values must be assigned to fixed-point variables");
498 - arg2 = coerce_for_assign (VALUE_TYPE (arg1), arg2);
499 - return ada_value_assign (arg1, arg2);
501 + arg2 = coerce_for_assign (VALUE_TYPE (arg1), arg2);
502 + return ada_value_assign (arg1, arg2);
505 arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
506 arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
507 if (noside == EVAL_SKIP)
509 - if (binop_user_defined_p (op, arg1, arg2))
510 - return value_x_binop (arg1, arg2, op, OP_NULL, EVAL_NORMAL);
513 - if ((ada_is_fixed_point_type (VALUE_TYPE (arg1))
514 - || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
515 - && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
517 - ("Operands of fixed-point addition must have the same type");
518 - return value_cast (VALUE_TYPE (arg1), value_add (arg1, arg2));
521 + if ((ada_is_fixed_point_type (VALUE_TYPE (arg1))
522 + || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
523 + && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
525 + ("Operands of fixed-point addition must have the same type");
526 + return value_cast (VALUE_TYPE (arg1), value_add (arg1, arg2));
529 arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
530 arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
531 if (noside == EVAL_SKIP)
533 - if (binop_user_defined_p (op, arg1, arg2))
534 - return value_x_binop (arg1, arg2, op, OP_NULL, EVAL_NORMAL);
537 - if ((ada_is_fixed_point_type (VALUE_TYPE (arg1))
538 - || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
539 - && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
541 - ("Operands of fixed-point subtraction must have the same type");
542 - return value_cast (VALUE_TYPE (arg1), value_sub (arg1, arg2));
545 + if ((ada_is_fixed_point_type (VALUE_TYPE (arg1))
546 + || ada_is_fixed_point_type (VALUE_TYPE (arg2)))
547 + && VALUE_TYPE (arg1) != VALUE_TYPE (arg2))
549 + ("Operands of fixed-point subtraction must have the same type");
550 + return value_cast (VALUE_TYPE (arg1), value_sub (arg1, arg2));
554 arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
555 arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
556 if (noside == EVAL_SKIP)
558 + else if (noside == EVAL_AVOID_SIDE_EFFECTS
559 + && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
560 + return value_zero (VALUE_TYPE (arg1), not_lval);
563 + if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
564 + arg1 = cast_from_fixed_to_double (arg1);
565 + if (ada_is_fixed_point_type (VALUE_TYPE (arg2)))
566 + arg2 = cast_from_fixed_to_double (arg2);
567 + return ada_value_binop (arg1, arg2, op);
572 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
573 + arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
574 + if (noside == EVAL_SKIP)
576 - if (binop_user_defined_p (op, arg1, arg2))
577 - return value_x_binop (arg1, arg2, op, OP_NULL, EVAL_NORMAL);
579 - if (noside == EVAL_AVOID_SIDE_EFFECTS
580 - && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
581 + else if (noside == EVAL_AVOID_SIDE_EFFECTS
582 + && (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
583 return value_zero (VALUE_TYPE (arg1), not_lval);
586 - if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
587 - arg1 = cast_from_fixed_to_double (arg1);
588 - if (ada_is_fixed_point_type (VALUE_TYPE (arg2)))
589 - arg2 = cast_from_fixed_to_double (arg2);
590 - return value_binop (arg1, arg2, op);
592 + return ada_value_binop (arg1, arg2, op);
596 + case BINOP_NOTEQUAL:
597 arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
598 + arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
599 if (noside == EVAL_SKIP)
601 - if (unop_user_defined_p (op, arg1))
602 - return value_x_unop (arg1, op, EVAL_NORMAL);
603 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
606 + tem = ada_value_equal (arg1, arg2);
607 + if (op == BINOP_NOTEQUAL)
609 + return value_from_longest (LA_BOOL_TYPE, (LONGEST) tem);
612 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
613 + if (noside == EVAL_SKIP)
615 else if (ada_is_fixed_point_type (VALUE_TYPE (arg1)))
616 - return value_cast (VALUE_TYPE (arg1), value_neg (arg1));
617 + return value_cast (VALUE_TYPE (arg1), value_neg (arg1));
619 - return value_neg (arg1);
620 + return value_neg (arg1);
622 - /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
623 - /* case OP_UNRESOLVED_VALUE:
624 - /* Only encountered when an unresolved symbol occurs in a
625 - context other than a function call, in which case, it is
628 - if (noside == EVAL_SKIP)
631 - error ("Unexpected unresolved symbol, %s, during evaluation",
632 - ada_demangle (exp->elts[pc + 2].name));
636 if (noside == EVAL_SKIP)
645 + else if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
646 + /* Only encountered when an unresolved symbol occurs in a
647 + context other than a function call, in which case, it is
649 + error ("Unexpected unresolved symbol, %s, during evaluation",
650 + SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol));
651 else if (noside == EVAL_AVOID_SIDE_EFFECTS)
655 - (to_static_fixed_type
656 - (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol))),
662 - unwrap_value (evaluate_subexp_standard
663 - (expect_type, exp, pos, noside));
664 - return ada_to_fixed_value (VALUE_TYPE (arg1), 0,
665 - VALUE_ADDRESS (arg1) +
666 - VALUE_OFFSET (arg1), arg1);
671 + (to_static_fixed_type
672 + (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol))),
678 + unwrap_value (evaluate_subexp_standard
679 + (expect_type, exp, pos, noside));
680 + return ada_to_fixed_value (arg1);
686 + /* Allocate arg vector, including space for the function to be
687 + called in argvec[0] and a terminating NULL. */
688 + nargs = longest_to_int (exp->elts[pc + 1].longconst);
690 + (struct value **) alloca (sizeof (struct value *) * (nargs + 2));
692 + if (exp->elts[*pos].opcode == OP_VAR_VALUE
693 + && SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
694 + error ("Unexpected unresolved symbol, %s, during evaluation",
695 + SYMBOL_PRINT_NAME (exp->elts[pc + 5].symbol));
698 + for (tem = 0; tem <= nargs; tem += 1)
699 + argvec[tem] = evaluate_subexp (NULL_TYPE, exp, pos, noside);
702 + if (noside == EVAL_SKIP)
706 + if (ada_is_packed_array_type (desc_base_type (VALUE_TYPE (argvec[0]))))
707 + argvec[0] = ada_coerce_to_simple_array (argvec[0]);
708 + else if (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_REF
709 + || (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_ARRAY
710 + && VALUE_LVAL (argvec[0]) == lval_memory))
711 + argvec[0] = value_addr (argvec[0]);
713 + type = check_typedef (VALUE_TYPE (argvec[0]));
714 + if (TYPE_CODE (type) == TYPE_CODE_PTR)
716 + switch (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (type))))
718 + case TYPE_CODE_FUNC:
719 + type = check_typedef (TYPE_TARGET_TYPE (type));
721 + case TYPE_CODE_ARRAY:
723 + case TYPE_CODE_STRUCT:
724 + if (noside != EVAL_AVOID_SIDE_EFFECTS)
725 + argvec[0] = ada_value_ind (argvec[0]);
726 + type = check_typedef (TYPE_TARGET_TYPE (type));
729 + error ("cannot subscript or call something of type `%s'",
730 + ada_type_name (VALUE_TYPE (argvec[0])));
735 + switch (TYPE_CODE (type))
737 + case TYPE_CODE_FUNC:
738 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
739 + return allocate_value (TYPE_TARGET_TYPE (type));
740 + return call_function_by_hand (argvec[0], nargs, argvec + 1);
741 + case TYPE_CODE_STRUCT:
745 + /* Make sure to use the parallel ___XVS type if any.
746 + Otherwise, we won't be able to find the array arity
747 + and element type. */
748 + type = ada_get_base_type (type);
750 + arity = ada_array_arity (type);
751 + type = ada_array_element_type (type, nargs);
753 + error ("cannot subscript or call a record");
754 + if (arity != nargs)
755 + error ("wrong number of subscripts; expecting %d", arity);
756 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
757 + return allocate_value (ada_aligned_type (type));
759 + unwrap_value (ada_value_subscript
760 + (argvec[0], nargs, argvec + 1));
762 + case TYPE_CODE_ARRAY:
763 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
765 + type = ada_array_element_type (type, nargs);
767 + error ("element type of array unknown");
769 + return allocate_value (ada_aligned_type (type));
772 + unwrap_value (ada_value_subscript
773 + (ada_coerce_to_simple_array (argvec[0]),
774 + nargs, argvec + 1));
775 + case TYPE_CODE_PTR: /* Pointer to array */
776 + type = to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1);
777 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
779 + type = ada_array_element_type (type, nargs);
781 + error ("element type of array unknown");
783 + return allocate_value (ada_aligned_type (type));
786 + unwrap_value (ada_value_ptr_subscript (argvec[0], type,
787 + nargs, argvec + 1));
790 + error ("Internal error in evaluate_subexp");
795 + struct value *array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
796 + struct value *low_bound_val =
797 + evaluate_subexp (NULL_TYPE, exp, pos, noside);
798 + LONGEST low_bound = pos_atr (low_bound_val);
800 + = pos_atr (evaluate_subexp (NULL_TYPE, exp, pos, noside));
801 + if (noside == EVAL_SKIP)
804 + /* If this is a reference type or a pointer type, and
805 + the target type has an XVS parallel type, then get
806 + the real target type. */
807 + if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF
808 + || TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR)
809 + TYPE_TARGET_TYPE (VALUE_TYPE (array)) =
810 + ada_get_base_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)));
812 + /* If this is a reference to an aligner type, then remove all
814 + if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF
815 + && ada_is_aligner_type (TYPE_TARGET_TYPE (VALUE_TYPE (array))))
816 + TYPE_TARGET_TYPE (VALUE_TYPE (array)) =
817 + ada_aligned_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)));
819 + if (ada_is_packed_array_type (VALUE_TYPE (array)))
820 + error ("cannot slice a packed array");
822 + /* If this is a reference to an array or an array lvalue,
823 + convert to a pointer. */
824 + if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF
825 + || (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_ARRAY
826 + && VALUE_LVAL (array) == lval_memory))
827 + array = value_addr (array);
829 + if (noside == EVAL_AVOID_SIDE_EFFECTS &&
830 + ada_is_array_descriptor_type (check_typedef (VALUE_TYPE (array))))
832 + /* Try dereferencing the array, in case it is an access
834 + struct type *arrType = ada_type_of_array (array, 0);
835 + if (arrType != NULL)
836 + array = value_at_lazy (arrType, 0, NULL);
839 + array = ada_coerce_to_simple_array_ptr (array);
841 + /* When EVAL_AVOID_SIDE_EFFECTS, we may get the bounds wrong,
842 + but only in contexts where the value is not being requested
844 + if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR)
846 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
847 + return ada_value_ind (array);
848 + else if (high_bound < low_bound)
849 + return empty_array (TYPE_TARGET_TYPE (VALUE_TYPE (array)),
853 + struct type *arr_type0 =
854 + to_fixed_array_type (TYPE_TARGET_TYPE (VALUE_TYPE (array)),
856 + struct value *item0 =
857 + ada_value_ptr_subscript (array, arr_type0, 1,
859 + struct value *slice =
860 + value_repeat (item0, high_bound - low_bound + 1);
861 + struct type *arr_type1 = VALUE_TYPE (slice);
862 + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (arr_type1)) = low_bound;
863 + TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (arr_type1)) += low_bound;
867 + else if (noside == EVAL_AVOID_SIDE_EFFECTS)
869 + else if (high_bound < low_bound)
870 + return empty_array (VALUE_TYPE (array), low_bound);
872 + return value_slice (array, low_bound, high_bound - low_bound + 1);
875 + case UNOP_IN_RANGE:
877 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
878 + type = exp->elts[pc + 1].type;
880 + if (noside == EVAL_SKIP)
883 + switch (TYPE_CODE (type))
886 + lim_warning ("Membership test incompletely implemented; "
887 + "always returns true", 0);
888 + return value_from_longest (builtin_type_int, (LONGEST) 1);
890 + case TYPE_CODE_RANGE:
891 + arg2 = value_from_longest (builtin_type_int,
892 + TYPE_LOW_BOUND (type));
893 + arg3 = value_from_longest (builtin_type_int,
894 + TYPE_HIGH_BOUND (type));
896 + value_from_longest (builtin_type_int,
897 + (value_less (arg1, arg3)
898 + || value_equal (arg1, arg3))
899 + && (value_less (arg2, arg1)
900 + || value_equal (arg2, arg1)));
905 - tem2 = longest_to_int (exp->elts[pc + 1].longconst);
906 - tem3 = longest_to_int (exp->elts[pc + 2].longconst);
907 - nargs = tem3 - tem2 + 1;
908 - type = expect_type ? check_typedef (expect_type) : NULL_TYPE;
909 + case BINOP_IN_BOUNDS:
911 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
912 + arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
915 - (struct value * *) alloca (sizeof (struct value *) * (nargs + 1));
916 - for (tem = 0; tem == 0 || tem < nargs; tem += 1)
917 - /* At least one element gets inserted for the type */
919 - /* Ensure that array expressions are coerced into pointer objects. */
920 - argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
922 if (noside == EVAL_SKIP)
924 - return value_array (tem2, tem3, argvec);
929 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
930 + return value_zero (builtin_type_int, not_lval);
932 - /* Allocate arg vector, including space for the function to be
933 - called in argvec[0] and a terminating NULL */
934 - nargs = longest_to_int (exp->elts[pc + 1].longconst);
936 - (struct value * *) alloca (sizeof (struct value *) * (nargs + 2));
937 + tem = longest_to_int (exp->elts[pc + 1].longconst);
939 - /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
940 - /* FIXME: name should be defined in expresion.h */
941 - /* if (exp->elts[*pos].opcode == OP_UNRESOLVED_VALUE)
942 - error ("Unexpected unresolved symbol, %s, during evaluation",
943 - ada_demangle (exp->elts[pc + 5].name));
947 - error ("unexpected code path, FIXME");
951 - for (tem = 0; tem <= nargs; tem += 1)
952 - argvec[tem] = evaluate_subexp (NULL_TYPE, exp, pos, noside);
954 + if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg2)))
955 + error ("invalid dimension number to '%s", "range");
957 - if (noside == EVAL_SKIP)
960 + arg3 = ada_array_bound (arg2, tem, 1);
961 + arg2 = ada_array_bound (arg2, tem, 0);
963 - if (TYPE_CODE (VALUE_TYPE (argvec[0])) == TYPE_CODE_REF)
964 - argvec[0] = value_addr (argvec[0]);
966 + value_from_longest (builtin_type_int,
967 + (value_less (arg1, arg3)
968 + || value_equal (arg1, arg3))
969 + && (value_less (arg2, arg1)
970 + || value_equal (arg2, arg1)));
972 - if (ada_is_packed_array_type (VALUE_TYPE (argvec[0])))
973 - argvec[0] = ada_coerce_to_simple_array (argvec[0]);
974 + case TERNOP_IN_RANGE:
975 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
976 + arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
977 + arg3 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
979 - type = check_typedef (VALUE_TYPE (argvec[0]));
980 - if (TYPE_CODE (type) == TYPE_CODE_PTR)
982 - switch (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (type))))
984 - case TYPE_CODE_FUNC:
985 - type = check_typedef (TYPE_TARGET_TYPE (type));
987 - case TYPE_CODE_ARRAY:
989 - case TYPE_CODE_STRUCT:
990 - if (noside != EVAL_AVOID_SIDE_EFFECTS)
991 - argvec[0] = ada_value_ind (argvec[0]);
992 - type = check_typedef (TYPE_TARGET_TYPE (type));
995 - error ("cannot subscript or call something of type `%s'",
996 - ada_type_name (VALUE_TYPE (argvec[0])));
1000 + if (noside == EVAL_SKIP)
1003 - switch (TYPE_CODE (type))
1005 - case TYPE_CODE_FUNC:
1006 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1007 - return allocate_value (TYPE_TARGET_TYPE (type));
1008 - return call_function_by_hand (argvec[0], nargs, argvec + 1);
1009 - case TYPE_CODE_STRUCT:
1011 + value_from_longest (builtin_type_int,
1012 + (value_less (arg1, arg3)
1013 + || value_equal (arg1, arg3))
1014 + && (value_less (arg2, arg1)
1015 + || value_equal (arg2, arg1)));
1017 + case OP_ATR_FIRST:
1019 + case OP_ATR_LENGTH:
1021 + struct type *type_arg;
1022 + if (exp->elts[*pos].opcode == OP_TYPE)
1024 - int arity = ada_array_arity (type);
1025 - type = ada_array_element_type (type, nargs);
1027 - error ("cannot subscript or call a record");
1028 - if (arity != nargs)
1029 - error ("wrong number of subscripts; expecting %d", arity);
1030 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1031 - return allocate_value (ada_aligned_type (type));
1033 - unwrap_value (ada_value_subscript
1034 - (argvec[0], nargs, argvec + 1));
1035 + evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1037 + type_arg = exp->elts[pc + 2].type;
1041 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1044 - case TYPE_CODE_ARRAY:
1045 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1047 - type = ada_array_element_type (type, nargs);
1049 - error ("element type of array unknown");
1051 - return allocate_value (ada_aligned_type (type));
1054 - unwrap_value (ada_value_subscript
1055 - (ada_coerce_to_simple_array (argvec[0]),
1056 - nargs, argvec + 1));
1057 - case TYPE_CODE_PTR: /* Pointer to array */
1058 - type = to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1);
1059 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1061 - type = ada_array_element_type (type, nargs);
1063 - error ("element type of array unknown");
1065 - return allocate_value (ada_aligned_type (type));
1068 - unwrap_value (ada_value_ptr_subscript (argvec[0], type,
1069 - nargs, argvec + 1));
1072 - error ("Internal error in evaluate_subexp");
1074 + if (exp->elts[*pos].opcode != OP_LONG)
1075 + error ("illegal operand to '%s", ada_attribute_name (op));
1076 + tem = longest_to_int (exp->elts[*pos + 2].longconst);
1079 - case TERNOP_SLICE:
1081 - struct value *array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1083 - = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
1085 - = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
1086 if (noside == EVAL_SKIP)
1089 - /* If this is a reference to an array, then dereference it */
1090 - if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_REF
1091 - && TYPE_TARGET_TYPE (VALUE_TYPE (array)) != NULL
1092 - && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (array))) ==
1094 - && !ada_is_array_descriptor (check_typedef (VALUE_TYPE (array))))
1095 + if (type_arg == NULL)
1097 - array = ada_coerce_ref (array);
1099 + arg1 = ada_coerce_ref (arg1);
1101 - if (noside == EVAL_AVOID_SIDE_EFFECTS &&
1102 - ada_is_array_descriptor (check_typedef (VALUE_TYPE (array))))
1104 - /* Try to dereference the array, in case it is an access to array */
1105 - struct type *arrType = ada_type_of_array (array, 0);
1106 - if (arrType != NULL)
1107 - array = value_at_lazy (arrType, 0, NULL);
1109 - if (ada_is_array_descriptor (VALUE_TYPE (array)))
1110 - array = ada_coerce_to_simple_array (array);
1111 + if (ada_is_packed_array_type (VALUE_TYPE (arg1)))
1112 + arg1 = ada_coerce_to_simple_array (arg1);
1114 + if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg1)))
1115 + error ("invalid dimension number to '%s",
1116 + ada_attribute_name (op));
1118 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
1120 + type = ada_index_type (VALUE_TYPE (arg1), tem);
1123 + ("attempt to take bound of something that is not an array");
1124 + return allocate_value (type);
1127 - /* If at this point we have a pointer to an array, it means that
1128 - it is a pointer to a simple (non-ada) array. We just then
1130 - if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_PTR
1131 - && TYPE_TARGET_TYPE (VALUE_TYPE (array)) != NULL
1132 - && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (array))) ==
1136 + default: /* Should never happen. */
1137 + error ("unexpected attribute encountered");
1138 + case OP_ATR_FIRST:
1139 + return ada_array_bound (arg1, tem, 0);
1141 + return ada_array_bound (arg1, tem, 1);
1142 + case OP_ATR_LENGTH:
1143 + return ada_array_length (arg1, tem);
1146 + else if (discrete_type_p (type_arg))
1148 - array = ada_value_ind (array);
1149 + struct type *range_type;
1150 + char *name = ada_type_name (type_arg);
1151 + range_type = NULL;
1152 + if (name != NULL && TYPE_CODE (type_arg) != TYPE_CODE_ENUM)
1154 + to_fixed_range_type (name, NULL, TYPE_OBJFILE (type_arg));
1155 + if (range_type == NULL)
1156 + range_type = type_arg;
1160 + error ("unexpected attribute encountered");
1161 + case OP_ATR_FIRST:
1162 + return discrete_type_low_bound (range_type);
1164 + return discrete_type_high_bound (range_type);
1165 + case OP_ATR_LENGTH:
1166 + error ("the 'length attribute applies only to array types");
1170 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1171 - /* The following will get the bounds wrong, but only in contexts
1172 - where the value is not being requested (FIXME?). */
1174 + else if (TYPE_CODE (type_arg) == TYPE_CODE_FLT)
1175 + error ("unimplemented type attribute");
1177 - return value_slice (array, lowbound, upper - lowbound + 1);
1179 + LONGEST low, high;
1181 + if (ada_is_packed_array_type (type_arg))
1182 + type_arg = decode_packed_array_type (type_arg);
1184 + if (tem < 1 || tem > ada_array_arity (type_arg))
1185 + error ("invalid dimension number to '%s",
1186 + ada_attribute_name (op));
1188 + type = ada_index_type (type_arg, tem);
1190 + error ("attempt to take bound of something that is not an array");
1191 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
1192 + return allocate_value (type);
1197 + error ("unexpected attribute encountered");
1198 + case OP_ATR_FIRST:
1199 + low = ada_array_bound_from_type (type_arg, tem, 0, &type);
1200 + return value_from_longest (type, low);
1203 + ada_array_bound_from_type (type_arg, tem, 1, &type);
1204 + return value_from_longest (type, high);
1205 + case OP_ATR_LENGTH:
1206 + low = ada_array_bound_from_type (type_arg, tem, 0, &type);
1207 + high = ada_array_bound_from_type (type_arg, tem, 1, NULL);
1208 + return value_from_longest (type, high - low + 1);
1213 - /* FIXME: UNOP_MBR should be defined in expression.h */
1216 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1217 - type = exp->elts[pc + 1].type;
1219 - if (noside == EVAL_SKIP)
1222 - switch (TYPE_CODE (type))
1225 - warning ("Membership test incompletely implemented; always returns true");
1226 - return value_from_longest (builtin_type_int, (LONGEST) 1);
1228 - case TYPE_CODE_RANGE:
1229 - arg2 = value_from_longest (builtin_type_int,
1230 - (LONGEST) TYPE_LOW_BOUND (type));
1231 - arg3 = value_from_longest (builtin_type_int,
1232 - (LONGEST) TYPE_HIGH_BOUND (type));
1234 - value_from_longest (builtin_type_int,
1235 - (value_less (arg1,arg3)
1236 - || value_equal (arg1,arg3))
1237 - && (value_less (arg2,arg1)
1238 - || value_equal (arg2,arg1)));
1241 - /* FIXME: BINOP_MBR should be defined in expression.h */
1242 - /* case BINOP_MBR:
1244 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1245 - arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1247 - if (noside == EVAL_SKIP)
1250 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1251 - return value_zero (builtin_type_int, not_lval);
1253 - tem = longest_to_int (exp->elts[pc + 1].longconst);
1255 - if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg2)))
1256 - error ("invalid dimension number to '%s", "range");
1258 - arg3 = ada_array_bound (arg2, tem, 1);
1259 - arg2 = ada_array_bound (arg2, tem, 0);
1262 - value_from_longest (builtin_type_int,
1263 - (value_less (arg1,arg3)
1264 - || value_equal (arg1,arg3))
1265 - && (value_less (arg2,arg1)
1266 - || value_equal (arg2,arg1)));
1268 - /* FIXME: TERNOP_MBR should be defined in expression.h */
1269 - /* case TERNOP_MBR:
1270 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1271 - arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1272 - arg3 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1274 - if (noside == EVAL_SKIP)
1278 - value_from_longest (builtin_type_int,
1279 - (value_less (arg1,arg3)
1280 - || value_equal (arg1,arg3))
1281 - && (value_less (arg2,arg1)
1282 - || value_equal (arg2,arg1)));
1284 - /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
1285 - /* case OP_ATTRIBUTE:
1287 - atr = (enum ada_attribute) longest_to_int (exp->elts[pc + 2].longconst);
1291 - error ("unexpected attribute encountered");
1297 - struct type* type_arg;
1298 - if (exp->elts[*pos].opcode == OP_TYPE)
1300 - evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1302 - type_arg = exp->elts[pc + 5].type;
1306 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1310 - if (exp->elts[*pos].opcode != OP_LONG)
1311 - error ("illegal operand to '%s", ada_attribute_name (atr));
1312 - tem = longest_to_int (exp->elts[*pos+2].longconst);
1315 - if (noside == EVAL_SKIP)
1318 - if (type_arg == NULL)
1320 - arg1 = ada_coerce_ref (arg1);
1322 - if (ada_is_packed_array_type (VALUE_TYPE (arg1)))
1323 - arg1 = ada_coerce_to_simple_array (arg1);
1325 - if (tem < 1 || tem > ada_array_arity (VALUE_TYPE (arg1)))
1326 - error ("invalid dimension number to '%s",
1327 - ada_attribute_name (atr));
1329 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1331 - type = ada_index_type (VALUE_TYPE (arg1), tem);
1333 - error ("attempt to take bound of something that is not an array");
1334 - return allocate_value (type);
1340 - error ("unexpected attribute encountered");
1342 - return ada_array_bound (arg1, tem, 0);
1344 - return ada_array_bound (arg1, tem, 1);
1346 - return ada_array_length (arg1, tem);
1349 - else if (TYPE_CODE (type_arg) == TYPE_CODE_RANGE
1350 - || TYPE_CODE (type_arg) == TYPE_CODE_INT)
1352 - struct type* range_type;
1353 - char* name = ada_type_name (type_arg);
1356 - if (TYPE_CODE (type_arg) == TYPE_CODE_RANGE)
1357 - range_type = type_arg;
1359 - error ("unimplemented type attribute");
1363 - to_fixed_range_type (name, NULL, TYPE_OBJFILE (type_arg));
1367 - error ("unexpected attribute encountered");
1369 - return value_from_longest (TYPE_TARGET_TYPE (range_type),
1370 - TYPE_LOW_BOUND (range_type));
1372 - return value_from_longest (TYPE_TARGET_TYPE (range_type),
1373 - TYPE_HIGH_BOUND (range_type));
1376 - else if (TYPE_CODE (type_arg) == TYPE_CODE_ENUM)
1381 - error ("unexpected attribute encountered");
1383 - return value_from_longest
1384 - (type_arg, TYPE_FIELD_BITPOS (type_arg, 0));
1386 - return value_from_longest
1388 - TYPE_FIELD_BITPOS (type_arg,
1389 - TYPE_NFIELDS (type_arg) - 1));
1392 - else if (TYPE_CODE (type_arg) == TYPE_CODE_FLT)
1393 - error ("unimplemented type attribute");
1396 - LONGEST low, high;
1398 - if (ada_is_packed_array_type (type_arg))
1399 - type_arg = decode_packed_array_type (type_arg);
1401 - if (tem < 1 || tem > ada_array_arity (type_arg))
1402 - error ("invalid dimension number to '%s",
1403 - ada_attribute_name (atr));
1405 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1407 - type = ada_index_type (type_arg, tem);
1409 - error ("attempt to take bound of something that is not an array");
1410 - return allocate_value (type);
1416 - error ("unexpected attribute encountered");
1418 - low = ada_array_bound_from_type (type_arg, tem, 0, &type);
1419 - return value_from_longest (type, low);
1421 - high = ada_array_bound_from_type (type_arg, tem, 1, &type);
1422 - return value_from_longest (type, high);
1424 - low = ada_array_bound_from_type (type_arg, tem, 0, &type);
1425 - high = ada_array_bound_from_type (type_arg, tem, 1, NULL);
1426 - return value_from_longest (type, high-low+1);
1432 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1433 - if (noside == EVAL_SKIP)
1436 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1438 - value_zero (ada_tag_type (arg1), not_lval);
1440 - return ada_value_tag (arg1);
1444 - evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1445 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1446 - arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1447 - if (noside == EVAL_SKIP)
1449 - else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1450 - return value_zero (VALUE_TYPE (arg1), not_lval);
1452 - return value_binop (arg1, arg2,
1453 - atr == ATR_MIN ? BINOP_MIN : BINOP_MAX);
1457 - struct type* type_arg = exp->elts[pc + 5].type;
1458 - evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1461 - if (noside == EVAL_SKIP)
1464 - if (! ada_is_modular_type (type_arg))
1465 - error ("'modulus must be applied to modular type");
1467 - return value_from_longest (TYPE_TARGET_TYPE (type_arg),
1468 - ada_modulus (type_arg));
1473 - evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1474 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1475 - if (noside == EVAL_SKIP)
1477 - else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1478 - return value_zero (builtin_type_ada_int, not_lval);
1480 - return value_pos_atr (arg1);
1483 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1484 - if (noside == EVAL_SKIP)
1486 - else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1487 - return value_zero (builtin_type_ada_int, not_lval);
1489 - return value_from_longest (builtin_type_ada_int,
1491 - * TYPE_LENGTH (VALUE_TYPE (arg1)));
1494 - evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1495 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1496 - type = exp->elts[pc + 5].type;
1497 - if (noside == EVAL_SKIP)
1499 - else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1500 - return value_zero (type, not_lval);
1502 - return value_val_atr (type, arg1);
1506 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1507 + if (noside == EVAL_SKIP)
1510 + if (noside == EVAL_AVOID_SIDE_EFFECTS)
1511 + return value_zero (ada_tag_type (arg1), not_lval);
1513 + return ada_value_tag (arg1);
1517 + evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1518 arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1519 arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1520 if (noside == EVAL_SKIP)
1522 - if (binop_user_defined_p (op, arg1, arg2))
1523 - return unwrap_value (value_x_binop (arg1, arg2, op, OP_NULL,
1525 else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1526 return value_zero (VALUE_TYPE (arg1), not_lval);
1528 - return value_binop (arg1, arg2, op);
1529 + return value_binop (arg1, arg2,
1530 + op == OP_ATR_MIN ? BINOP_MIN : BINOP_MAX);
1533 + case OP_ATR_MODULUS:
1535 + struct type *type_arg = exp->elts[pc + 2].type;
1536 + evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1538 + if (noside == EVAL_SKIP)
1541 + if (!ada_is_modular_type (type_arg))
1542 + error ("'modulus must be applied to modular type");
1544 + return value_from_longest (TYPE_TARGET_TYPE (type_arg),
1545 + ada_modulus (type_arg));
1550 + evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1551 arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1552 if (noside == EVAL_SKIP)
1554 - if (unop_user_defined_p (op, arg1))
1555 - return unwrap_value (value_x_unop (arg1, op, EVAL_NORMAL));
1556 + else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1557 + return value_zero (builtin_type_ada_int, not_lval);
1560 + return value_pos_atr (arg1);
1564 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1565 + if (noside == EVAL_SKIP)
1567 + else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1568 + return value_zero (builtin_type_ada_int, not_lval);
1570 + return value_from_longest (builtin_type_ada_int,
1572 + * TYPE_LENGTH (VALUE_TYPE (arg1)));
1575 + evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
1576 arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1577 + type = exp->elts[pc + 2].type;
1578 if (noside == EVAL_SKIP)
1580 + else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1581 + return value_zero (type, not_lval);
1583 + return value_val_atr (type, arg1);
1586 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1587 + arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1588 + if (noside == EVAL_SKIP)
1590 + else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1591 + return value_zero (VALUE_TYPE (arg1), not_lval);
1593 + return value_binop (arg1, arg2, op);
1596 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1597 + if (noside == EVAL_SKIP)
1603 + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1604 + if (noside == EVAL_SKIP)
1606 if (value_less (arg1, value_zero (VALUE_TYPE (arg1), not_lval)))
1607 - return value_neg (arg1);
1608 + return value_neg (arg1);
1614 if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
1615 - expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
1616 + expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
1617 arg1 = evaluate_subexp (expect_type, exp, pos, noside);
1618 if (noside == EVAL_SKIP)
1621 type = check_typedef (VALUE_TYPE (arg1));
1622 if (noside == EVAL_AVOID_SIDE_EFFECTS)
1624 - if (ada_is_array_descriptor (type))
1625 - /* GDB allows dereferencing GNAT array descriptors. */
1627 - struct type *arrType = ada_type_of_array (arg1, 0);
1628 - if (arrType == NULL)
1629 - error ("Attempt to dereference null array pointer.");
1630 - return value_at_lazy (arrType, 0, NULL);
1632 - else if (TYPE_CODE (type) == TYPE_CODE_PTR
1633 - || TYPE_CODE (type) == TYPE_CODE_REF
1634 - /* In C you can dereference an array to get the 1st elt. */
1635 - || TYPE_CODE (type) == TYPE_CODE_ARRAY)
1638 - (to_static_fixed_type
1639 - (ada_aligned_type (check_typedef (TYPE_TARGET_TYPE (type)))),
1641 - else if (TYPE_CODE (type) == TYPE_CODE_INT)
1642 - /* GDB allows dereferencing an int. */
1643 - return value_zero (builtin_type_int, lval_memory);
1645 - error ("Attempt to take contents of a non-pointer value.");
1647 - arg1 = ada_coerce_ref (arg1);
1649 + if (ada_is_array_descriptor_type (type))
1650 + /* GDB allows dereferencing GNAT array descriptors. */
1652 + struct type *arrType = ada_type_of_array (arg1, 0);
1653 + if (arrType == NULL)
1654 + error ("Attempt to dereference null array pointer.");
1655 + return value_at_lazy (arrType, 0, NULL);
1657 + else if (TYPE_CODE (type) == TYPE_CODE_PTR
1658 + || TYPE_CODE (type) == TYPE_CODE_REF
1659 + /* In C you can dereference an array to get the 1st elt. */
1660 + || TYPE_CODE (type) == TYPE_CODE_ARRAY)
1663 + (to_static_fixed_type
1664 + (ada_aligned_type (check_typedef (TYPE_TARGET_TYPE (type)))),
1666 + else if (TYPE_CODE (type) == TYPE_CODE_INT)
1667 + /* GDB allows dereferencing an int. */
1668 + return value_zero (builtin_type_int, lval_memory);
1670 + error ("Attempt to take contents of a non-pointer value.");
1672 + arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
1673 type = check_typedef (VALUE_TYPE (arg1));
1675 - if (ada_is_array_descriptor (type))
1676 - /* GDB allows dereferencing GNAT array descriptors. */
1677 - return ada_coerce_to_simple_array (arg1);
1678 + if (ada_is_array_descriptor_type (type))
1679 + /* GDB allows dereferencing GNAT array descriptors. */
1680 + return ada_coerce_to_simple_array (arg1);
1682 - return ada_value_ind (arg1);
1683 + return ada_value_ind (arg1);
1685 case STRUCTOP_STRUCT:
1686 tem = longest_to_int (exp->elts[pc + 1].longconst);
1687 (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
1688 arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1689 if (noside == EVAL_SKIP)
1692 if (noside == EVAL_AVOID_SIDE_EFFECTS)
1693 - return value_zero (ada_aligned_type
1694 - (ada_lookup_struct_elt_type (VALUE_TYPE (arg1),
1700 - return unwrap_value (ada_value_struct_elt (arg1,
1701 - &exp->elts[pc + 2].string,
1704 + struct type *type1 = VALUE_TYPE (arg1);
1705 + if (ada_is_tagged_type (type1, 1))
1707 + type = ada_lookup_struct_elt_type (type1,
1708 + &exp->elts[pc + 2].string,
1711 + /* In this case, we assume that the field COULD exist
1712 + in some extension of the type. Return an object of
1713 + "type" void, which will match any formal
1714 + (see ada_type_match). */
1715 + return value_zero (builtin_type_void, lval_memory);
1718 + type = ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string,
1721 + return value_zero (ada_aligned_type (type), lval_memory);
1725 + ada_to_fixed_value (unwrap_value
1726 + (ada_value_struct_elt
1727 + (arg1, &exp->elts[pc + 2].string, "record")));
1729 - /* The value is not supposed to be used. This is here to make it
1730 - easier to accommodate expressions that contain types. */
1731 + /* The value is not supposed to be used. This is here to make it
1732 + easier to accommodate expressions that contain types. */
1734 if (noside == EVAL_SKIP)
1737 else if (noside == EVAL_AVOID_SIDE_EFFECTS)
1738 - return allocate_value (builtin_type_void);
1739 + return allocate_value (builtin_type_void);
1741 - error ("Attempt to use a type name as an expression");
1743 - case STRUCTOP_PTR:
1744 - tem = longest_to_int (exp->elts[pc + 1].longconst);
1745 - (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
1746 - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
1747 - if (noside == EVAL_SKIP)
1749 - if (noside == EVAL_AVOID_SIDE_EFFECTS)
1750 - return value_zero (ada_aligned_type
1751 - (ada_lookup_struct_elt_type (VALUE_TYPE (arg1),
1757 - return unwrap_value (ada_value_struct_elt (arg1,
1758 - &exp->elts[pc + 2].string,
1759 - "record access"));
1760 + error ("Attempt to use a type name as an expression");
1764 @@ -7565,11 +9373,11 @@ nosideret:
1771 /* If TYPE encodes an Ada fixed-point type, return the suffix of the
1772 type name that encodes the 'small and 'delta information.
1773 - Otherwise, return NULL. */
1774 + Otherwise, return NULL. */
1777 fixed_type_info (struct type *type)
1778 @@ -7581,9 +9389,9 @@ fixed_type_info (struct type *type)
1780 const char *tail = strstr (name, "___XF_");
1788 else if (code == TYPE_CODE_RANGE && TYPE_TARGET_TYPE (type) != type)
1789 return fixed_type_info (TYPE_TARGET_TYPE (type));
1790 @@ -7591,7 +9399,7 @@ fixed_type_info (struct type *type)
1794 -/* Returns non-zero iff TYPE represents an Ada fixed-point type. */
1795 +/* Returns non-zero iff TYPE represents an Ada fixed-point type. */
1798 ada_is_fixed_point_type (struct type *type)
1799 @@ -7599,9 +9407,18 @@ ada_is_fixed_point_type (struct type *ty
1800 return fixed_type_info (type) != NULL;
1803 +/* Return non-zero iff TYPE represents a System.Address type. */
1806 +ada_is_system_address_type (struct type *type)
1808 + return (TYPE_NAME (type)
1809 + && strcmp (TYPE_NAME (type), "system__address") == 0);
1812 /* Assuming that TYPE is the representation of an Ada fixed-point
1813 type, return its delta, or -1 if the type is malformed and the
1814 - delta cannot be determined. */
1815 + delta cannot be determined. */
1818 ada_delta (struct type *type)
1819 @@ -7616,7 +9433,7 @@ ada_delta (struct type *type)
1822 /* Assuming that ada_is_fixed_point_type (TYPE), return the scaling
1823 - factor ('SMALL value) associated with the type. */
1824 + factor ('SMALL value) associated with the type. */
1827 scaling_factor (struct type *type)
1828 @@ -7637,7 +9454,7 @@ scaling_factor (struct type *type)
1831 /* Assuming that X is the representation of a value of fixed-point
1832 - type TYPE, return its floating-point equivalent. */
1833 + type TYPE, return its floating-point equivalent. */
1836 ada_fixed_to_float (struct type *type, LONGEST x)
1837 @@ -7645,8 +9462,8 @@ ada_fixed_to_float (struct type *type, L
1838 return (DOUBLEST) x *scaling_factor (type);
1841 -/* The representation of a fixed-point value of type TYPE
1842 - corresponding to the value X. */
1843 +/* The representation of a fixed-point value of type TYPE
1844 + corresponding to the value X. */
1847 ada_float_to_fixed (struct type *type, DOUBLEST x)
1848 @@ -7655,10 +9472,11 @@ ada_float_to_fixed (struct type *type, D
1852 - /* VAX floating formats */
1853 + /* VAX floating formats */
1855 /* Non-zero iff TYPE represents one of the special VAX floating-point
1860 ada_is_vax_floating_type (struct type *type)
1862 @@ -7667,21 +9485,23 @@ ada_is_vax_floating_type (struct type *t
1865 && (TYPE_CODE (type) == TYPE_CODE_INT
1866 - || TYPE_CODE (type) == TYPE_CODE_RANGE)
1867 - && DEPRECATED_STREQN (ada_type_name (type) + name_len - 6, "___XF", 5);
1868 + || TYPE_CODE (type) == TYPE_CODE_RANGE)
1869 + && strncmp (ada_type_name (type) + name_len - 6, "___XF", 5) == 0;
1872 /* The type of special VAX floating-point type this is, assuming
1873 - ada_is_vax_floating_point */
1874 + ada_is_vax_floating_point. */
1877 ada_vax_float_type_suffix (struct type *type)
1879 return ada_type_name (type)[strlen (ada_type_name (type)) - 1];
1882 -/* A value representing the special debugging function that outputs
1883 +/* A value representing the special debugging function that outputs
1884 VAX floating-point values of the type represented by TYPE. Assumes
1885 - ada_is_vax_floating_type (TYPE). */
1886 + ada_is_vax_floating_type (TYPE). */
1889 ada_vax_float_print_function (struct type *type)
1891 @@ -7699,13 +9519,13 @@ ada_vax_float_print_function (struct typ
1898 /* Scan STR beginning at position K for a discriminant name, and
1899 return the value of that discriminant field of DVAL in *PX. If
1900 PNEW_K is not null, put the position of the character beyond the
1901 name scanned in *PNEW_K. Return 1 if successful; return 0 and do
1902 - not alter *PX and *PNEW_K if unsuccessful. */
1903 + not alter *PX and *PNEW_K if unsuccessful. */
1906 scan_discrim_bound (char *str, int k, struct value *dval, LONGEST * px,
1907 @@ -7747,47 +9567,47 @@ scan_discrim_bound (char *str, int k, st
1909 /* Value of variable named NAME in the current environment. If
1910 no such variable found, then if ERR_MSG is null, returns 0, and
1911 - otherwise causes an error with message ERR_MSG. */
1912 + otherwise causes an error with message ERR_MSG. */
1914 static struct value *
1915 get_var_value (char *name, char *err_msg)
1917 - struct symbol **syms;
1918 - struct block **blocks;
1919 + struct ada_symbol_info *syms;
1923 - ada_lookup_symbol_list (name, get_selected_block (NULL), VAR_DOMAIN,
1925 + nsyms = ada_lookup_symbol_list (name, get_selected_block (0), VAR_DOMAIN,
1930 if (err_msg == NULL)
1934 - error ("%s", err_msg);
1935 + error ("%s", err_msg);
1938 - return value_of_variable (syms[0], blocks[0]);
1939 + return value_of_variable (syms[0].sym, syms[0].block);
1942 /* Value of integer variable named NAME in the current environment. If
1943 - no such variable found, then if ERR_MSG is null, returns 0, and sets
1944 - *FLAG to 0. If successful, sets *FLAG to 1. */
1945 + no such variable found, returns 0, and sets *FLAG to 0. If
1946 + successful, sets *FLAG to 1. */
1949 -get_int_var_value (char *name, char *err_msg, int *flag)
1950 +get_int_var_value (char *name, int *flag)
1952 - struct value *var_val = get_var_value (name, err_msg);
1953 + struct value *var_val = get_var_value (name, 0);
1967 return value_as_long (var_val);
1970 @@ -7795,18 +9615,17 @@ get_int_var_value (char *name, char *err
1972 /* Return a range type whose base type is that of the range type named
1973 NAME in the current environment, and whose bounds are calculated
1974 - from NAME according to the GNAT range encoding conventions.
1975 + from NAME according to the GNAT range encoding conventions.
1976 Extract discriminant values, if needed, from DVAL. If a new type
1977 must be created, allocate in OBJFILE's space. The bounds
1978 information, in general, is encoded in NAME, the base type given in
1979 - the named range type. */
1980 + the named range type. */
1982 static struct type *
1983 to_fixed_range_type (char *name, struct value *dval, struct objfile *objfile)
1985 struct type *raw_type = ada_find_any_type (name);
1986 struct type *base_type;
1987 - LONGEST low, high;
1990 if (raw_type == NULL)
1991 @@ -7838,43 +9657,56 @@ to_fixed_range_type (char *name, struct
1994 if (*subtype_info == 'L')
1996 - if (!ada_scan_number (bounds_str, n, &L, &n)
1997 - && !scan_discrim_bound (bounds_str, n, dval, &L, &n))
1999 - if (bounds_str[n] == '_')
2001 - else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */
2003 - subtype_info += 1;
2007 - strcpy (name_buf + prefix_len, "___L");
2008 - L = get_int_var_value (name_buf, "Index bound unknown.", NULL);
2011 + if (!ada_scan_number (bounds_str, n, &L, &n)
2012 + && !scan_discrim_bound (bounds_str, n, dval, &L, &n))
2014 + if (bounds_str[n] == '_')
2016 + else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */
2018 + subtype_info += 1;
2023 + strcpy (name_buf + prefix_len, "___L");
2024 + L = get_int_var_value (name_buf, &ok);
2027 + lim_warning ("Unknown lower bound, using 1.", 1);
2032 if (*subtype_info == 'U')
2034 - if (!ada_scan_number (bounds_str, n, &U, &n)
2035 - && !scan_discrim_bound (bounds_str, n, dval, &U, &n))
2040 - strcpy (name_buf + prefix_len, "___U");
2041 - U = get_int_var_value (name_buf, "Index bound unknown.", NULL);
2044 + if (!ada_scan_number (bounds_str, n, &U, &n)
2045 + && !scan_discrim_bound (bounds_str, n, dval, &U, &n))
2051 + strcpy (name_buf + prefix_len, "___U");
2052 + U = get_int_var_value (name_buf, &ok);
2055 + lim_warning ("Unknown upper bound, using %ld.", (long) L);
2060 if (objfile == NULL)
2061 - objfile = TYPE_OBJFILE (base_type);
2062 + objfile = TYPE_OBJFILE (base_type);
2063 type = create_range_type (alloc_type (objfile), base_type, L, U);
2064 TYPE_NAME (type) = name;
2069 -/* True iff NAME is the name of a range type. */
2070 +/* True iff NAME is the name of a range type. */
2073 ada_is_range_type_name (const char *name)
2075 @@ -7882,31 +9714,246 @@ ada_is_range_type_name (const char *name
2079 - /* Modular types */
2080 + /* Modular types */
2082 +/* True iff TYPE is an Ada modular type. */
2084 -/* True iff TYPE is an Ada modular type. */
2086 ada_is_modular_type (struct type *type)
2088 - /* FIXME: base_type should be declared in gdbtypes.h, implemented in
2090 - struct type *subranged_type; /* = base_type (type); */
2091 + struct type *subranged_type = base_type (type);
2093 return (subranged_type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
2094 - && TYPE_CODE (subranged_type) != TYPE_CODE_ENUM
2095 - && TYPE_UNSIGNED (subranged_type));
2096 + && TYPE_CODE (subranged_type) != TYPE_CODE_ENUM
2097 + && TYPE_UNSIGNED (subranged_type));
2100 -/* Assuming ada_is_modular_type (TYPE), the modulus of TYPE. */
2101 +/* Assuming ada_is_modular_type (TYPE), the modulus of TYPE. */
2104 ada_modulus (struct type * type)
2106 return TYPE_HIGH_BOUND (type) + 1;
2110 +/* Information about operators given special treatment in functions
2112 +/* Format: OP_DEFN (<operator>, <operator length>, <# args>, <binop>). */
2114 +#define ADA_OPERATORS \
2115 + OP_DEFN (OP_VAR_VALUE, 4, 0, 0) \
2116 + OP_DEFN (BINOP_IN_BOUNDS, 3, 2, 0) \
2117 + OP_DEFN (TERNOP_IN_RANGE, 1, 3, 0) \
2118 + OP_DEFN (OP_ATR_FIRST, 1, 2, 0) \
2119 + OP_DEFN (OP_ATR_LAST, 1, 2, 0) \
2120 + OP_DEFN (OP_ATR_LENGTH, 1, 2, 0) \
2121 + OP_DEFN (OP_ATR_IMAGE, 1, 2, 0) \
2122 + OP_DEFN (OP_ATR_MAX, 1, 3, 0) \
2123 + OP_DEFN (OP_ATR_MIN, 1, 3, 0) \
2124 + OP_DEFN (OP_ATR_MODULUS, 1, 1, 0) \
2125 + OP_DEFN (OP_ATR_POS, 1, 2, 0) \
2126 + OP_DEFN (OP_ATR_SIZE, 1, 1, 0) \
2127 + OP_DEFN (OP_ATR_TAG, 1, 1, 0) \
2128 + OP_DEFN (OP_ATR_VAL, 1, 2, 0) \
2129 + OP_DEFN (UNOP_QUAL, 3, 1, 0) \
2130 + OP_DEFN (UNOP_IN_RANGE, 3, 1, 0)
2133 +ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp)
2135 + switch (exp->elts[pc - 1].opcode)
2138 + operator_length_standard (exp, pc, oplenp, argsp);
2141 +#define OP_DEFN(op, len, args, binop) \
2142 + case op: *oplenp = len; *argsp = args; break;
2149 +ada_op_name (enum exp_opcode opcode)
2154 + return op_name_standard (opcode);
2155 +#define OP_DEFN(op, len, args, binop) case op: return #op;
2161 +/* As for operator_length, but assumes PC is pointing at the first
2162 + element of the operator, and gives meaningful results only for the
2163 + Ada-specific operators. */
2166 +ada_forward_operator_length (struct expression *exp, int pc,
2167 + int *oplenp, int *argsp)
2169 + switch (exp->elts[pc].opcode)
2172 + *oplenp = *argsp = 0;
2174 +#define OP_DEFN(op, len, args, binop) \
2175 + case op: *oplenp = len; *argsp = args; break;
2182 +ada_dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
2184 + enum exp_opcode op = exp->elts[elt].opcode;
2189 + ada_forward_operator_length (exp, elt, &oplen, &nargs);
2193 + /* Ada attributes ('Foo). */
2194 + case OP_ATR_FIRST:
2196 + case OP_ATR_LENGTH:
2197 + case OP_ATR_IMAGE:
2200 + case OP_ATR_MODULUS:
2207 + case UNOP_IN_RANGE:
2209 + fprintf_filtered (stream, "Type @");
2210 + gdb_print_host_address (exp->elts[pc + 1].type, stream);
2211 + fprintf_filtered (stream, " (");
2212 + type_print (exp->elts[pc + 1].type, NULL, stream, 0);
2213 + fprintf_filtered (stream, ")");
2215 + case BINOP_IN_BOUNDS:
2216 + fprintf_filtered (stream, " (%d)", (int) exp->elts[pc + 2].longconst);
2218 + case TERNOP_IN_RANGE:
2222 + return dump_subexp_body_standard (exp, stream, elt);
2226 + for (i = 0; i < nargs; i += 1)
2227 + elt = dump_subexp (exp, stream, elt);
2232 +/* The Ada extension of print_subexp (q.v.). */
2235 +ada_print_subexp (struct expression *exp, int *pos,
2236 + struct ui_file *stream, enum precedence prec)
2240 + enum exp_opcode op = exp->elts[pc].opcode;
2242 + ada_forward_operator_length (exp, pc, &oplen, &nargs);
2247 + print_subexp_standard (exp, pos, stream, prec);
2250 + case OP_VAR_VALUE:
2252 + fputs_filtered (SYMBOL_NATURAL_NAME (exp->elts[pc + 2].symbol), stream);
2255 + case BINOP_IN_BOUNDS:
2257 + print_subexp (exp, pos, stream, PREC_SUFFIX);
2258 + fputs_filtered (" in ", stream);
2259 + print_subexp (exp, pos, stream, PREC_SUFFIX);
2260 + fputs_filtered ("'range", stream);
2261 + if (exp->elts[pc + 1].longconst > 1)
2262 + fprintf_filtered (stream, "(%ld)", (long) exp->elts[pc + 1].longconst);
2265 + case TERNOP_IN_RANGE:
2267 + if (prec >= PREC_EQUAL)
2268 + fputs_filtered ("(", stream);
2269 + print_subexp (exp, pos, stream, PREC_SUFFIX);
2270 + fputs_filtered (" in ", stream);
2271 + print_subexp (exp, pos, stream, PREC_EQUAL);
2272 + fputs_filtered (" .. ", stream);
2273 + print_subexp (exp, pos, stream, PREC_EQUAL);
2274 + if (prec >= PREC_EQUAL)
2275 + fputs_filtered (")", stream);
2278 + case OP_ATR_FIRST:
2280 + case OP_ATR_LENGTH:
2281 + case OP_ATR_IMAGE:
2284 + case OP_ATR_MODULUS:
2290 + if (exp->elts[*pos].opcode == OP_TYPE)
2292 + if (TYPE_CODE (exp->elts[*pos + 1].type) != TYPE_CODE_VOID)
2293 + LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0);
2297 + print_subexp (exp, pos, stream, PREC_SUFFIX);
2298 + fprintf_filtered (stream, "'%s", ada_attribute_name (op));
2302 + for (tem = 1; tem < nargs; tem += 1)
2304 + fputs_filtered ( (tem == 1) ? " (" : ", ", stream);
2305 + print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
2307 + fputs_filtered (")", stream);
2314 + type_print (exp->elts[pc + 1].type, "", stream, 0);
2315 + fputs_filtered ("'(", stream);
2316 + print_subexp (exp, pos, stream, PREC_PREFIX);
2317 + fputs_filtered (")", stream);
2320 + case UNOP_IN_RANGE:
2322 + print_subexp (exp, pos, stream, PREC_SUFFIX);
2323 + fputs_filtered (" in ", stream);
2324 + LA_PRINT_TYPE (exp->elts[pc + 1].type, "", stream, 1, 0);
2329 /* Table mapping opcodes into strings for printing operators
2330 and precedences of the operators. */
2331 @@ -7940,12 +9987,13 @@ static const struct op_print ada_op_prin
2332 {"not ", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
2333 {"not ", UNOP_COMPLEMENT, PREC_PREFIX, 0},
2334 {"abs ", UNOP_ABS, PREC_PREFIX, 0},
2335 - {".all", UNOP_IND, PREC_SUFFIX, 1}, /* FIXME: postfix .ALL */
2336 - {"'access", UNOP_ADDR, PREC_SUFFIX, 1}, /* FIXME: postfix 'ACCESS */
2337 + {".all", UNOP_IND, PREC_SUFFIX, 1},
2338 + {"'access", UNOP_ADDR, PREC_SUFFIX, 1},
2339 + {"'size", OP_ATR_SIZE, PREC_SUFFIX, 1},
2343 - /* Assorted Types and Interfaces */
2344 + /* Assorted Types and Interfaces */
2346 struct type *builtin_type_ada_int;
2347 struct type *builtin_type_ada_short;
2348 @@ -7961,54 +10009,76 @@ struct type *builtin_type_ada_system_add
2350 struct type **const (ada_builtin_types[]) =
2353 &builtin_type_ada_int,
2354 - &builtin_type_ada_long,
2355 - &builtin_type_ada_short,
2356 - &builtin_type_ada_char,
2357 - &builtin_type_ada_float,
2358 - &builtin_type_ada_double,
2359 - &builtin_type_ada_long_long,
2360 - &builtin_type_ada_long_double,
2361 - &builtin_type_ada_natural, &builtin_type_ada_positive,
2362 - /* The following types are carried over from C for convenience. */
2364 - &builtin_type_long,
2365 - &builtin_type_short,
2366 - &builtin_type_char,
2367 - &builtin_type_float,
2368 - &builtin_type_double,
2369 - &builtin_type_long_long,
2370 - &builtin_type_void,
2371 - &builtin_type_signed_char,
2372 - &builtin_type_unsigned_char,
2373 - &builtin_type_unsigned_short,
2374 - &builtin_type_unsigned_int,
2375 - &builtin_type_unsigned_long,
2376 - &builtin_type_unsigned_long_long,
2377 - &builtin_type_long_double,
2378 - &builtin_type_complex, &builtin_type_double_complex, 0};
2379 + &builtin_type_ada_long,
2380 + &builtin_type_ada_short,
2381 + &builtin_type_ada_char,
2382 + &builtin_type_ada_float,
2383 + &builtin_type_ada_double,
2384 + &builtin_type_ada_long_long,
2385 + &builtin_type_ada_long_double,
2386 + &builtin_type_ada_natural, &builtin_type_ada_positive,
2387 + /* The following types are carried over from C for convenience. */
2388 + &builtin_type_int,
2389 + &builtin_type_long,
2390 + &builtin_type_short,
2391 + &builtin_type_char,
2392 + &builtin_type_float,
2393 + &builtin_type_double,
2394 + &builtin_type_long_long,
2395 + &builtin_type_void,
2396 + &builtin_type_signed_char,
2397 + &builtin_type_unsigned_char,
2398 + &builtin_type_unsigned_short,
2399 + &builtin_type_unsigned_int,
2400 + &builtin_type_unsigned_long,
2401 + &builtin_type_unsigned_long_long,
2402 + &builtin_type_long_double,
2403 + &builtin_type_complex,
2404 + &builtin_type_double_complex,
2408 +/* Not really used, but needed in the ada_language_defn. */
2410 -/* Not really used, but needed in the ada_language_defn. */
2412 emit_char (int c, struct ui_file *stream, int quoter)
2414 ada_emit_char (c, stream, quoter, 1);
2420 + warnings_issued = 0;
2421 + return ada_parse ();
2424 +static const struct exp_descriptor ada_exp_descriptor =
2427 + ada_operator_length,
2429 + ada_dump_subexp_body,
2430 + ada_evaluate_subexp
2433 const struct language_defn ada_language_defn = {
2434 - "ada", /* Language name */
2435 - /* language_ada, */
2437 - /* FIXME: language_ada should be defined in defs.h */
2438 + "ada", /* Language name */
2443 - case_sensitive_on, /* Yes, Ada is case-insensitive, but
2444 - * that's not quite what this means. */
2446 + case_sensitive_on, /* Yes, Ada is case-insensitive, but
2447 + that's not quite what this means. */
2449 + ada_lookup_symbol,
2450 + ada_lookup_minimal_symbol,
2452 + &ada_exp_descriptor,
2455 - ada_evaluate_subexp,
2457 ada_printchar, /* Print a character constant */
2458 ada_printstr, /* Function to print string constant */
2459 emit_char, /* Function to print single char (not used) */
2460 @@ -8017,84 +10087,97 @@ const struct language_defn ada_language_
2461 ada_val_print, /* Print a value using appropriate syntax */
2462 ada_value_print, /* Print a top-level value */
2463 NULL, /* Language specific skip_trampoline */
2464 - value_of_this, /* value_of_this */
2465 - basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
2466 + NULL, /* value_of_this */
2467 + ada_lookup_symbol_nonlocal, /* Looking up non-local symbols. */
2468 basic_lookup_transparent_type,/* lookup_transparent_type */
2469 - NULL, /* Language specific symbol demangler */
2470 + ada_la_decode, /* Language specific symbol demangler */
2471 {"", "", "", ""}, /* Binary format info */
2473 - {"8#%lo#", "8#", "o", "#"}, /* Octal format info */
2474 - {"%ld", "", "d", ""}, /* Decimal format info */
2475 - {"16#%lx#", "16#", "x", "#"}, /* Hex format info */
2476 + {"8#%lo#", "8#", "o", "#"}, /* Octal format info */
2477 + {"%ld", "", "d", ""}, /* Decimal format info */
2478 + {"16#%lx#", "16#", "x", "#"}, /* Hex format info */
2480 - /* Copied from c-lang.c. */
2481 - {"0%lo", "0", "o", ""}, /* Octal format info */
2482 - {"%ld", "", "d", ""}, /* Decimal format info */
2483 - {"0x%lx", "0x", "x", ""}, /* Hex format info */
2484 + /* Copied from c-lang.c. */
2485 + {"0%lo", "0", "o", ""}, /* Octal format info */
2486 + {"%ld", "", "d", ""}, /* Decimal format info */
2487 + {"0x%lx", "0x", "x", ""}, /* Hex format info */
2489 - ada_op_print_tab, /* expression operators for printing */
2490 - 1, /* c-style arrays (FIXME?) */
2491 - 0, /* String lower bound (FIXME?) */
2492 + ada_op_print_tab, /* expression operators for printing */
2493 + 0, /* c-style arrays */
2494 + 1, /* String lower bound */
2495 &builtin_type_ada_char,
2496 - default_word_break_characters,
2497 + ada_get_gdb_completer_word_break_characters,
2499 + ada_translate_error_message, /* Substitute Ada-specific terminology
2500 + in errors and warnings. */
2506 -_initialize_ada_language (void)
2509 +build_ada_types (void) {
2510 builtin_type_ada_int =
2511 init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
2512 - 0, "integer", (struct objfile *) NULL);
2513 + 0, "integer", (struct objfile *) NULL);
2514 builtin_type_ada_long =
2515 init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
2516 - 0, "long_integer", (struct objfile *) NULL);
2517 + 0, "long_integer", (struct objfile *) NULL);
2518 builtin_type_ada_short =
2519 init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
2520 - 0, "short_integer", (struct objfile *) NULL);
2521 + 0, "short_integer", (struct objfile *) NULL);
2522 builtin_type_ada_char =
2523 init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2524 - 0, "character", (struct objfile *) NULL);
2525 + 0, "character", (struct objfile *) NULL);
2526 builtin_type_ada_float =
2527 init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
2528 - 0, "float", (struct objfile *) NULL);
2529 + 0, "float", (struct objfile *) NULL);
2530 builtin_type_ada_double =
2531 init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
2532 - 0, "long_float", (struct objfile *) NULL);
2533 + 0, "long_float", (struct objfile *) NULL);
2534 builtin_type_ada_long_long =
2535 init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
2536 - 0, "long_long_integer", (struct objfile *) NULL);
2537 + 0, "long_long_integer", (struct objfile *) NULL);
2538 builtin_type_ada_long_double =
2539 init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
2540 - 0, "long_long_float", (struct objfile *) NULL);
2541 + 0, "long_long_float", (struct objfile *) NULL);
2542 builtin_type_ada_natural =
2543 init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
2544 - 0, "natural", (struct objfile *) NULL);
2545 + 0, "natural", (struct objfile *) NULL);
2546 builtin_type_ada_positive =
2547 init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
2548 - 0, "positive", (struct objfile *) NULL);
2549 + 0, "positive", (struct objfile *) NULL);
2552 builtin_type_ada_system_address =
2553 lookup_pointer_type (init_type (TYPE_CODE_VOID, 1, 0, "void",
2554 - (struct objfile *) NULL));
2555 + (struct objfile *) NULL));
2556 TYPE_NAME (builtin_type_ada_system_address) = "system__address";
2560 +_initialize_ada_language (void)
2563 + build_ada_types ();
2564 + deprecated_register_gdbarch_swap (NULL, 0, build_ada_types);
2565 add_language (&ada_language_defn);
2569 (add_set_cmd ("varsize-limit", class_support, var_uinteger,
2570 - (char *) &varsize_limit,
2571 - "Set maximum bytes in dynamic-sized object.",
2572 - &setlist), &showlist);
2573 + (char *) &varsize_limit,
2574 + "Set maximum bytes in dynamic-sized object.",
2575 + &setlist), &showlist);
2577 varsize_limit = 65536;
2579 - add_com ("begin", class_breakpoint, begin_command,
2580 - "Start the debugged program, stopping at the beginning of the\n\
2581 -main program. You may specify command-line arguments to give it, as for\n\
2582 -the \"run\" command (q.v.).");
2584 + obstack_init (&symbol_list_obstack);
2585 + obstack_init (&cache_space);
2587 + decoded_names_store = htab_create_alloc_ex
2588 + (256, htab_hash_string, (int (*) (const void *, const void *)) streq,
2589 + NULL, NULL, xmcalloc, xmfree);
2592 /* Create a fundamental Ada type using default reasonable for the current
2594 @@ -8130,104 +10213,104 @@ ada_create_fundamental_type (struct objf
2595 /* FIXME: For now, if we are asked to produce a type not in this
2596 language, create the equivalent of a C integer type with the
2597 name "<?type?>". When all the dust settles from the type
2598 - reconstruction work, this should probably become an error. */
2599 + reconstruction work, this should probably become an error. */
2600 type = init_type (TYPE_CODE_INT,
2601 - TARGET_INT_BIT / TARGET_CHAR_BIT,
2602 - 0, "<?type?>", objfile);
2603 + TARGET_INT_BIT / TARGET_CHAR_BIT,
2604 + 0, "<?type?>", objfile);
2605 warning ("internal error: no Ada fundamental type %d", typeid);
2608 type = init_type (TYPE_CODE_VOID,
2609 - TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2610 - 0, "void", objfile);
2611 + TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2612 + 0, "void", objfile);
2615 type = init_type (TYPE_CODE_INT,
2616 - TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2617 - 0, "character", objfile);
2618 + TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2619 + 0, "character", objfile);
2621 case FT_SIGNED_CHAR:
2622 type = init_type (TYPE_CODE_INT,
2623 - TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2624 - 0, "signed char", objfile);
2625 + TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2626 + 0, "signed char", objfile);
2628 case FT_UNSIGNED_CHAR:
2629 type = init_type (TYPE_CODE_INT,
2630 - TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2631 - TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
2632 + TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2633 + TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
2636 type = init_type (TYPE_CODE_INT,
2637 - TARGET_SHORT_BIT / TARGET_CHAR_BIT,
2638 - 0, "short_integer", objfile);
2639 + TARGET_SHORT_BIT / TARGET_CHAR_BIT,
2640 + 0, "short_integer", objfile);
2642 case FT_SIGNED_SHORT:
2643 type = init_type (TYPE_CODE_INT,
2644 - TARGET_SHORT_BIT / TARGET_CHAR_BIT,
2645 - 0, "short_integer", objfile);
2646 + TARGET_SHORT_BIT / TARGET_CHAR_BIT,
2647 + 0, "short_integer", objfile);
2649 case FT_UNSIGNED_SHORT:
2650 type = init_type (TYPE_CODE_INT,
2651 - TARGET_SHORT_BIT / TARGET_CHAR_BIT,
2652 - TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
2653 + TARGET_SHORT_BIT / TARGET_CHAR_BIT,
2654 + TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
2657 type = init_type (TYPE_CODE_INT,
2658 - TARGET_INT_BIT / TARGET_CHAR_BIT,
2659 - 0, "integer", objfile);
2660 + TARGET_INT_BIT / TARGET_CHAR_BIT,
2661 + 0, "integer", objfile);
2663 case FT_SIGNED_INTEGER:
2664 - type = init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, 0, "integer", objfile); /* FIXME -fnf */
2665 + type = init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, 0, "integer", objfile); /* FIXME -fnf */
2667 case FT_UNSIGNED_INTEGER:
2668 type = init_type (TYPE_CODE_INT,
2669 - TARGET_INT_BIT / TARGET_CHAR_BIT,
2670 - TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
2671 + TARGET_INT_BIT / TARGET_CHAR_BIT,
2672 + TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
2675 type = init_type (TYPE_CODE_INT,
2676 - TARGET_LONG_BIT / TARGET_CHAR_BIT,
2677 - 0, "long_integer", objfile);
2678 + TARGET_LONG_BIT / TARGET_CHAR_BIT,
2679 + 0, "long_integer", objfile);
2681 case FT_SIGNED_LONG:
2682 type = init_type (TYPE_CODE_INT,
2683 - TARGET_LONG_BIT / TARGET_CHAR_BIT,
2684 - 0, "long_integer", objfile);
2685 + TARGET_LONG_BIT / TARGET_CHAR_BIT,
2686 + 0, "long_integer", objfile);
2688 case FT_UNSIGNED_LONG:
2689 type = init_type (TYPE_CODE_INT,
2690 - TARGET_LONG_BIT / TARGET_CHAR_BIT,
2691 - TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
2692 + TARGET_LONG_BIT / TARGET_CHAR_BIT,
2693 + TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
2696 type = init_type (TYPE_CODE_INT,
2697 - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
2698 - 0, "long_long_integer", objfile);
2699 + TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
2700 + 0, "long_long_integer", objfile);
2702 case FT_SIGNED_LONG_LONG:
2703 type = init_type (TYPE_CODE_INT,
2704 - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
2705 - 0, "long_long_integer", objfile);
2706 + TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
2707 + 0, "long_long_integer", objfile);
2709 case FT_UNSIGNED_LONG_LONG:
2710 type = init_type (TYPE_CODE_INT,
2711 - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
2712 - TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
2713 + TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
2714 + TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
2717 type = init_type (TYPE_CODE_FLT,
2718 - TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
2719 - 0, "float", objfile);
2720 + TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
2721 + 0, "float", objfile);
2723 case FT_DBL_PREC_FLOAT:
2724 type = init_type (TYPE_CODE_FLT,
2725 - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
2726 - 0, "long_float", objfile);
2727 + TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
2728 + 0, "long_float", objfile);
2730 case FT_EXT_PREC_FLOAT:
2731 type = init_type (TYPE_CODE_FLT,
2732 - TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
2733 - 0, "long_long_float", objfile);
2734 + TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
2735 + 0, "long_long_float", objfile);
2739 @@ -8239,16 +10322,16 @@ ada_dump_symtab (struct symtab *s)
2741 fprintf (stderr, "New symtab: [\n");
2742 fprintf (stderr, " Name: %s/%s;\n",
2743 - s->dirname ? s->dirname : "?", s->filename ? s->filename : "?");
2744 + s->dirname ? s->dirname : "?", s->filename ? s->filename : "?");
2745 fprintf (stderr, " Format: %s;\n", s->debugformat);
2746 if (s->linetable != NULL)
2748 fprintf (stderr, " Line table (section %d):\n", s->block_line_section);
2749 for (i = 0; i < s->linetable->nitems; i += 1)
2751 - struct linetable_entry *e = s->linetable->item + i;
2752 - fprintf (stderr, " %4ld: %8lx\n", (long) e->line, (long) e->pc);
2755 + struct linetable_entry *e = s->linetable->item + i;
2756 + fprintf (stderr, " %4ld: %8lx\n", (long) e->line, (long) e->pc);
2759 fprintf (stderr, "]\n");
2761 Index: gdb/ada-lang.h
2762 ===================================================================
2763 RCS file: /cvs/src/src/gdb/ada-lang.h,v
2764 retrieving revision 1.6
2765 diff -u -p -r1.6 ada-lang.h
2766 --- gdb/ada-lang.h 24 May 2003 03:21:42 -0000 1.6
2767 +++ gdb/ada-lang.h 2 Jun 2004 09:52:56 -0000
2769 /* Ada language support definitions for GDB, the GNU debugger.
2770 - Copyright 1992, 1997 Free Software Foundation, Inc.
2771 + Copyright 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
2772 + Free Software Foundation, Inc.
2774 This file is part of GDB.
2776 @@ -24,130 +25,103 @@ struct partial_symbol;
2779 #include "gdbtypes.h"
2780 +#include "breakpoint.h"
2783 +/* Names of specific files known to be part of the runtime
2784 + system and that might consider (confusing) debugging information.
2785 + Each name (a basic regular expression string) is followed by a
2786 + comma. FIXME: Should be part of a configuration file. */
2787 +#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)
2788 +#define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
2789 + "^[agis]-.*\\.ad[bs]$", \
2790 + "/usr/shlib/libpthread\\.so",
2791 +#elif defined (__linux__)
2792 +#define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
2793 + "^[agis]-.*\\.ad[bs]$", \
2794 + "/lib.*/libpthread\\.so[.0-9]*$", "/lib.*/libpthread\\.a$", \
2795 + "/lib.*/libc\\.so[.0-9]*$", "/lib.*/libc\\.a$",
2798 +#if !defined (ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS)
2799 +#define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
2800 + "^[agis]-.*\\.ad[bs]$",
2803 -/* A macro to reorder the bytes of an address depending on the
2804 - endiannes of the target. */
2805 -#define EXTRACT_ADDRESS(x) ((void *) extract_unsigned_integer (&(x), sizeof (x)))
2806 -/* A macro to reorder the bytes of an int depending on the endiannes
2808 -#define EXTRACT_INT(x) ((int) extract_signed_integer (&(x), sizeof (x)))
2810 -/* Chain of cleanups for arguments of OP_UNRESOLVED_VALUE names. Created in
2811 - yyparse and freed in ada_resolve. */
2812 -extern struct cleanup *unresolved_names;
2813 +/* Names of compiler-generated auxiliary functions probably of no
2814 + interest to users. Each name (a basic regular expression string)
2815 + is followed by a comma. */
2816 +#define ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS \
2817 + "___clean[.a-zA-Z0-9_]*$",
2819 +/* The maximum number of frame levels searched for non-local,
2820 + * non-global symbols. This limit exists as a precaution to prevent
2821 + * infinite search loops when the stack is screwed up. */
2822 +#define MAX_ENCLOSING_FRAME_LEVELS 7
2824 +/* Maximum number of steps followed in looking for the ultimate
2825 + referent of a renaming. This prevents certain infinite loops that
2826 + can otherwise result. */
2827 +#define MAX_RENAMING_CHAIN_LENGTH 10
2829 -/* Corresponding mangled/demangled names and opcodes for Ada user-definable
2832 +/* Corresponding encoded/decoded names and opcodes for Ada user-definable
2834 struct ada_opname_map
2836 - const char *mangled;
2837 - const char *demangled;
2838 + const char *encoded;
2839 + const char *decoded;
2843 -/* Table of Ada operators in mangled and demangled forms. */
2844 +/* Table of Ada operators in encoded and decoded forms. */
2845 /* Defined in ada-lang.c */
2846 extern const struct ada_opname_map ada_opname_table[];
2848 -/* The maximum number of tasks known to the Ada runtime */
2849 -extern const int MAX_NUMBER_OF_KNOWN_TASKS;
2851 -/* Identifiers for Ada attributes that need special processing. Be sure
2852 - to update the table attribute_names in ada-lang.c whenever you change this.
2857 - /* Invalid attribute for error checking. */
2873 - /* Dummy last attribute. */
2884 - Entry_Caller_Sleep,
2885 - Async_Select_Sleep,
2887 - Master_Completion_Sleep,
2888 - Master_Phase_2_Sleep
2891 -extern char *ada_task_states[];
2900 -typedef struct entry_call
2909 -#if (defined (VXWORKS_TARGET) || !defined (i386)) \
2910 - && !(defined (VXWORKS_TARGET) && defined (M68K_TARGET))
2914 -#if (defined (VXWORKS_TARGET) && defined (M68K_TARGET))
2919 - int current_priority;
2921 - entry_call_link call;
2922 -#if (defined (sun) && defined (__SVR4)) && !defined (VXWORKS_TARGET)
2931 -#if (defined (VXWORKS_TARGET) && defined (M68K_TARGET))
2932 -__attribute__ ((packed))
2940 - int known_tasks_index;
2941 - struct task_entry *next_task;
2947 + /* X IN A'RANGE(N). N is an immediate operand, surrounded by
2948 + BINOP_IN_BOUNDS before and after. A is an array, X an index
2949 + value. Evaluates to true iff X is within range of the Nth
2950 + dimension (1-based) of A. (A multi-dimensional array
2951 + type is represented as array of array of ...) */
2952 + BINOP_IN_BOUNDS = OP_EXTENDED0,
2954 + /* X IN L .. U. True iff L <= X <= U. */
2957 + /* Ada attributes ('Foo). */
2970 + /* Ada type qualification. It is encoded as for UNOP_CAST, above,
2971 + and denotes the TYPE'(EXPR) construct. */
2974 + /* X IN TYPE. The `TYPE' argument is immediate, with
2975 + UNOP_IN_RANGE before and after it. True iff X is a member of
2976 + type TYPE (typically a subrange). */
2983 +/* A triple, (symbol, block, symtab), representing one instance of a
2984 + * symbol-lookup operation. */
2985 +struct ada_symbol_info {
2986 + struct symbol* sym;
2987 + struct block* block;
2988 + struct symtab* symtab;
2991 extern struct type *builtin_type_ada_int;
2992 @@ -162,33 +136,40 @@ extern struct type *builtin_type_ada_nat
2993 extern struct type *builtin_type_ada_positive;
2994 extern struct type *builtin_type_ada_system_address;
2996 -/* Assuming V points to an array of S objects, make sure that it contains at
2997 +/* The maximum number of tasks known to the Ada runtime */
2998 +extern const int MAX_NUMBER_OF_KNOWN_TASKS;
3000 +/* Assuming V points to an array of S objects, make sure that it contains at
3001 least M objects, updating V and S as necessary. */
3003 -#define GROW_VECT(v, s, m) \
3004 +#define GROW_VECT(v, s, m) \
3005 if ((s) < (m)) grow_vect ((void**) &(v), &(s), (m), sizeof(*(v)));
3007 extern void grow_vect (void **, size_t *, size_t, int);
3009 -extern int ada_parse (void); /* Defined in ada-exp.y */
3010 +extern int ada_get_field_index (const struct type *type,
3011 + const char *field_name,
3012 + int maybe_missing);
3014 +extern int ada_parse (void); /* Defined in ada-exp.y */
3016 -extern void ada_error (char *); /* Defined in ada-exp.y */
3017 +extern void ada_error (char *); /* Defined in ada-exp.y */
3019 - /* Defined in ada-typeprint.c */
3020 + /* Defined in ada-typeprint.c */
3021 extern void ada_print_type (struct type *, char *, struct ui_file *, int,
3025 extern int ada_val_print (struct type *, char *, int, CORE_ADDR,
3026 - struct ui_file *, int, int, int,
3027 - enum val_prettyprint);
3028 + struct ui_file *, int, int, int,
3029 + enum val_prettyprint);
3031 extern int ada_value_print (struct value *, struct ui_file *, int,
3032 - enum val_prettyprint);
3033 + enum val_prettyprint);
3035 - /* Defined in ada-lang.c */
3036 + /* Defined in ada-lang.c */
3038 extern struct value *value_from_contents_and_address (struct type *, char *,
3042 extern void ada_emit_char (int, struct ui_file *, int, int);
3044 @@ -197,10 +178,10 @@ extern void ada_printchar (int, struct u
3045 extern void ada_printstr (struct ui_file *, char *, unsigned int, int, int);
3047 extern void ada_convert_actuals (struct value *, int, struct value **,
3051 extern struct value *ada_value_subscript (struct value *, int,
3055 extern struct type *ada_array_element_type (struct type *, int);
3057 @@ -208,13 +189,11 @@ extern int ada_array_arity (struct type
3059 struct type *ada_type_of_array (struct value *, int);
3061 -extern struct value *ada_coerce_to_simple_array (struct value *);
3063 extern struct value *ada_coerce_to_simple_array_ptr (struct value *);
3065 -extern int ada_is_simple_array (struct type *);
3066 +extern int ada_is_simple_array_type (struct type *);
3068 -extern int ada_is_array_descriptor (struct type *);
3069 +extern int ada_is_array_descriptor_type (struct type *);
3071 extern int ada_is_bogus_array_descriptor (struct type *);
3073 @@ -222,34 +201,43 @@ extern struct type *ada_index_type (stru
3075 extern struct value *ada_array_bound (struct value *, int, int);
3077 -extern int ada_lookup_symbol_list (const char *, struct block *,
3078 - domain_enum, struct symbol ***,
3079 - struct block ***);
3080 +extern char *ada_decode_symbol (const struct general_symbol_info*);
3082 -extern char *ada_fold_name (const char *);
3083 +extern const char *ada_decode (const char*);
3085 +extern enum language ada_update_initial_language (enum language,
3086 + struct partial_symtab*);
3088 -extern struct symbol *ada_lookup_symbol (const char *, struct block *,
3090 +extern void clear_ada_sym_cache (void);
3092 -extern struct minimal_symbol *ada_lookup_minimal_symbol (const char *);
3093 +extern char **ada_make_symbol_completion_list (const char *text0,
3094 + const char *word);
3096 -extern void ada_resolve (struct expression **, struct type *);
3097 +extern int ada_lookup_symbol_list (const char *, const struct block *,
3098 + domain_enum, struct ada_symbol_info**);
3100 +extern char *ada_fold_name (const char *);
3102 -extern int ada_resolve_function (struct symbol **, struct block **, int,
3103 - struct value **, int, const char *,
3105 +extern struct symbol *ada_lookup_symbol (const char *, const struct block *,
3106 + domain_enum, int *,
3107 + struct symtab **);
3109 +extern struct minimal_symbol *ada_lookup_simple_minsym (const char *);
3111 extern void ada_fill_in_ada_prototype (struct symbol *);
3113 -extern int user_select_syms (struct symbol **, struct block **, int, int);
3114 +extern int user_select_syms (struct ada_symbol_info *, int, int);
3116 extern int get_selections (int *, int, int, int, char *);
3118 extern char *ada_start_decode_line_1 (char *);
3120 extern struct symtabs_and_lines ada_finish_decode_line_1 (char **,
3126 +extern struct symtabs_and_lines ada_sals_for_line (const char*, int,
3127 + int, char***, int);
3129 extern int ada_scan_number (const char *, int, LONGEST *, int *);
3131 @@ -260,8 +248,8 @@ extern int ada_is_ignored_field (struct
3132 extern int ada_is_packed_array_type (struct type *);
3134 extern struct value *ada_value_primitive_packed_val (struct value *, char *,
3140 extern struct type *ada_coerce_to_simple_array_type (struct type *);
3142 @@ -269,12 +257,16 @@ extern int ada_is_character_type (struct
3144 extern int ada_is_string_type (struct type *);
3146 -extern int ada_is_tagged_type (struct type *);
3147 +extern int ada_is_tagged_type (struct type *, int);
3149 +extern int ada_is_tag_type (struct type *);
3151 extern struct type *ada_tag_type (struct value *);
3153 extern struct value *ada_value_tag (struct value *);
3155 +extern const char *ada_tag_name (struct value *);
3157 extern int ada_is_parent_field (struct type *, int);
3159 extern int ada_is_wrapper_field (struct type *, int);
3160 @@ -289,24 +281,20 @@ extern int ada_in_variant (LONGEST, stru
3162 extern char *ada_variant_discrim_name (struct type *);
3164 -extern struct type *ada_lookup_struct_elt_type (struct type *, char *, int,
3167 extern struct value *ada_value_struct_elt (struct value *, char *, char *);
3169 -extern struct value *ada_search_struct_field (char *, struct value *, int,
3172 extern int ada_is_aligner_type (struct type *);
3174 extern struct type *ada_aligned_type (struct type *);
3176 extern char *ada_aligned_value_addr (struct type *, char *);
3178 -extern const char *ada_attribute_name (int);
3179 +extern const char *ada_attribute_name (enum exp_opcode);
3181 extern int ada_is_fixed_point_type (struct type *);
3183 +extern int ada_is_system_address_type (struct type *);
3185 extern DOUBLEST ada_delta (struct type *);
3187 extern DOUBLEST ada_fixed_to_float (struct type *, LONGEST);
3188 @@ -323,30 +311,37 @@ extern struct type *ada_system_address_t
3190 extern int ada_which_variant_applies (struct type *, struct type *, char *);
3192 -extern struct value *ada_to_fixed_value (struct type *, char *, CORE_ADDR,
3195 extern struct type *ada_to_fixed_type (struct type *, char *, CORE_ADDR,
3199 +extern struct type *
3200 + ada_template_to_fixed_record_type_1 (struct type *type, char *valaddr,
3201 + CORE_ADDR address, struct value *dval0,
3202 + int keep_dynamic_fields);
3204 extern int ada_name_prefix_len (const char *);
3206 extern char *ada_type_name (struct type *);
3208 extern struct type *ada_find_parallel_type (struct type *,
3209 - const char *suffix);
3210 + const char *suffix);
3212 +extern LONGEST get_int_var_value (char *, int *);
3214 -extern LONGEST get_int_var_value (char *, char *, int *);
3215 +extern struct symbol *ada_find_any_symbol (const char *name);
3217 extern struct type *ada_find_any_type (const char *name);
3219 +extern struct symbol *ada_find_renaming_symbol (const char *name,
3220 + struct block *block);
3222 extern int ada_prefer_type (struct type *, struct type *);
3224 extern struct type *ada_get_base_type (struct type *);
3226 extern struct type *ada_completed_type (struct type *);
3228 -extern char *ada_mangle (const char *);
3229 +extern char *ada_encode (const char *);
3231 extern const char *ada_enum_name (const char *);
3233 @@ -364,29 +359,38 @@ extern const char *ada_renaming_type (st
3235 extern int ada_is_object_renaming (struct symbol *);
3237 -extern const char *ada_simple_renamed_entity (struct symbol *);
3238 +extern char *ada_simple_renamed_entity (struct symbol *);
3240 extern char *ada_breakpoint_rewrite (char *, int *);
3242 +extern char *ada_main_name (void);
3244 /* Tasking-related: ada-tasks.c */
3246 extern int valid_task_id (int);
3248 -extern int get_current_task (void);
3250 extern void init_task_list (void);
3252 -extern void *get_self_id (void);
3253 +extern int ada_is_exception_breakpoint (bpstat bs);
3255 +extern void ada_adjust_exception_stop (bpstat bs);
3257 -extern int get_current_task (void);
3258 +extern void ada_print_exception_stop (bpstat bs);
3260 -extern int get_entry_number (void *);
3261 +extern int ada_get_current_task (ptid_t);
3263 -extern void ada_report_exception_break (struct breakpoint *);
3264 +extern int breakpoint_ada_task_match (CORE_ADDR, ptid_t);
3266 +extern int ada_print_exception_breakpoint_nontask (struct breakpoint *);
3268 +extern void ada_print_exception_breakpoint_task (struct breakpoint *);
3270 extern int ada_maybe_exception_partial_symbol (struct partial_symbol *sym);
3272 extern int ada_is_exception_sym (struct symbol *sym);
3274 +extern void ada_find_printable_frame (struct frame_info *fi);
3276 +extern void ada_reset_thread_registers (void);