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: [RFA] [4/5] Use DWARF-2 DW_AT_artificial information


Daniel Jacobowitz writes:
 > I hate to be a nag, but this patch would be useful for some of my
 > current work.  Do you have a chance to look at it?
 > 

You are completely right, sorry.  I wonder if MichaelC could kindly
run it through his test harness. That was a big help with yesterday's
patch.  And if you can run the tests with the maintainers file script.

How much does the size increase by adding this new struct?

I have looked at it when you first posted it, and I had some
questions, I have to go fish for them again.  But basically, the
motivation for this change is what? You need to handle the dwarf2
information for artificial arguments, right? So that needs a change in
dwarf2read.c.  How does that bring about the change in the type
structure? Can you explain a bit? (my brain gets lazy at this time).

In the meantime, I noticed that the hp-symtab-read.c changes are not
mentioned in the ChangeLog (well, now it is hpread.c).  Also now you
have a bunch of type->code instead of TYPE_CODE().  I tried to apply
the patch to the current sources, but it failed in several files.  I
tried to resolve the conflicts by hand but the compilation died in
valops.c, gdbypes.c and c-typeprint.c. I think the rename of type to
main_type needs to be taken into account as well.
I get these 2 kinds of errors:
/home/ezannoni/sources/src/gdb/c-typeprint.c:171: structure has no member named `code'
/home/ezannoni/sources/src/gdb/gdbtypes.c:2750: structure has no member named `type_specific'


I noticed this quite ugly syntax. I know you didn't introduce it, but,
I wonder why it's needed:
 't1[!staticp].type' and 'for (i = !staticp;....)'

I think you also need to update a few comments in gdbtypes.h when
introducing the new method_args field.

Is there any better naming scheme for TYPE_FN_FIELD_ARGS and
TYPE_FN_FIELD_ARG? I am always a bit worried when identifiers differ
by just one char.

I guess you can clean the patch up a bit and I'll take a
look again.

I include my unsuccessful diff below, in case it's useful.

Elena

 > > On Tue, Jan 15, 2002 at 03:31:57PM -0500, Daniel Jacobowitz wrote:
 > > > This one's a bit larger than the others.  It also has a little more impact -
 > > > it adds a word of memory per argument per method per class.  I don't think
 > > > the storage is an issue right now, and some day I intend to go through and
 > > > clean up our memory usage a little bit in places much more severe than this.
 > > > 
 > > > Other than that it's pretty straightforward.  OK to commit?
 > > > 
 > > > -- 
 > > > Daniel Jacobowitz                           Carnegie Mellon University
 > > > MontaVista Software                         Debian GNU/Linux Developer
 > > > 
 > > > 2002-01-15  Daniel Jacobowitz  <drow@mvista.com>
 > > > 
 > > > 	* gdbtypes.h (struct method_args): New.
 > > > 	(struct type): Change arg_types to method_args.
 > > > 	Change TYPE_ARG_TYPES to TYPE_METHOD_ARGS.  Add TYPE_ARG_TYPE,
 > > > 	TYPE_FN_FIELD_ARG.
 > > > 	(smash_to_method_type): Update prototype to accept struct
 > > > 	method_args.
 > > > 	* gdbtypes.c (smash_to_method_type): Update to use TYPE_METHOD_ARGS.
 > > > 	(check_stub_method): Likewise.  Initialize method arguments
 > > > 	to non-artificial.
 > > > 	(print_arg_types): Update to accept struct method_args.  Print out
 > > > 	new field ``artificial'' for each argument.
 > > > 	(dump_fn_fieldlists): Fix indentation of type dumps.
 > > > 	(recursive_dump_type): Update to use TYPE_METHOD_ARGS.
 > > > 
 > > > 	* dwarf2read.c (dwarf2_add_member_fn): Update to use struct
 > > > 	method_args.  Preserve TYPE_FIELD_ARTIFICIAL.
 > > > 	* stabsread.c (read_type): Update to use struct method_args.
 > > > 	(read_args): Likewise.  Initialize artificial to 0.
 > > > 	* valops.c (hand_function_call): Update to use struct method_args.
 > > > 	(typecmp): Likewise.
 > > > 	(find_overload_match): Update to use TYPE_FN_FIELD_ARG.
 > > > 
 > > > 	* c-typeprint.c (cp_type_print_method_args): Update to accept
 > > > 	struct method_args.  Skip leading artificial arguments.
 > > > 	(c_type_print_args): Likewise.
 > > > 

