* remote.c (minitelnet): Don't redeclare escape_count, echo_check.
[binutils-gdb.git] / gdb / f-valprint.c
index a70a47c0b7ab75370701ca54f18c165cf505f030..f67a260d24c0a64e00d39ebf60f40f4838293279 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing Fortran values for GDB, the GNU debugger.
-   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000
+   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003
    Free Software Foundation, Inc.
    Contributed by Motorola.  Adapted from the C definitions by Farooq Butt
    (fmbutt@engage.sps.mot.com), additionally worked over by Stan Shebs.
 #include "gdbtypes.h"
 #include "expression.h"
 #include "value.h"
-#include "demangle.h"
 #include "valprint.h"
 #include "language.h"
 #include "f-lang.h"
 #include "frame.h"
 #include "gdbcore.h"
 #include "command.h"
+#include "block.h"
 
 #if 0
 static int there_is_a_visible_common_named (char *);
@@ -75,7 +75,7 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
   switch (TYPE_ARRAY_LOWER_BOUND_TYPE (type))
     {
     case BOUND_BY_VALUE_ON_STACK:
-      current_frame_addr = selected_frame->frame;
+      current_frame_addr = get_frame_base (deprecated_selected_frame);
       if (current_frame_addr > 0)
        {
          *lower_bound =
@@ -99,13 +99,13 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
       break;
 
     case BOUND_BY_REF_ON_STACK:
-      current_frame_addr = selected_frame->frame;
+      current_frame_addr = get_frame_base (deprecated_selected_frame);
       if (current_frame_addr > 0)
        {
          ptr_to_lower_bound =
-           read_memory_integer (current_frame_addr +
-                                TYPE_ARRAY_LOWER_BOUND_VALUE (type),
-                                4);
+           read_memory_typed_address (current_frame_addr +
+                                      TYPE_ARRAY_LOWER_BOUND_VALUE (type),
+                                      builtin_type_void_data_ptr);
          *lower_bound = read_memory_integer (ptr_to_lower_bound, 4);
        }
       else
@@ -133,7 +133,7 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
   switch (TYPE_ARRAY_UPPER_BOUND_TYPE (type))
     {
     case BOUND_BY_VALUE_ON_STACK:
-      current_frame_addr = selected_frame->frame;
+      current_frame_addr = get_frame_base (deprecated_selected_frame);
       if (current_frame_addr > 0)
        {
          *upper_bound =
@@ -162,13 +162,13 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
       break;
 
     case BOUND_BY_REF_ON_STACK:
-      current_frame_addr = selected_frame->frame;
+      current_frame_addr = get_frame_base (deprecated_selected_frame);
       if (current_frame_addr > 0)
        {
          ptr_to_upper_bound =
-           read_memory_integer (current_frame_addr +
-                                TYPE_ARRAY_UPPER_BOUND_VALUE (type),
-                                4);
+           read_memory_typed_address (current_frame_addr +
+                                      TYPE_ARRAY_UPPER_BOUND_VALUE (type),
+                                      builtin_type_void_data_ptr);
          *upper_bound = read_memory_integer (ptr_to_upper_bound, 4);
        }
       else
@@ -563,7 +563,7 @@ list_all_visible_commons (char *funname)
 
   while (tmp != NULL)
     {
-      if (STREQ (tmp->owning_function, funname))
+      if (strcmp (tmp->owning_function, funname) == 0)
        printf_filtered ("%s\n", tmp->name);
 
       tmp = tmp->next;
@@ -588,7 +588,7 @@ info_common_command (char *comname, int from_tty)
      first make sure that it is visible and if so, let 
      us display its contents */
 
-  fi = selected_frame;
+  fi = deprecated_selected_frame;
 
   if (fi == NULL)
     error ("No frame selected");
@@ -596,7 +596,7 @@ info_common_command (char *comname, int from_tty)
   /* The following is generally ripped off from stack.c's routine 
      print_frame_info() */
 
-  func = find_pc_function (fi->pc);
+  func = find_pc_function (get_frame_pc (fi));
   if (func)
     {
       /* In certain pathological cases, the symtabs give the wrong
@@ -613,22 +613,22 @@ info_common_command (char *comname, int from_tty)
          be any minimal symbols in the middle of a function.
          FIXME:  (Not necessarily true.  What about text labels) */
 
-      struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
+      struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (get_frame_pc (fi));
 
       if (msymbol != NULL
          && (SYMBOL_VALUE_ADDRESS (msymbol)
              > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
-       funname = SYMBOL_NAME (msymbol);
+       funname = DEPRECATED_SYMBOL_NAME (msymbol);
       else
-       funname = SYMBOL_NAME (func);
+       funname = DEPRECATED_SYMBOL_NAME (func);
     }
   else
     {
       register struct minimal_symbol *msymbol =
-      lookup_minimal_symbol_by_pc (fi->pc);
+      lookup_minimal_symbol_by_pc (get_frame_pc (fi));
 
       if (msymbol != NULL)
-       funname = SYMBOL_NAME (msymbol);
+       funname = DEPRECATED_SYMBOL_NAME (msymbol);
     }
 
   /* If comname is NULL, we assume the user wishes to see the 
@@ -644,7 +644,7 @@ info_common_command (char *comname, int from_tty)
 
   if (the_common)
     {
-      if (STREQ (comname, BLANK_COMMON_NAME_LOCAL))
+      if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0)
        printf_filtered ("Contents of blank COMMON block:\n");
       else
        printf_filtered ("Contents of F77 COMMON block '%s':\n", comname);
@@ -654,7 +654,7 @@ info_common_command (char *comname, int from_tty)
 
       while (entry != NULL)
        {
-         printf_filtered ("%s = ", SYMBOL_NAME (entry->symbol));
+         printf_filtered ("%s = ", DEPRECATED_SYMBOL_NAME (entry->symbol));
          print_variable_value (entry->symbol, fi, gdb_stdout);
          printf_filtered ("\n");
          entry = entry->next;
@@ -680,7 +680,7 @@ there_is_a_visible_common_named (char *comname)
   if (comname == NULL)
     error ("Cannot deal with NULL common name!");
 
-  fi = selected_frame;
+  fi = deprecated_selected_frame;
 
   if (fi == NULL)
     error ("No frame selected");
@@ -710,9 +710,9 @@ there_is_a_visible_common_named (char *comname)
       if (msymbol != NULL
          && (SYMBOL_VALUE_ADDRESS (msymbol)
              > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
-       funname = SYMBOL_NAME (msymbol);
+       funname = DEPRECATED_SYMBOL_NAME (msymbol);
       else
-       funname = SYMBOL_NAME (func);
+       funname = DEPRECATED_SYMBOL_NAME (func);
     }
   else
     {
@@ -720,7 +720,7 @@ there_is_a_visible_common_named (char *comname)
       lookup_minimal_symbol_by_pc (fi->pc);
 
       if (msymbol != NULL)
-       funname = SYMBOL_NAME (msymbol);
+       funname = DEPRECATED_SYMBOL_NAME (msymbol);
     }
 
   the_common = find_common_for_function (comname, funname);