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


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

Re: PATCH: Start Fortran support for variable objects.


Daniel Jacobowitz writes:
 > On Thu, Jun 30, 2005 at 09:29:16AM +1200, Nick Roberts wrote:
 > > !     vlang_unknown = 0, vlang_c, vlang_cplus, vlang_java,  vlang_fortran,
 > > !     vlang_end
 > 
 > Extra space before vlang_fortran.

OK

...
 > > --- 727,742 ----
 > >         /* Mark as the end in case we bail out */
 > >         *((*childlist) + i) = NULL;
 > >   
 > > +       if (variable_language (var) == vlang_fortran)
 > > + 	j = i + 1;
 > > +       else
 > > + 	j = i;
 > > + 
 > >         /* check if child exists, if not create */
 > > !       name = name_of_child (var, j);
 > >         child = child_exists (var, name);
 > >         if (child == NULL)
 > > ! 	child = create_child (var, j, name);
 > >   
 > >         *((*childlist) + i) = child;
 > >       }
 > 
 > Do you think you should use f77_get_dynamic_lowerbound?  See eval.c,
 > under multi_f77_subscript.

As in the patch below?  I don't understand the extra cases it appears to
cover, but it worked for the tests I tried.

Nick


*** varobj.c.~1.54.~	2005-06-29 00:28:57.000000000 +1200
--- varobj.c	2005-07-01 10:06:44.000000000 +1200
***************
*** 23,28 ****
--- 23,29 ----
  #include "expression.h"
  #include "frame.h"
  #include "language.h"
+ #include "f-lang.h"
  #include "wrapper.h"
  #include "gdbcmd.h"
  
***************
*** 46,52 ****
    { "natural", "binary", "decimal", "hexadecimal", "octal" };
  
  /* String representations of gdb's known languages */
! char *varobj_language_string[] = { "unknown", "C", "C++", "Java" };
  
  /* Data structures */
  
--- 47,53 ----
    { "natural", "binary", "decimal", "hexadecimal", "octal" };
  
  /* String representations of gdb's known languages */
! char *varobj_language_string[] = { "unknown", "C", "C++", "Java", "Fortran" };
  
  /* Data structures */
  
***************
*** 372,377 ****
--- 373,390 ----
     java_type_of_child,
     java_variable_editable,
     java_value_of_variable}
+   ,
+   /* Fortran */
+   {
+    vlang_fortran,
+    c_number_of_children,
+    c_name_of_variable,
+    c_name_of_child,
+    c_value_of_root,
+    c_value_of_child,
+    c_type_of_child,
+    c_variable_editable,
+    c_value_of_variable}
  };
  
  /* A little convenience enum for dealing with C++/Java */
***************
*** 696,702 ****
  {
    struct varobj *child;
    char *name;
!   int i;
  
    /* sanity check: have we been passed a pointer? */
    if (childlist == NULL)
--- 709,716 ----
  {
    struct varobj *child;
    char *name;
!   int lower_bound;
!   int i, j, retcode;
  
    /* sanity check: have we been passed a pointer? */
    if (childlist == NULL)
***************
*** 715,725 ****
        /* Mark as the end in case we bail out */
        *((*childlist) + i) = NULL;
  
        /* check if child exists, if not create */
!       name = name_of_child (var, i);
        child = child_exists (var, name);
        if (child == NULL)
! 	child = create_child (var, i, name);
  
        *((*childlist) + i) = child;
      }
--- 729,750 ----
        /* Mark as the end in case we bail out */
        *((*childlist) + i) = NULL;
  
+       if (variable_language (var) == vlang_fortran)
+ 	{
+ 	  retcode = f77_get_dynamic_lowerbound (var->type, &lower_bound);
+ 	  if (retcode == BOUND_FETCH_ERROR)
+ 	    error (_("Cannot obtain valid array lower bound"));
+ 	  else
+ 	    j = i + lower_bound;
+ 	}
+       else
+ 	j = i;
+ 
        /* check if child exists, if not create */
!       name = name_of_child (var, j);
        child = child_exists (var, name);
        if (child == NULL)
! 	child = create_child (var, j, name);
  
        *((*childlist) + i) = child;
      }
***************
*** 1564,1570 ****
      case language_java:
        lang = vlang_java;
        break;
!     }
  
    return lang;
  }
--- 1589,1598 ----
      case language_java:
        lang = vlang_java;
        break;
!     case language_fortran:
!       lang = vlang_fortran;
!       break;
!      }
  
    return lang;
  }


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