Index: c-typeprint.c
===================================================================
RCS file: /cvs/uberbaum/gdb/c-typeprint.c,v
retrieving revision 1.20
diff -u -p -r1.20 c-typeprint.c
--- c-typeprint.c	14 May 2002 18:30:50 -0000	1.20
+++ c-typeprint.c	15 May 2002 03:56:30 -0000
@@ -41,7 +41,7 @@
 /* Flag indicating target was compiled by HP compiler */
 extern int hp_som_som_object_present;
 
-static void cp_type_print_method_args (struct type ** args, char *prefix,
+static void cp_type_print_method_args (struct method_args *args, char *prefix,
 				       char *varstring, int staticp,
 				       struct ui_file *stream);
 
@@ -150,26 +150,36 @@ cp_type_print_derivation_info (struct ui
 /* Print the C++ method arguments ARGS to the file STREAM.  */
 
 static void
-cp_type_print_method_args (struct type **args, char *prefix, char *varstring,
-			   int staticp, struct ui_file *stream)
+cp_type_print_method_args (struct method_args *args, char *prefix,
+			   char *varstring, int staticp,
+			   struct ui_file *stream)
 {
-  int i;
+  struct method_args *curarg = NULL;
+
+  if (args != NULL)
+    {
+      /* Skip ``this'' and any leading artificial arguments.  */
+      curarg = &args[!staticp];
+      while (curarg->artificial)
+	curarg++;
+    }
 
   fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
   fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
   fputs_filtered ("(", stream);
-  if (args && args[!staticp] && TYPE_CODE (args[!staticp]) != TYPE_CODE_VOID)
+  if (curarg && curarg->type
+      && curarg->type->code != TYPE_CODE_VOID)
     {
-      i = !staticp;		/* skip the class variable */
       while (1)
 	{
-	  type_print (args[i++], "", stream, 0);
-	  if (!args[i])
+	  type_print (curarg->type, "", stream, 0);
+	  curarg++;
+	  if (!curarg->type)
 	    {
 	      fprintf_filtered (stream, " ...");
 	      break;
 	    }
-	  else if (TYPE_CODE (args[i]) != TYPE_CODE_VOID)
+	  else if (curarg->type->code != TYPE_CODE_VOID)
 	    {
 	      fprintf_filtered (stream, ", ");
 	    }
@@ -329,40 +339,43 @@ c_type_print_modifier (struct type *type
     fprintf_filtered (stream, " ");
 }
 
-
-
-
 static void
 c_type_print_args (struct type *type, struct ui_file *stream)
 {
   int i;
-  struct type **args;
+  struct method_args *args, *curarg;
 
   fprintf_filtered (stream, "(");
-  args = TYPE_ARG_TYPES (type);
+  args = TYPE_METHOD_ARGS (type);
   if (args != NULL)
     {
-      if (args[1] == NULL)
+      /* Always skip ``this''.  */
+      curarg = &args[1];
+
+      /* Skip any artificial arguments.  */
+      while (curarg->artificial)
+	curarg++;
+
+      if (curarg->type == NULL)
 	{
 	  fprintf_filtered (stream, "...");
 	}
-      else if ((TYPE_CODE (args[1]) == TYPE_CODE_VOID) &&
+      else if ((curarg->type->code == TYPE_CODE_VOID) &&
 	       (current_language->la_language == language_cplus))
 	{
 	  fprintf_filtered (stream, "void");
 	}
       else
 	{
-	  for (i = 1;
-	       args[i] != NULL && TYPE_CODE (args[i]) != TYPE_CODE_VOID;
-	       i++)
+	  while (curarg->type != NULL
+		 && curarg->type->code != TYPE_CODE_VOID)
 	    {
-	      c_print_type (args[i], "", stream, -1, 0);
-	      if (args[i + 1] == NULL)
+	      c_print_type (curarg->type, "", stream, -1, 0);
+	      if ((curarg + 1)->type == NULL)
 		{
 		  fprintf_filtered (stream, "...");
 		}
-	      else if (TYPE_CODE (args[i + 1]) != TYPE_CODE_VOID)
+	      else if ((curarg + 1)->type->code != TYPE_CODE_VOID)
 		{
 		  fprintf_filtered (stream, ",");
 		  wrap_here ("    ");
Index: dwarf2read.c
===================================================================
RCS file: /cvs/uberbaum/gdb/dwarf2read.c,v
retrieving revision 1.56
diff -u -p -r1.56 dwarf2read.c
--- dwarf2read.c	14 May 2002 18:30:50 -0000	1.56
+++ dwarf2read.c	15 May 2002 03:57:18 -0000
@@ -2228,21 +2228,26 @@ dwarf2_add_member_fn (struct field_info 
   if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC)
     {
       struct type *return_type = TYPE_TARGET_TYPE (die->type);
-      struct type **arg_types;
+      struct method_args *arg_types;
       int nparams = TYPE_NFIELDS (die->type);
       int iparams;
 
       /* Copy argument types from the subroutine type.  */
-      arg_types = (struct type **)
-	TYPE_ALLOC (fnp->type, (nparams + 1) * sizeof (struct type *));
+      arg_types = (struct method_args *)
+	TYPE_ALLOC (fnp->type, (nparams + 1) * sizeof (struct method_args));
       for (iparams = 0; iparams < nparams; iparams++)
-	arg_types[iparams] = TYPE_FIELD_TYPE (die->type, iparams);
+	{
+	  arg_types[iparams].type = TYPE_FIELD_TYPE (die->type, iparams);
+	  arg_types[iparams].artificial = TYPE_FIELD_ARTIFICIAL (die->type,
+								 iparams);
+	}
 
       /* Set last entry in argument type vector.  */
       if (TYPE_VARARGS (die->type))
-	arg_types[nparams] = NULL;
+	arg_types[nparams].type = NULL;
       else
-	arg_types[nparams] = dwarf2_fundamental_type (objfile, FT_VOID);
+	arg_types[nparams].type = dwarf2_fundamental_type (objfile, FT_VOID);
+      arg_types[nparams].artificial = 0;
 
       smash_to_method_type (fnp->type, type, return_type, arg_types);
 
Index: gdbtypes.c
===================================================================
RCS file: /cvs/uberbaum/gdb/gdbtypes.c,v
retrieving revision 1.51
diff -u -p -r1.51 gdbtypes.c
--- gdbtypes.c	14 May 2002 18:30:50 -0000	1.51
+++ gdbtypes.c	15 May 2002 03:57:31 -0000
@@ -127,7 +127,7 @@ static void add_mangled_type (struct ext
 static void cfront_mangle_name (struct type *, int, int);
 #endif
 static void print_bit_vector (B_TYPE *, int);
-static void print_arg_types (struct type **, int);
+static void print_arg_types (struct method_args *, int);
 static void dump_fn_fieldlists (struct type *, int);
 static void print_cplus_stuff (struct type *, int);
 static void virtual_base_list_aux (struct type *dclass);
@@ -879,7 +879,7 @@ smash_to_member_type (struct type *type,
 
 void
 smash_to_method_type (struct type *type, struct type *domain,
-		      struct type *to_type, struct type **args)
+		      struct type *to_type, struct method_args *args)
 {
   struct objfile *objfile;
 
@@ -889,7 +889,7 @@ smash_to_method_type (struct type *type,
   TYPE_OBJFILE (type) = objfile;
   TYPE_TARGET_TYPE (type) = to_type;
   TYPE_DOMAIN_TYPE (type) = domain;
-  TYPE_ARG_TYPES (type) = args;
+  TYPE_METHOD_ARGS (type) = args;
   TYPE_LENGTH (type) = 1;	/* In practice, this is never needed.  */
   TYPE_CODE (type) = TYPE_CODE_METHOD;
 }
@@ -1593,7 +1593,7 @@ check_stub_method (struct type *type, in
 					 DMGL_PARAMS | DMGL_ANSI);
   char *argtypetext, *p;
   int depth = 0, argcount = 1;
-  struct type **argtypes;
+  struct method_args *argtypes;
   struct type *mtype;
 
   /* Make sure we got back a function string that we can use.  */
@@ -1629,8 +1629,8 @@ check_stub_method (struct type *type, in
   /* We need two more slots: one for the THIS pointer, and one for the
      NULL [...] or void [end of arglist].  */
 
-  argtypes = (struct type **)
-    TYPE_ALLOC (type, (argcount + 2) * sizeof (struct type *));
+  argtypes = (struct method_args *)
+    TYPE_ALLOC (type, (argcount + 2) * sizeof (struct method_args));
   p = argtypetext;
 
   /* Add THIS pointer for non-static methods.  */
@@ -1639,8 +1639,9 @@ check_stub_method (struct type *type, in
     argcount = 0;
   else
     {
-      argtypes[0] = lookup_pointer_type (type);
-      argcount = 1;
+      argtypes[0].type = lookup_pointer_type (type);
+      /* Assume no artificial arguments.  */
+      argtypes[0].artificial = 0;
     }
 
   if (*p != ')')		/* () means no args, skip while */
@@ -1653,8 +1654,9 @@ check_stub_method (struct type *type, in
 	      /* Avoid parsing of ellipsis, they will be handled below.  */
 	      if (strncmp (argtypetext, "...", p - argtypetext) != 0)
 		{
-		  argtypes[argcount] =
+		  argtypes[argcount].type =
 		    safe_parse_type (argtypetext, p - argtypetext);
+		  argtypes[argcount].artificial = 0;
 		  argcount += 1;
 		}
 	      argtypetext = p + 1;
@@ -1675,11 +1677,13 @@ check_stub_method (struct type *type, in
 
   if (p[-2] != '.')		/* Not '...' */
     {
-      argtypes[argcount] = builtin_type_void;	/* List terminator */
+      argtypes[argcount].type = builtin_type_void;	/* List terminator */
+      argtypes[argcount].artificial = 0;
     }
   else
     {
-      argtypes[argcount] = NULL;	/* Ellist terminator */
+      argtypes[argcount].type = NULL;	/* Ellist terminator */
+      argtypes[argcount].artificial = 0;
     }
 
   xfree (demangled_name);
@@ -1689,7 +1693,7 @@ check_stub_method (struct type *type, in
   /* Now update the old "stub" type into a real type.  */
   mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
   TYPE_DOMAIN_TYPE (mtype) = type;
-  TYPE_ARG_TYPES (mtype) = argtypes;
+  TYPE_METHOD_ARGS (mtype) = argtypes;
   TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB;
   TYPE_FN_FIELD_STUB (f, signature_id) = 0;
 }
@@ -2689,14 +2693,15 @@ print_bit_vector (B_TYPE *bits, int nbit
    include it since we may get into a infinitely recursive situation. */
 
 static void
-print_arg_types (struct type **args, int spaces)
+print_arg_types (struct method_args *args, int spaces)
 {
   if (args != NULL)
     {
-      while (*args != NULL)
+      while (args->type != NULL)
 	{
-	  recursive_dump_type (*args, spaces + 2);
-	  if (TYPE_CODE (*args++) == TYPE_CODE_VOID)
+	  printfi_filtered (spaces, "artificial %d\n", args->artificial);
+	  recursive_dump_type (args->type, spaces + 2);
+	  if ((args++)->type->code == TYPE_CODE_VOID)
 	    {
 	      break;
 	    }
@@ -2745,7 +2750,7 @@ dump_fn_fieldlists (struct type *type, i
 	  gdb_print_host_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout);
 	  printf_filtered ("\n");
 
-	  print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), spaces);
+	  print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), spaces+8);
 	  printfi_filtered (spaces + 8, "fcontext ");
 	  gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx),
 				  gdb_stdout);
@@ -3089,10 +3094,10 @@ recursive_dump_type (struct type *type, 
     {
     case TYPE_CODE_METHOD:
     case TYPE_CODE_FUNC:
-      printfi_filtered (spaces, "arg_types ");
-      gdb_print_host_address (TYPE_ARG_TYPES (type), gdb_stdout);
+      printfi_filtered (spaces, "method_args ");
+      gdb_print_host_address (TYPE_METHOD_ARGS (type), gdb_stdout);
       puts_filtered ("\n");
-      print_arg_types (TYPE_ARG_TYPES (type), spaces);
+      print_arg_types (TYPE_METHOD_ARGS (type), spaces);
       break;
 
     case TYPE_CODE_STRUCT:

Index: gdbtypes.h
===================================================================
RCS file: /cvs/uberbaum/gdb/gdbtypes.h,v
retrieving revision 1.30
diff -u -p -r1.30 gdbtypes.h
--- gdbtypes.h	14 May 2002 18:30:50 -0000	1.30
+++ gdbtypes.h	15 May 2002 04:31:37 -0000
@@ -73,6 +73,11 @@ struct block;
 #define	B_BYTES(x)	( 1 + ((x)>>3) )
 #define	B_CLRALL(a,x)	memset ((a), 0, B_BYTES(x))
 
+struct method_args {
+  struct type *type;
+  int artificial;
+};
+
 /* Different kinds of data types are distinguished by the `code' field.  */
 
 enum type_code
@@ -444,7 +449,7 @@ struct main_type
        pointer after the last argument for functions with variable
        arguments.  */
 
-    struct type **arg_types;
+    struct method_args *method_args;
 
     /* CPLUS_STUFF is for TYPE_CODE_STRUCT.  It is initialized to point to
        cplus_struct_default, a default static instance of a struct
@@ -792,7 +797,8 @@ extern void allocate_cplus_struct_type (
 #define TYPE_NINSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ninstantiations
 #define TYPE_DECLARED_TYPE(thistype) TYPE_CPLUS_SPECIFIC(thistype)->declared_type
 #define	TYPE_TYPE_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific
-#define TYPE_ARG_TYPES(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.arg_types
+#define TYPE_METHOD_ARGS(thistype) (thistype)->type_specific.method_args
+#define TYPE_ARG_TYPE(thistype,i) TYPE_METHOD_ARGS((thistype)[i].type)
 #define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
 #define TYPE_BASECLASS(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].type
@@ -870,7 +876,8 @@ extern void allocate_cplus_struct_type (
 #define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
 #define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
 #define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
-#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_ARG_TYPES ((thisfn)[n].type)
+#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_METHOD_ARGS ((thisfn)[n].type)
+#define TYPE_FN_FIELD_ARG(thisfn, n, i) TYPE_ARG_TYPE ((thisfn)[n].type, i)
 #define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const)
 #define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile)
 #define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
@@ -1095,7 +1102,7 @@ extern struct type *lookup_member_type (
 
 extern void
 smash_to_method_type (struct type *, struct type *, struct type *,
-		      struct type **);
+		      struct method_args *);
 
 extern void
 smash_to_member_type (struct type *, struct type *, struct type *);

Index: hpread.c
===================================================================
RCS file: /cvs/uberbaum/gdb/hpread.c,v
retrieving revision 1.19
diff -u -p -r1.19 hpread.c
--- hpread.c	14 May 2002 18:30:51 -0000	1.19
+++ hpread.c	15 May 2002 03:58:02 -0000
@@ -4937,19 +4937,20 @@ hpread_type_lookup (dnttpointer hp_type,
 	struct type *retvaltype;
 	int nargs;
 	int i;
-	struct type **args_type;
+	struct method_args *args_type;
 	class_type = hpread_type_lookup (dn_bufp->dptrmem.pointsto,
 					 objfile);
 	functype = hpread_type_lookup (dn_bufp->dptrmem.memtype,
 				       objfile);
 	retvaltype = TYPE_TARGET_TYPE (functype);
 	nargs = TYPE_NFIELDS (functype);
-	args_type = (struct type **) xmalloc ((nargs + 1) * sizeof (struct type *));
+	args_type = (struct method_args *) xmalloc ((nargs + 1) * sizeof (struct method_args));
 	for (i = 0; i < nargs; i++)
 	  {
-	    args_type[i] = TYPE_FIELD_TYPE (functype, i);
+	    args_type[i].type = TYPE_FIELD_TYPE (functype, i);
+	    args_type[i].artificial = 0;
 	  }
-	args_type[nargs] = NULL;
+	args_type[nargs].type = NULL;
 	ptrmemtype = alloc_type (objfile);
 	smash_to_method_type (ptrmemtype, class_type, retvaltype, args_type);
 	return make_pointer_type (ptrmemtype, NULL);
Index: stabsread.c
===================================================================
RCS file: /cvs/uberbaum/gdb/stabsread.c,v
retrieving revision 1.34
diff -u -p -r1.34 stabsread.c
--- stabsread.c	14 May 2002 18:30:51 -0000	1.34
+++ stabsread.c	15 May 2002 03:58:15 -0000
@@ -142,7 +142,7 @@ static struct type *read_struct_type (ch
 static struct type *read_array_type (char **, struct type *,
 				     struct objfile *);
 
-static struct type **read_args (char **, int, struct objfile *);
+static struct method_args *read_args (char **, int, struct objfile *);
 
 static int
 read_cpp_abbrev (struct field_info *, char **, struct type *,
@@ -2780,7 +2780,7 @@ again:
 	{
 	  struct type *domain = read_type (pp, objfile);
 	  struct type *return_type;
-	  struct type **args;
+	  struct method_args *args;
 
 	  if (**pp != ',')
 	    /* Invalid member type data format.  */
@@ -4926,21 +4926,23 @@ handle_true_range:
 }
 
 /* Read in an argument list.  This is a list of types, separated by commas
-   and terminated with END.  Return the list of types read in, or (struct type
-   **)-1 if there is an error.  */
+   and terminated with END.  Return the list of types read in, or (struct
+   method_args *)-1 if there is an error.  */
 
-static struct type **
+static struct method_args *
 read_args (char **pp, int end, struct objfile *objfile)
 {
   /* FIXME!  Remove this arbitrary limit!  */
-  struct type *types[1024], **rval;	/* allow for fns of 1023 parameters */
+  struct type *types[1024];	/* allow for fns of 1023 parameters */
+  struct method_args *rval;
   int n = 0;
+  int i;
 
   while (**pp != end)
     {
       if (**pp != ',')
 	/* Invalid argument list: no ','.  */
-	return (struct type **) -1;
+	return (struct method_args *) -1;
       (*pp)++;
       STABS_CONTINUE (pp, objfile);
       types[n++] = read_type (pp, objfile);
@@ -4949,18 +4951,22 @@ read_args (char **pp, int end, struct ob
 
   if (n == 1)
     {
-      rval = (struct type **) xmalloc (2 * sizeof (struct type *));
+      rval = (struct method_args *) xmalloc (2 * sizeof (struct method_args));
     }
   else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
     {
-      rval = (struct type **) xmalloc ((n + 1) * sizeof (struct type *));
-      memset (rval + n, 0, sizeof (struct type *));
+      rval = (struct method_args *) xmalloc ((n + 1) * sizeof (struct method_args));
+      memset (rval + n, 0, sizeof (struct method_args));
     }
   else
     {
-      rval = (struct type **) xmalloc (n * sizeof (struct type *));
+      rval = (struct method_args *) xmalloc (n * sizeof (struct method_args));
+    }
+  for (i = 0; i < n; i++)
+    {
+      rval[i].type = types[i];
+      rval[i].artificial = 0;
     }
-  memcpy (rval, types, n * sizeof (struct type *));
   return rval;
 }
 
Index: valops.c
===================================================================
RCS file: /cvs/uberbaum/gdb/valops.c,v
retrieving revision 1.59
diff -u -p -r1.59 valops.c
--- valops.c	13 May 2002 14:00:36 -0000	1.59
+++ valops.c	15 May 2002 03:58:32 -0000
@@ -45,7 +45,7 @@ extern int hp_som_som_object_present;
 extern int overload_debug;
 /* Local functions.  */
 
-static int typecmp (int staticp, struct type *t1[], struct value *t2[]);
+static int typecmp (int staticp, struct method_args *t1, struct value *t2[]);
 
 static CORE_ADDR find_function_addr (struct value *, struct type **);
 static struct value *value_arg_coerce (struct value *, struct type *, int);
@@ -1441,7 +1441,7 @@ hand_function_call (struct value *functi
   if (TYPE_CODE (ftype) == TYPE_CODE_METHOD)
     {
       i = 0;
-      while (TYPE_CODE (TYPE_ARG_TYPES (ftype)[i]) != TYPE_CODE_VOID)
+      while (TYPE_CODE (TYPE_ARG_TYPE (ftype, i)) != TYPE_CODE_VOID)
 	i++;
       n_method_args = i;
       if (nargs < i)
@@ -1458,7 +1458,7 @@ hand_function_call (struct value *functi
       if (TYPE_CODE (ftype) == TYPE_CODE_METHOD)
 	{
 	  if (i < n_method_args)
-	    args[i] = value_arg_coerce (args[i], TYPE_ARG_TYPES (ftype)[i], 1);
+	    args[i] = value_arg_coerce (args[i], TYPE_ARG_TYPE (ftype, i), 1);
 	  else
 	    args[i] = value_arg_coerce (args[i], NULL, 0);
 	}
@@ -1953,7 +1953,7 @@ value_bitstring (char *ptr, int len)
    requested operation is type secure, shouldn't we?  FIXME.  */
 
 static int
-typecmp (int staticp, struct type *t1[], struct value *t2[])
+typecmp (int staticp, struct method_args t1[], struct value *t2[])
 {
   int i;
 
@@ -1963,19 +1963,20 @@ typecmp (int staticp, struct type *t1[],
     return t2[1] != 0;
   if (t1 == 0)
     return 1;
-  if (t1[!staticp] == 0)
+  if (t1[!staticp].type == 0)
     return 0;
-  if (TYPE_CODE (t1[0]) == TYPE_CODE_VOID)
+  if (TYPE_CODE (t1[0].type) == TYPE_CODE_VOID)
     return 0;
   /* Skip ``this'' argument if applicable.  T2 will always include THIS.  */
   if (staticp)
     t2++;
-  for (i = !staticp; t1[i] && TYPE_CODE (t1[i]) != TYPE_CODE_VOID; i++)
+  for (i = !staticp; t1[i].type && TYPE_CODE (t1[i].type) != TYPE_CODE_VOID;
+       i++)
     {
       struct type *tt1, *tt2;
       if (!t2[i])
 	return i + 1;
-      tt1 = check_typedef (t1[i]);
+      tt1 = check_typedef (t1[i].type);
       tt2 = check_typedef (VALUE_TYPE (t2[i]));
       if (TYPE_CODE (tt1) == TYPE_CODE_REF
       /* We should be doing hairy argument matching, as below.  */
@@ -2012,10 +2013,10 @@ typecmp (int staticp, struct type *t1[],
       /* We should be doing much hairier argument matching (see section 13.2
          of the ARM), but as a quick kludge, just check for the same type
          code.  */
-      if (TYPE_CODE (t1[i]) != TYPE_CODE (VALUE_TYPE (t2[i])))
+      if (TYPE_CODE (t1[i].type) != TYPE_CODE (VALUE_TYPE (t2[i])))
 	return i + 1;
     }
-  if (!t1[i])
+  if (!t1[i].type)
     return 0;
   return t2[i] ? i + 1 : 0;
 }
@@ -2758,7 +2759,8 @@ find_overload_match (struct type **arg_t
 
 	  if (TYPE_FN_FIELD_ARGS(fns_ptr,ix))
 	    {
-	      while (TYPE_CODE(TYPE_FN_FIELD_ARGS(fns_ptr,ix)[nparms]) != TYPE_CODE_VOID)
+	      while (TYPE_CODE(TYPE_FN_FIELD_ARG(fns_ptr,ix,nparms))
+		     != TYPE_CODE_VOID)
 		nparms++;
 	    }
 	}
@@ -2772,7 +2774,7 @@ find_overload_match (struct type **arg_t
       parm_types = (struct type **) xmalloc (nparms * (sizeof (struct type *)));
       for (jj = 0; jj < nparms; jj++)
 	parm_types[jj] = (method
-			  ? (TYPE_FN_FIELD_ARGS (fns_ptr, ix)[jj])
+			  ? (TYPE_FN_FIELD_ARG (fns_ptr, ix, jj))
 			  : TYPE_FIELD_TYPE (SYMBOL_TYPE (oload_syms[ix]), jj));
 
       /* Compare parameter types to supplied argument types.  Skip THIS for


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