* gdbtypes.c (create_array_type): If TYPE_LENGTH (result_type)
authorWilfried Moser <moser@cygnus>
Wed, 26 Jun 1996 13:13:45 +0000 (13:13 +0000)
committerWilfried Moser <moser@cygnus>
Wed, 26 Jun 1996 13:13:45 +0000 (13:13 +0000)
        is zero, set TYPE_FLAG_TARGET_STUB to force reevaluation of the type.

        * ch-exp.c (calculate_array_length): Function removed.

gdb/ChangeLog
gdb/ch-exp.c
gdb/gdbtypes.c

index 35fb4fa9ee2e5141ea3fa5eb3b9bf7af8f505645..dae855c7d32f20f7eb79fb29a53fa84dfdd4aa2c 100644 (file)
@@ -1,3 +1,10 @@
+Wed Jun 26 06:05:39 1996  Wilfried Moser (Alcatel)  <moser@rtl.cygnus.com>
+
+       * gdbtypes.c (create_array_type): If TYPE_LENGTH (result_type)
+       is zero, set TYPE_FLAG_TARGET_STUB to force reevaluation of the type.
+
+       * ch-exp.c (calculate_array_length): Function removed.
+
 Tue Jun 25 17:41:06 1996  Martin M. Hunt  <hunt@pizza.cygnus.com>
 
        * remote-e7000.c (e7000_read_inferior_memory_large): New function.
index db1188faac1eef82f37a3acdce92bbd32f9aee0a..f6f522ab4a672dc6248ed3e29fc36610c5eb2cb8 100644 (file)
@@ -138,7 +138,6 @@ static int parse_opt_untyped_expr ();
 static void parse_if_expression_body PARAMS((void));
 static void write_lower_upper_value PARAMS ((enum exp_opcode, struct type *));
 static enum ch_terminal ch_lex ();
-static void calculate_array_length PARAMS ((struct type *));
 
 #define MAX_LOOK_AHEAD 2
 static enum ch_terminal terminal_buffer[MAX_LOOK_AHEAD+1] = {
@@ -674,20 +673,11 @@ parse_primval ()
       break;
     case GENERAL_PROCEDURE_NAME:
     case LOCATION_NAME:
-      {
-       struct type *type;
-
-       /* FIXME: look at calculate_array_length */
-       type = PEEK_LVAL().ssym.sym->type;
-       if (type && TYPE_CODE (type) == TYPE_CODE_ARRAY &&
-           TYPE_LENGTH (type) == 0)
-         calculate_array_length (type);
-       write_exp_elt_opcode (OP_VAR_VALUE);
-       write_exp_elt_block (NULL);
-       write_exp_elt_sym (PEEK_LVAL ().ssym.sym);
-       write_exp_elt_opcode (OP_VAR_VALUE);
-       FORWARD_TOKEN ();
-      }
+      write_exp_elt_opcode (OP_VAR_VALUE);
+      write_exp_elt_block (NULL);
+      write_exp_elt_sym (PEEK_LVAL ().ssym.sym);
+      write_exp_elt_opcode (OP_VAR_VALUE);
+      FORWARD_TOKEN ();
       break;
     case GDB_VARIABLE: /* gdb specific */
       FORWARD_TOKEN ();
@@ -2035,7 +2025,6 @@ ch_lex ()
                break;
              case LOC_TYPEDEF:
                yylval.tsym.type = SYMBOL_TYPE (sym);
-               calculate_array_length (yylval.tsym.type);
                return TYPENAME;
              case LOC_UNDEF:
              case LOC_CONST_BYTES:
@@ -2093,49 +2082,6 @@ write_lower_upper_value (opcode, type)
     }
 }
 
-/* In certain cases it could happen, that an array type doesn't
-   have a length (this have to do with seizing). The reason is
-   shown in the following stabs:
-
-   .stabs "m_x:Tt81=s36i:1,0,32;ar:82=ar80;0;1;83=xsm_struct:,32,256;;",128,0,25,0
-  
-   .stabs "m_struct:Tt83=s16f1:9,0,16;f2:85=*84,32,32;f3:84,64,64;;",128,0,10,0
-
-   When processing t81, the array ar80 doesn't have a length, cause
-   struct m_struct is specified extern at thse moment. Afterwards m_struct
-   gets specified and updated, but not the surrounding type.
-
-   So we walk through array's till we find a type with a length and
-   calculate the array length.
-
-   FIXME: Where may this happen too ?
-   */
-
-static void
-calculate_array_length (type)
-     struct type *type;
-{
-  struct type *target_type;
-  struct type *range_type;
-  LONGEST lower_bound, upper_bound;
-
-  if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
-    /* not an array, stop processing */
-    return;
-
-  target_type = TYPE_TARGET_TYPE (type);
-  range_type = TYPE_FIELD_TYPE (type, 0);
-  lower_bound = TYPE_FIELD_BITPOS (range_type, 0);
-  upper_bound = TYPE_FIELD_BITPOS (range_type, 1);
-
-  if (TYPE_LENGTH (target_type) == 0 &&
-      TYPE_CODE (target_type) == TYPE_CODE_ARRAY)
-    /* we've got another array */
-    calculate_array_length (target_type);
-
-  TYPE_LENGTH (type) = (upper_bound - lower_bound + 1) * TYPE_LENGTH (target_type);
-}
-
 void
 chill_error (msg)
      char *msg;
index 44827ab96d8dfaba394b49b235f568441c452a66..de15b5ad367df514adf27f84750954124fbab162 100644 (file)
@@ -437,6 +437,10 @@ create_array_type (result_type, element_type, range_type)
   TYPE_FIELD_TYPE (result_type, 0) = range_type;
   TYPE_VPTR_FIELDNO (result_type) = -1;
 
+  /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */
+  if (TYPE_LENGTH (result_type) == 0)
+    TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB;
+
   return (result_type);
 }
 
This page took 0.029349 seconds and 4 git commands to generate.