* inftarg.c (child_thread_alive): New function to see if a
[deliverable/binutils-gdb.git] / gdb / parse.c
index a16be75309757055277462773e27b06777f54914..36f7c3917b4d23d9a2c23bf0a5fe4587900ddb20 100644 (file)
@@ -354,12 +354,16 @@ write_exp_bitstring (str)
   write_exp_elt_longcst ((LONGEST) bits);
 }
 
-/* Type that corresponds to the address given in a minimal symbol.  */
-
-static struct type *msymbol_addr_type;
-
 /* Add the appropriate elements for a minimal symbol to the end of
-   the expression.  */
+   the expression.  The rationale behind passing in text_symbol_type and
+   data_symbol_type was so that Modula-2 could pass in WORD for
+   data_symbol_type.  Perhaps it still is useful to have those types vary
+   based on the language, but they no longer have names like "int", so
+   the initial rationale is gone.  */
+
+static struct type *msym_text_symbol_type;
+static struct type *msym_data_symbol_type;
+static struct type *msym_unknown_symbol_type;
 
 void
 write_exp_msymbol (msymbol, text_symbol_type, data_symbol_type)
@@ -368,7 +372,7 @@ write_exp_msymbol (msymbol, text_symbol_type, data_symbol_type)
      struct type *data_symbol_type;
 {
   write_exp_elt_opcode (OP_LONG);
-  write_exp_elt_type (msymbol_addr_type);
+  write_exp_elt_type (lookup_pointer_type (builtin_type_void));
   write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
   write_exp_elt_opcode (OP_LONG);
 
@@ -378,18 +382,18 @@ write_exp_msymbol (msymbol, text_symbol_type, data_symbol_type)
     case mst_text:
     case mst_file_text:
     case mst_solib_trampoline:
-      write_exp_elt_type (text_symbol_type);
+      write_exp_elt_type (msym_text_symbol_type);
       break;
 
     case mst_data:
     case mst_file_data:
     case mst_bss:
     case mst_file_bss:
-      write_exp_elt_type (data_symbol_type);
+      write_exp_elt_type (msym_data_symbol_type);
       break;
 
     default:
-      write_exp_elt_type (builtin_type_char);
+      write_exp_elt_type (msym_unknown_symbol_type);
       break;
     }
   write_exp_elt_opcode (UNOP_MEMVAL);
@@ -466,12 +470,7 @@ length_of_subexp (expr, endpos)
       oplen = 3;
       break;
 
-    case OP_F77_LITERAL_COMPLEX:
-      oplen = 1; 
-      args = 2;
-      break; 
-
-    case OP_F77_SUBSTR:
+    case OP_COMPLEX:
       oplen = 1; 
       args = 2;
       break; 
@@ -506,6 +505,7 @@ length_of_subexp (expr, endpos)
       args = 1;
       break;
 
+    case OP_LABELED:
     case STRUCTOP_STRUCT:
     case STRUCTOP_PTR:
       args = 1;
@@ -530,13 +530,13 @@ length_of_subexp (expr, endpos)
       break;
 
     case TERNOP_COND:
+    case TERNOP_SLICE:
+    case TERNOP_SLICE_COUNT:
       args = 3;
       break;
 
       /* Modula-2 */
    case MULTI_SUBSCRIPT:
-      /* Fortran */
-   case MULTI_F77_SUBSCRIPT:
       oplen = 3;
       args = 1 + longest_to_int (expr->elts[endpos- 2].longconst);
       break;
@@ -608,12 +608,7 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
       oplen = 3;
       break;
 
-    case OP_F77_LITERAL_COMPLEX:
-      oplen = 1; 
-      args = 2; 
-      break; 
-
-   case OP_F77_SUBSTR:
+    case OP_COMPLEX:
       oplen = 1; 
       args = 2; 
       break; 
@@ -649,6 +644,7 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
 
     case STRUCTOP_STRUCT:
     case STRUCTOP_PTR:
+    case OP_LABELED:
       args = 1;
       /* fall through */
     case OP_M2_STRING:
@@ -671,6 +667,8 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
       break;
 
     case TERNOP_COND:
+    case TERNOP_SLICE:
+    case TERNOP_SLICE_COUNT:
       args = 3;
       break;
 
@@ -681,8 +679,6 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
 
       /* Modula-2 */
    case MULTI_SUBSCRIPT:
-      /* Fortran */
-   case MULTI_F77_SUBSCRIPT:
       oplen = 3;
       args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst);
       break;
@@ -879,20 +875,22 @@ follow_types (follow_type)
        break;
       case tp_array:
        array_size = pop_type_int ();
-       if (array_size != -1)
-         {
-           range_type =
-             create_range_type ((struct type *) NULL,
-                                builtin_type_int, 0,
-                                array_size - 1);
-           follow_type =
-             create_array_type ((struct type *) NULL,
-                                follow_type, range_type);
-         }
-       else
-         follow_type = lookup_pointer_type (follow_type);
+       /* FIXME-type-allocation: need a way to free this type when we are
+          done with it.  */
+       range_type =
+         create_range_type ((struct type *) NULL,
+                            builtin_type_int, 0,
+                            array_size >= 0 ? array_size - 1 : 0);
+       follow_type =
+         create_array_type ((struct type *) NULL,
+                            follow_type, range_type);
+       if (array_size < 0)
+         TYPE_ARRAY_UPPER_BOUND_TYPE(follow_type)
+           = BOUND_CANNOT_BE_DETERMINED;
        break;
       case tp_function:
+       /* FIXME-type-allocation: need a way to free this type when we are
+          done with it.  */
        follow_type = lookup_function_type (follow_type);
        break;
       }
@@ -907,10 +905,14 @@ _initialize_parse ()
   type_stack = (union type_stack_elt *)
     xmalloc (type_stack_size * sizeof (*type_stack));
 
-  /* We don't worry too much about what the name of this type is
-     because the name should rarely appear in output to the user.  */
-
-  msymbol_addr_type =
-    init_type (TYPE_CODE_PTR, TARGET_PTR_BIT / HOST_CHAR_BIT, 0,
-              "void *", NULL);
+  msym_text_symbol_type =
+    init_type (TYPE_CODE_FUNC, 1, 0, "<text variable, no debug info>", NULL);
+  TYPE_TARGET_TYPE (msym_text_symbol_type) = builtin_type_int;
+  msym_data_symbol_type =
+    init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0,
+              "<data variable, no debug info>", NULL);
+  msym_unknown_symbol_type =
+    init_type (TYPE_CODE_INT, 1, 0,
+              "<variable (not text or data), no debug info>",
+              NULL);
 }
This page took 0.025301 seconds and 4 git commands to generate.