Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [RFA] Allow casting of object pointers for method calls
@ 2001-12-03 10:05 Michael Elizabeth Chastain
  2001-12-03 10:12 ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2001-12-03 10:05 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches

The performance problem is hundreds of timeouts caused by:

  Reading symbols from /berman/fsf/_today_/berman/native/build/gdb/gdb_5_1-2001-07-29-branch/gdb/testsuite/gdb.base/funcargs...Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.
  (gdb) ERROR: couldn't load /berman/fsf/_today_/berman/native/build/gdb/gdb_5_1-2001-07-29-branch/gdb/testsuite/gdb.base/funcargs into /berman/fsf/_today_/berman/native/build/gdb/gdb_5_1-2001-07-29-branch/gdb/testsuite/../../gdb/gdb.

I am going to re-pull, re-build, re-test.

Michael C


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
  2001-12-03 10:05 [RFA] Allow casting of object pointers for method calls Michael Elizabeth Chastain
@ 2001-12-03 10:12 ` Daniel Jacobowitz
  2001-12-03 13:07   ` Andrew Cagney
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2001-12-03 10:12 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: ac131313, gdb-patches

On Mon, Dec 03, 2001 at 12:05:18PM -0600, Michael Elizabeth Chastain wrote:
> The performance problem is hundreds of timeouts caused by:
> 
>   Reading symbols from /berman/fsf/_today_/berman/native/build/gdb/gdb_5_1-2001-07-29-branch/gdb/testsuite/gdb.base/funcargs...Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.
>   (gdb) ERROR: couldn't load /berman/fsf/_today_/berman/native/build/gdb/gdb_5_1-2001-07-29-branch/gdb/testsuite/gdb.base/funcargs into /berman/fsf/_today_/berman/native/build/gdb/gdb_5_1-2001-07-29-branch/gdb/testsuite/../../gdb/gdb.
> 
> I am going to re-pull, re-build, re-test.

I'm pretty sure that a patch for this was approved on mainline
in November:
  http://sources.redhat.com/ml/gdb-patches/2001-11/msg00231.html

You're not going to be able to use 5.1-branch with the output of GCC mainline
unless this is moved to the branch.

The branch is open again, right, Andrew?  If so, this would be a good
candidate.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
  2001-12-03 10:12 ` Daniel Jacobowitz
@ 2001-12-03 13:07   ` Andrew Cagney
  2001-12-06  7:01     ` Elena Zannoni
  0 siblings, 1 reply; 14+ messages in thread
From: Andrew Cagney @ 2001-12-03 13:07 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Michael Elizabeth Chastain, gdb-patches, Elena Zannoni

> 
> I'm pretty sure that a patch for this was approved on mainline
> in November:
>   http://sources.redhat.com/ml/gdb-patches/2001-11/msg00231.html
> 
> You're not going to be able to use 5.1-branch with the output of GCC mainline
> unless this is moved to the branch.
> 
> The branch is open again, right, Andrew?  If so, this would be a good
> candidate.

(Yes the branch is open). Good question.  Elena?

	Andrew




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
  2001-12-03 13:07   ` Andrew Cagney
@ 2001-12-06  7:01     ` Elena Zannoni
  0 siblings, 0 replies; 14+ messages in thread
From: Elena Zannoni @ 2001-12-06  7:01 UTC (permalink / raw)
  To: Andrew Cagney
  Cc: Daniel Jacobowitz, Michael Elizabeth Chastain, gdb-patches,
	Elena Zannoni

Andrew Cagney writes:
 > > 
 > > I'm pretty sure that a patch for this was approved on mainline
 > > in November:
 > >   http://sources.redhat.com/ml/gdb-patches/2001-11/msg00231.html
 > > 
 > > You're not going to be able to use 5.1-branch with the output of GCC mainline
 > > unless this is moved to the branch.
 > > 
 > > The branch is open again, right, Andrew?  If so, this would be a good
 > > candidate.
 > 
 > (Yes the branch is open). Good question.  Elena?
 > 
 > 	Andrew
 > 
 > 

Yes, I think it should go in, or gdb is completely useless.

I'll just commit it. It shouldn't break anything if we use an older
gcc, I hope.

Elena


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
  2001-12-21 12:04 ` Jim Blandy
@ 2002-01-04  9:52   ` Daniel Jacobowitz
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Jacobowitz @ 2002-01-04  9:52 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

Committed, thanks.

On Fri, Dec 21, 2001 at 03:05:26PM -0500, Jim Blandy wrote:
> 
> Please commit this.  Thanks!
> 
> Daniel Jacobowitz <drow@mvista.com> writes:
> 
> > 
> > I'd like to commit this.
> > 
> > >From the comment on value_virtual_fn_field:
> >    VALUEP is a pointer to a pointer to a value, holding the object
> >    whose virtual function we want to invoke.  If the ABI requires a
> >    virtual function's caller to adjust the `this' pointer by an amount
> >    retrieved from the vtable before invoking the function (i.e., we're
> >    not using "vtable thunks" to do the adjustment automatically), then
> >    this function may set *VALUEP to point to a new object with an
> >    appropriately tweaked address.
> > 
> > find_overload_match went out of its way to prevent this from working.  The
> > cast at the end is unpleasant but, as far as I can see, correct;
> > value_find_oload_method_list tends to dereference pointers, and if we don't
> > return this rather than *this things die.
> > 
> > With this patch, all virtfunc tests other than:
> > XFAIL: gdb.c++/virtfunc.exp: print pEe->D::vg()
> > 
> > pass using g++ 2.95.  No other regressions.  I'll submit a separate patch to
> > remove their XFAILs.  This is also necessary for my g++ 3.0 support stuff,
> > which is pretty trivial after Jason's gcc work and this values patchs.
> > 
> > Anyone, comments?  I think the hack is (for now at least, maybe with a
> > FIXME) tolerable.
> > 
> > -- 
> > Daniel Jacobowitz                           Carnegie Mellon University
> > MontaVista Software                         Debian GNU/Linux Developer
> > 
> > 2001-12-03  Daniel Jacobowitz  <drow@mvista.com>
> > 
> > 	* valops.c (find_overload_match): Accept obj as a
> > 	reference parameter.  Update it before returning.
> > 	* value.h (find_overload_match): Update prototype.
> > 	* eval.c (evaluate_subexp_standard): Pass object to
> > 	find_overload_match by reference.
> > 
> > Index: eval.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/eval.c,v
> > retrieving revision 1.16
> > diff -u -p -r1.16 eval.c
> > --- eval.c	2001/11/12 21:20:18	1.16
> > +++ eval.c	2001/12/03 15:27:58
> > @@ -845,7 +845,7 @@ evaluate_subexp_standard (struct type *e
> >  
> >  	      (void) find_overload_match (arg_types, nargs, tstr,
> >  				     1 /* method */ , 0 /* strict match */ ,
> > -					  arg2 /* the object */ , NULL,
> > +					  &arg2 /* the object */ , NULL,
> >  					  &valp, NULL, &static_memfuncp);
> >  
> >  
> > Index: valops.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/valops.c,v
> > retrieving revision 1.41
> > diff -u -p -r1.41 valops.c
> > --- valops.c	2001/11/13 16:44:13	1.41
> > +++ valops.c	2001/12/03 15:27:58
> > @@ -2618,12 +2618,13 @@ value_find_oload_method_list (value_ptr 
> >  
> >  int
> >  find_overload_match (struct type **arg_types, int nargs, char *name, int method,
> > -		     int lax, value_ptr obj, struct symbol *fsym,
> > +		     int lax, value_ptr *objp, struct symbol *fsym,
> >  		     value_ptr *valp, struct symbol **symp, int *staticp)
> >  {
> >    int nparms;
> >    struct type **parm_types;
> >    int champ_nparms = 0;
> > +  struct value *obj = (objp ? *objp : NULL);
> >  
> >    short oload_champ = -1;	/* Index of best overloaded function */
> >    short oload_ambiguous = 0;	/* Current ambiguity state for overload resolution */
> > @@ -2847,6 +2848,15 @@ find_overload_match (struct type **arg_t
> >        xfree (func_name);
> >      }
> >  
> > +  if (objp)
> > +    {
> > +      if (TYPE_CODE (VALUE_TYPE (temp)) != TYPE_CODE_PTR
> > +	  && TYPE_CODE (VALUE_TYPE (*objp)) == TYPE_CODE_PTR)
> > +	{
> > +	  temp = value_addr (temp);
> > +	}
> > +      *objp = temp;
> > +    }
> >    return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
> >  }
> >  
> > Index: value.h
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/value.h,v
> > retrieving revision 1.22
> > diff -u -p -r1.22 value.h
> > --- value.h	2001/10/16 01:58:07	1.22
> > +++ value.h	2001/12/03 15:27:58
> > @@ -386,7 +386,7 @@ extern struct fn_field *value_find_oload
> >  
> >  extern int find_overload_match (struct type **arg_types, int nargs,
> >  				char *name, int method, int lax,
> > -				value_ptr obj, struct symbol *fsym,
> > +				value_ptr *obj, struct symbol *fsym,
> >  				value_ptr * valp, struct symbol **symp,
> >  				int *staticp);
> >  
> > 
> 

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
  2001-12-03  7:41 Daniel Jacobowitz
@ 2001-12-21 12:04 ` Jim Blandy
  2002-01-04  9:52   ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: Jim Blandy @ 2001-12-21 12:04 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches


Please commit this.  Thanks!

Daniel Jacobowitz <drow@mvista.com> writes:

> 
> I'd like to commit this.
> 
> >From the comment on value_virtual_fn_field:
>    VALUEP is a pointer to a pointer to a value, holding the object
>    whose virtual function we want to invoke.  If the ABI requires a
>    virtual function's caller to adjust the `this' pointer by an amount
>    retrieved from the vtable before invoking the function (i.e., we're
>    not using "vtable thunks" to do the adjustment automatically), then
>    this function may set *VALUEP to point to a new object with an
>    appropriately tweaked address.
> 
> find_overload_match went out of its way to prevent this from working.  The
> cast at the end is unpleasant but, as far as I can see, correct;
> value_find_oload_method_list tends to dereference pointers, and if we don't
> return this rather than *this things die.
> 
> With this patch, all virtfunc tests other than:
> XFAIL: gdb.c++/virtfunc.exp: print pEe->D::vg()
> 
> pass using g++ 2.95.  No other regressions.  I'll submit a separate patch to
> remove their XFAILs.  This is also necessary for my g++ 3.0 support stuff,
> which is pretty trivial after Jason's gcc work and this values patchs.
> 
> Anyone, comments?  I think the hack is (for now at least, maybe with a
> FIXME) tolerable.
> 
> -- 
> Daniel Jacobowitz                           Carnegie Mellon University
> MontaVista Software                         Debian GNU/Linux Developer
> 
> 2001-12-03  Daniel Jacobowitz  <drow@mvista.com>
> 
> 	* valops.c (find_overload_match): Accept obj as a
> 	reference parameter.  Update it before returning.
> 	* value.h (find_overload_match): Update prototype.
> 	* eval.c (evaluate_subexp_standard): Pass object to
> 	find_overload_match by reference.
> 
> Index: eval.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/eval.c,v
> retrieving revision 1.16
> diff -u -p -r1.16 eval.c
> --- eval.c	2001/11/12 21:20:18	1.16
> +++ eval.c	2001/12/03 15:27:58
> @@ -845,7 +845,7 @@ evaluate_subexp_standard (struct type *e
>  
>  	      (void) find_overload_match (arg_types, nargs, tstr,
>  				     1 /* method */ , 0 /* strict match */ ,
> -					  arg2 /* the object */ , NULL,
> +					  &arg2 /* the object */ , NULL,
>  					  &valp, NULL, &static_memfuncp);
>  
>  
> Index: valops.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/valops.c,v
> retrieving revision 1.41
> diff -u -p -r1.41 valops.c
> --- valops.c	2001/11/13 16:44:13	1.41
> +++ valops.c	2001/12/03 15:27:58
> @@ -2618,12 +2618,13 @@ value_find_oload_method_list (value_ptr 
>  
>  int
>  find_overload_match (struct type **arg_types, int nargs, char *name, int method,
> -		     int lax, value_ptr obj, struct symbol *fsym,
> +		     int lax, value_ptr *objp, struct symbol *fsym,
>  		     value_ptr *valp, struct symbol **symp, int *staticp)
>  {
>    int nparms;
>    struct type **parm_types;
>    int champ_nparms = 0;
> +  struct value *obj = (objp ? *objp : NULL);
>  
>    short oload_champ = -1;	/* Index of best overloaded function */
>    short oload_ambiguous = 0;	/* Current ambiguity state for overload resolution */
> @@ -2847,6 +2848,15 @@ find_overload_match (struct type **arg_t
>        xfree (func_name);
>      }
>  
> +  if (objp)
> +    {
> +      if (TYPE_CODE (VALUE_TYPE (temp)) != TYPE_CODE_PTR
> +	  && TYPE_CODE (VALUE_TYPE (*objp)) == TYPE_CODE_PTR)
> +	{
> +	  temp = value_addr (temp);
> +	}
> +      *objp = temp;
> +    }
>    return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
>  }
>  
> Index: value.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/value.h,v
> retrieving revision 1.22
> diff -u -p -r1.22 value.h
> --- value.h	2001/10/16 01:58:07	1.22
> +++ value.h	2001/12/03 15:27:58
> @@ -386,7 +386,7 @@ extern struct fn_field *value_find_oload
>  
>  extern int find_overload_match (struct type **arg_types, int nargs,
>  				char *name, int method, int lax,
> -				value_ptr obj, struct symbol *fsym,
> +				value_ptr *obj, struct symbol *fsym,
>  				value_ptr * valp, struct symbol **symp,
>  				int *staticp);
>  
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
  2001-12-07  3:22 Michael Elizabeth Chastain
@ 2001-12-07  6:52 ` Elena Zannoni
  0 siblings, 0 replies; 14+ messages in thread
From: Elena Zannoni @ 2001-12-07  6:52 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: ezannoni, ac131313, drow, gdb-patches

Michael Elizabeth Chastain writes:
 > Hi Elena,

Ok, Michael, thanks. I'll commit it myself now to avoid any possible
assignment problem.  But I woudn't think there is one, because you
weren't the author.

Thanks for doing this!
Elena


 > 
 > > Michael, have you tested 5.1 + patch with older gcc? Any problems?
 > > If not I'll commit it right away.
 > 
 > It proofreads good and it tests good, like a patch should.
 > 
 > I hand-applied the patch to the 5.1 line.  The process of hand application
 > was good for proofreading.
 > 
 > I believe that my work in translating the patch from mainline to 5.1
 > branch is trivial and obvious.  This might be important because I don't
 > have an FSF assignment in place yet (the FSF has just sent me paperwork).
 > Andrew, is this an issue?
 > 
 > The patch touches only dwarf-2 support and only for the attribute form
 > DW_FORM_strp, plus it removes some support for the unsupported case
 > HOST_CHAR_BITS != 8.  The HOST_CHAR_BITS parts were in the original
 > patch in response to a comment from Andrew.
 > 
 > I tested the 5.1 line with 8 configurations:
 > 
 >   gcc 2.95.3, gcc 3.0.2, gcc HEAD, gcc gcc-3_0-branch
 >   -gstabs+, -gdwarf-2
 > 
 > The tables are here:
 > 
 >   http://www.shout.net/~mec/public_html/sunday/2001-12-06/index.html
 > 
 > The new gdb fixes the problem with gcc HEAD dwarf-2 and the results are
 > similar to the gcc 3.0.2 dwarf-2 and gcc gcc-3_0-branch dwarf2.  There
 > are no significant regressions with the other 7 tested configurations.
 > There are insignificant result transitions in gdb.c++/annota2.exp
 > and gdb.base/interrupt.exp.
 > 
 > I recomend this patch for commitment on the 5.1 branch.
 > 
 > Michael C
 > 
 > ===
 > 
 > 2001-11-12  Jakub Jelinek  <jakub@redhat.com>
 > 
 > 	* dwarf2read.c (dwarf_str_buffer): New.
 > 	(struct dwarf2_pinfo): Add dwarf_str_buffer and dwarf_str_size.
 > 	(DWARF_STR_BUFFER, DWARF_STR_SIZE): Define.
 > 	(dwarf2_has_info): Clear dwarf_str_offset.
 > 	(dwarf2_build_psymtabs): Read .debug_str section if present.
 > 	(dwarf2_build_psymtabs_hard): Save DWARF_STR_BUFFER and
 > 	DWARF_STR_SIZE.
 > 	(psymtab_to_symtab_1): Restore DWARF_STR_BUFFER and DWARF_STR_SIZE.
 > 	(read_attribute): Handle DW_FORM_strp.
 > 	(read_n_bytes, read_string): Remove HOST_CHAR_BIT != 8
 > 	handling code.
 > 	(read_indirect_string): New.
 > 	(dump_die): Handle DW_FORM_strp.
 > 
 > Index: dwarf2read.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/dwarf2read.c,v
 > retrieving revision 1.29
 > diff -c -3 -r1.29 dwarf2read.c
 > *** dwarf2read.c	2001/07/05 16:45:48	1.29
 > --- dwarf2read.c	2001/12/07 11:01:20
 > ***************
 > *** 43,48 ****
 > --- 43,49 ----
 >   #include "bcache.h"
 >   #include <fcntl.h>
 >   #include "gdb_string.h"
 > + #include "gdb_assert.h"
 >   #include <sys/types.h>
 >   
 >   #ifndef DWARF2_REG_TO_REGNUM
 > ***************
 > *** 302,307 ****
 > --- 303,309 ----
 >   static char *dwarf_info_buffer;
 >   static char *dwarf_abbrev_buffer;
 >   static char *dwarf_line_buffer;
 > + static char *dwarf_str_buffer;
 >   
 >   /* A zeroed version of a partial die for initialization purposes.  */
 >   static struct partial_die_info zeroed_partial_die;
 > ***************
 > *** 383,388 ****
 > --- 385,398 ----
 >       /* Pointer to start of dwarf line buffer for the objfile.  */
 >   
 >       char *dwarf_line_buffer;
 > + 
 > +     /* Pointer to start of dwarf string buffer for the objfile.  */
 > + 
 > +     char *dwarf_str_buffer;
 > + 
 > +     /* Size of dwarf string section for the objfile.  */
 > + 
 > +     unsigned int dwarf_str_size;
 >     };
 >   
 >   #define PST_PRIVATE(p) ((struct dwarf2_pinfo *)(p)->read_symtab_private)
 > ***************
 > *** 391,396 ****
 > --- 401,408 ----
 >   #define DWARF_ABBREV_BUFFER(p) (PST_PRIVATE(p)->dwarf_abbrev_buffer)
 >   #define DWARF_ABBREV_SIZE(p) (PST_PRIVATE(p)->dwarf_abbrev_size)
 >   #define DWARF_LINE_BUFFER(p) (PST_PRIVATE(p)->dwarf_line_buffer)
 > + #define DWARF_STR_BUFFER(p)  (PST_PRIVATE(p)->dwarf_str_buffer)
 > + #define DWARF_STR_SIZE(p)    (PST_PRIVATE(p)->dwarf_str_size)
 >   
 >   /* Maintain an array of referenced fundamental types for the current
 >      compilation unit being read.  For DWARF version 1, we have to construct
 > ***************
 > *** 619,624 ****
 > --- 631,639 ----
 >   
 >   static char *read_string (bfd *, char *, unsigned int *);
 >   
 > + static char *read_indirect_string (bfd *, char *, const struct comp_unit_head *,
 > +                                    unsigned int *);
 > + 
 >   static unsigned long read_unsigned_leb128 (bfd *, char *, unsigned int *);
 >   
 >   static long read_signed_leb128 (bfd *, char *, unsigned int *);
 > ***************
 > *** 791,796 ****
 > --- 806,812 ----
 >   dwarf2_has_info (bfd *abfd)
 >   {
 >     dwarf_info_offset = dwarf_abbrev_offset = dwarf_line_offset = 0;
 > +   dwarf_str_offset = 0;
 >     bfd_map_over_sections (abfd, dwarf2_locate_sections, NULL);
 >     if (dwarf_info_offset && dwarf_abbrev_offset)
 >       {
 > ***************
 > *** 869,874 ****
 > --- 885,897 ----
 >   					   dwarf_line_offset,
 >   					   dwarf_line_size);
 >   
 > +   if (dwarf_str_offset)
 > +     dwarf_str_buffer = dwarf2_read_section (objfile,
 > +                                         dwarf_str_offset,
 > +                                         dwarf_str_size);
 > +   else
 > +     dwarf_str_buffer = NULL;
 > + 
 >     if (mainline || objfile->global_psymbols.size == 0 ||
 >         objfile->static_psymbols.size == 0)
 >       {
 > ***************
 > *** 1045,1050 ****
 > --- 1068,1075 ----
 >         DWARF_ABBREV_BUFFER (pst) = dwarf_abbrev_buffer;
 >         DWARF_ABBREV_SIZE (pst) = dwarf_abbrev_size;
 >         DWARF_LINE_BUFFER (pst) = dwarf_line_buffer;
 > +       DWARF_STR_BUFFER (pst) = dwarf_str_buffer;
 > +       DWARF_STR_SIZE (pst) = dwarf_str_size;
 >         baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >   
 >         /* Store the function that reads in the rest of the symbol table */
 > ***************
 > *** 1344,1349 ****
 > --- 1369,1376 ----
 >     dwarf_abbrev_buffer = DWARF_ABBREV_BUFFER (pst);
 >     dwarf_abbrev_size = DWARF_ABBREV_SIZE (pst);
 >     dwarf_line_buffer = DWARF_LINE_BUFFER (pst);
 > +   dwarf_str_buffer = DWARF_STR_BUFFER (pst);
 > +   dwarf_str_size = DWARF_STR_SIZE (pst);
 >     baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile));
 >     cu_header_offset = offset;
 >     info_ptr = dwarf_info_buffer + offset;
 > ***************
 > *** 3358,3363 ****
 > --- 3385,3395 ----
 >         DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read);
 >         info_ptr += bytes_read;
 >         break;
 > +     case DW_FORM_strp:
 > +       DW_STRING (attr) = read_indirect_string (abfd, info_ptr, cu_header,
 > + 	                                       &bytes_read);
 > +       info_ptr += bytes_read;
 > +       break;
 >       case DW_FORM_block:
 >         blk = dwarf_alloc_block ();
 >         blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
 > ***************
 > *** 3410,3416 ****
 >         DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
 >         info_ptr += bytes_read;
 >         break;
 > -     case DW_FORM_strp:
 >       case DW_FORM_indirect:
 >       default:
 >         error ("Dwarf Error: Cannot handle %s in DWARF reader.",
 > --- 3442,3447 ----
 > ***************
 > *** 3597,3628 ****
 >   static char *
 >   read_n_bytes (bfd *abfd, char *buf, unsigned int size)
 >   {
 > !   /* If the size of a host char is 8 bits, we can return a pointer
 > !      to the buffer, otherwise we have to copy the data to a buffer
 > !      allocated on the temporary obstack.  */
 > ! #if HOST_CHAR_BIT == 8
 >     return buf;
 > - #else
 > -   char *ret;
 > -   unsigned int i;
 > - 
 > -   ret = obstack_alloc (&dwarf2_tmp_obstack, size);
 > -   for (i = 0; i < size; ++i)
 > -     {
 > -       ret[i] = bfd_get_8 (abfd, (bfd_byte *) buf);
 > -       buf++;
 > -     }
 > -   return ret;
 > - #endif
 >   }
 >   
 >   static char *
 >   read_string (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
 >   {
 > !   /* If the size of a host char is 8 bits, we can return a pointer
 > !      to the string, otherwise we have to copy the string to a buffer
 > !      allocated on the temporary obstack.  */
 > ! #if HOST_CHAR_BIT == 8
 >     if (*buf == '\0')
 >       {
 >         *bytes_read_ptr = 1;
 > --- 3628,3643 ----
 >   static char *
 >   read_n_bytes (bfd *abfd, char *buf, unsigned int size)
 >   {
 > !   /* Require host char == 8 bits.  Other parts of GDB already do this (findvar.c).  */
 > !   gdb_assert (HOST_CHAR_BIT == 8);
 >     return buf;
 >   }
 >   
 >   static char *
 >   read_string (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
 >   {
 > !   /* Require host char == 8 bits.  Other parts of GDB already do this (findvar.c).  */
 > !   gdb_assert (HOST_CHAR_BIT == 8);
 >     if (*buf == '\0')
 >       {
 >         *bytes_read_ptr = 1;
 > ***************
 > *** 3630,3654 ****
 >       }
 >     *bytes_read_ptr = strlen (buf) + 1;
 >     return buf;
 > ! #else
 > !   int byte;
 > !   unsigned int i = 0;
 >   
 > !   while ((byte = bfd_get_8 (abfd, (bfd_byte *) buf)) != 0)
 >       {
 > !       obstack_1grow (&dwarf2_tmp_obstack, byte);
 > !       i++;
 > !       buf++;
 >       }
 > !   if (i == 0)
 >       {
 > !       *bytes_read_ptr = 1;
 >         return NULL;
 >       }
 > !   obstack_1grow (&dwarf2_tmp_obstack, '\0');
 > !   *bytes_read_ptr = i + 1;
 > !   return obstack_finish (&dwarf2_tmp_obstack);
 > ! #endif
 >   }
 >   
 >   static unsigned long
 > --- 3645,3675 ----
 >       }
 >     *bytes_read_ptr = strlen (buf) + 1;
 >     return buf;
 > ! }
 >   
 > ! static char *
 > ! read_indirect_string (bfd *abfd, char *buf,
 > !                       const struct comp_unit_head *cu_header,
 > ! 		      unsigned int *bytes_read_ptr)
 > ! {
 > !   LONGEST str_offset = read_offset (abfd, buf, cu_header,
 > !                                     (int *) bytes_read_ptr);
 > !   if (dwarf_str_buffer == NULL)
 >       {
 > !       error ("DW_FORM_strp used without .debug_str section");
 > !       return NULL;
 >       }
 > ! 
 > !   if (str_offset >= dwarf_str_size)
 >       {
 > !       error ("DW_FORM_strp pointing outside of .debug_str section");
 >         return NULL;
 >       }
 > ! 
 > !   gdb_assert (HOST_CHAR_BIT == 8);
 > !   if (dwarf_str_buffer[str_offset] == '\0')
 > !     return NULL;
 > !   return dwarf_str_buffer + str_offset;
 >   }
 >   
 >   static unsigned long
 > ***************
 > *** 5552,5557 ****
 > --- 5573,5579 ----
 >   	  fprintf (stderr, "constant: %ld", DW_UNSND (&die->attrs[i]));
 >   	  break;
 >   	case DW_FORM_string:
 > + 	case DW_FORM_strp:
 >   	  fprintf (stderr, "string: \"%s\"",
 >   		   DW_STRING (&die->attrs[i])
 >   		   ? DW_STRING (&die->attrs[i]) : "");
 > ***************
 > *** 5562,5569 ****
 >   	  else
 >   	    fprintf (stderr, "flag: FALSE");
 >   	  break;
 > - 	case DW_FORM_strp:	/* we do not support separate string
 > - 				   section yet */
 >   	case DW_FORM_indirect:	/* we do not handle indirect yet */
 >   	default:
 >   	  fprintf (stderr, "unsupported attribute form: %d.",
 > --- 5584,5589 ----


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
@ 2001-12-07  3:22 Michael Elizabeth Chastain
  2001-12-07  6:52 ` Elena Zannoni
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2001-12-07  3:22 UTC (permalink / raw)
  To: ezannoni; +Cc: ac131313, drow, gdb-patches

Hi Elena,

> Michael, have you tested 5.1 + patch with older gcc? Any problems?
> If not I'll commit it right away.

It proofreads good and it tests good, like a patch should.

I hand-applied the patch to the 5.1 line.  The process of hand application
was good for proofreading.

I believe that my work in translating the patch from mainline to 5.1
branch is trivial and obvious.  This might be important because I don't
have an FSF assignment in place yet (the FSF has just sent me paperwork).
Andrew, is this an issue?

The patch touches only dwarf-2 support and only for the attribute form
DW_FORM_strp, plus it removes some support for the unsupported case
HOST_CHAR_BITS != 8.  The HOST_CHAR_BITS parts were in the original
patch in response to a comment from Andrew.

I tested the 5.1 line with 8 configurations:

  gcc 2.95.3, gcc 3.0.2, gcc HEAD, gcc gcc-3_0-branch
  -gstabs+, -gdwarf-2

The tables are here:

  http://www.shout.net/~mec/public_html/sunday/2001-12-06/index.html

The new gdb fixes the problem with gcc HEAD dwarf-2 and the results are
similar to the gcc 3.0.2 dwarf-2 and gcc gcc-3_0-branch dwarf2.  There
are no significant regressions with the other 7 tested configurations.
There are insignificant result transitions in gdb.c++/annota2.exp
and gdb.base/interrupt.exp.

I recomend this patch for commitment on the 5.1 branch.

Michael C

===

2001-11-12  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2read.c (dwarf_str_buffer): New.
	(struct dwarf2_pinfo): Add dwarf_str_buffer and dwarf_str_size.
	(DWARF_STR_BUFFER, DWARF_STR_SIZE): Define.
	(dwarf2_has_info): Clear dwarf_str_offset.
	(dwarf2_build_psymtabs): Read .debug_str section if present.
	(dwarf2_build_psymtabs_hard): Save DWARF_STR_BUFFER and
	DWARF_STR_SIZE.
	(psymtab_to_symtab_1): Restore DWARF_STR_BUFFER and DWARF_STR_SIZE.
	(read_attribute): Handle DW_FORM_strp.
	(read_n_bytes, read_string): Remove HOST_CHAR_BIT != 8
	handling code.
	(read_indirect_string): New.
	(dump_die): Handle DW_FORM_strp.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.29
diff -c -3 -r1.29 dwarf2read.c
*** dwarf2read.c	2001/07/05 16:45:48	1.29
--- dwarf2read.c	2001/12/07 11:01:20
***************
*** 43,48 ****
--- 43,49 ----
  #include "bcache.h"
  #include <fcntl.h>
  #include "gdb_string.h"
+ #include "gdb_assert.h"
  #include <sys/types.h>
  
  #ifndef DWARF2_REG_TO_REGNUM
***************
*** 302,307 ****
--- 303,309 ----
  static char *dwarf_info_buffer;
  static char *dwarf_abbrev_buffer;
  static char *dwarf_line_buffer;
+ static char *dwarf_str_buffer;
  
  /* A zeroed version of a partial die for initialization purposes.  */
  static struct partial_die_info zeroed_partial_die;
***************
*** 383,388 ****
--- 385,398 ----
      /* Pointer to start of dwarf line buffer for the objfile.  */
  
      char *dwarf_line_buffer;
+ 
+     /* Pointer to start of dwarf string buffer for the objfile.  */
+ 
+     char *dwarf_str_buffer;
+ 
+     /* Size of dwarf string section for the objfile.  */
+ 
+     unsigned int dwarf_str_size;
    };
  
  #define PST_PRIVATE(p) ((struct dwarf2_pinfo *)(p)->read_symtab_private)
***************
*** 391,396 ****
--- 401,408 ----
  #define DWARF_ABBREV_BUFFER(p) (PST_PRIVATE(p)->dwarf_abbrev_buffer)
  #define DWARF_ABBREV_SIZE(p) (PST_PRIVATE(p)->dwarf_abbrev_size)
  #define DWARF_LINE_BUFFER(p) (PST_PRIVATE(p)->dwarf_line_buffer)
+ #define DWARF_STR_BUFFER(p)  (PST_PRIVATE(p)->dwarf_str_buffer)
+ #define DWARF_STR_SIZE(p)    (PST_PRIVATE(p)->dwarf_str_size)
  
  /* Maintain an array of referenced fundamental types for the current
     compilation unit being read.  For DWARF version 1, we have to construct
***************
*** 619,624 ****
--- 631,639 ----
  
  static char *read_string (bfd *, char *, unsigned int *);
  
+ static char *read_indirect_string (bfd *, char *, const struct comp_unit_head *,
+                                    unsigned int *);
+ 
  static unsigned long read_unsigned_leb128 (bfd *, char *, unsigned int *);
  
  static long read_signed_leb128 (bfd *, char *, unsigned int *);
***************
*** 791,796 ****
--- 806,812 ----
  dwarf2_has_info (bfd *abfd)
  {
    dwarf_info_offset = dwarf_abbrev_offset = dwarf_line_offset = 0;
+   dwarf_str_offset = 0;
    bfd_map_over_sections (abfd, dwarf2_locate_sections, NULL);
    if (dwarf_info_offset && dwarf_abbrev_offset)
      {
***************
*** 869,874 ****
--- 885,897 ----
  					   dwarf_line_offset,
  					   dwarf_line_size);
  
+   if (dwarf_str_offset)
+     dwarf_str_buffer = dwarf2_read_section (objfile,
+                                         dwarf_str_offset,
+                                         dwarf_str_size);
+   else
+     dwarf_str_buffer = NULL;
+ 
    if (mainline || objfile->global_psymbols.size == 0 ||
        objfile->static_psymbols.size == 0)
      {
***************
*** 1045,1050 ****
--- 1068,1075 ----
        DWARF_ABBREV_BUFFER (pst) = dwarf_abbrev_buffer;
        DWARF_ABBREV_SIZE (pst) = dwarf_abbrev_size;
        DWARF_LINE_BUFFER (pst) = dwarf_line_buffer;
+       DWARF_STR_BUFFER (pst) = dwarf_str_buffer;
+       DWARF_STR_SIZE (pst) = dwarf_str_size;
        baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  
        /* Store the function that reads in the rest of the symbol table */
***************
*** 1344,1349 ****
--- 1369,1376 ----
    dwarf_abbrev_buffer = DWARF_ABBREV_BUFFER (pst);
    dwarf_abbrev_size = DWARF_ABBREV_SIZE (pst);
    dwarf_line_buffer = DWARF_LINE_BUFFER (pst);
+   dwarf_str_buffer = DWARF_STR_BUFFER (pst);
+   dwarf_str_size = DWARF_STR_SIZE (pst);
    baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile));
    cu_header_offset = offset;
    info_ptr = dwarf_info_buffer + offset;
***************
*** 3358,3363 ****
--- 3385,3395 ----
        DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read);
        info_ptr += bytes_read;
        break;
+     case DW_FORM_strp:
+       DW_STRING (attr) = read_indirect_string (abfd, info_ptr, cu_header,
+ 	                                       &bytes_read);
+       info_ptr += bytes_read;
+       break;
      case DW_FORM_block:
        blk = dwarf_alloc_block ();
        blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
***************
*** 3410,3416 ****
        DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
        info_ptr += bytes_read;
        break;
-     case DW_FORM_strp:
      case DW_FORM_indirect:
      default:
        error ("Dwarf Error: Cannot handle %s in DWARF reader.",
--- 3442,3447 ----
***************
*** 3597,3628 ****
  static char *
  read_n_bytes (bfd *abfd, char *buf, unsigned int size)
  {
!   /* If the size of a host char is 8 bits, we can return a pointer
!      to the buffer, otherwise we have to copy the data to a buffer
!      allocated on the temporary obstack.  */
! #if HOST_CHAR_BIT == 8
    return buf;
- #else
-   char *ret;
-   unsigned int i;
- 
-   ret = obstack_alloc (&dwarf2_tmp_obstack, size);
-   for (i = 0; i < size; ++i)
-     {
-       ret[i] = bfd_get_8 (abfd, (bfd_byte *) buf);
-       buf++;
-     }
-   return ret;
- #endif
  }
  
  static char *
  read_string (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
  {
!   /* If the size of a host char is 8 bits, we can return a pointer
!      to the string, otherwise we have to copy the string to a buffer
!      allocated on the temporary obstack.  */
! #if HOST_CHAR_BIT == 8
    if (*buf == '\0')
      {
        *bytes_read_ptr = 1;
--- 3628,3643 ----
  static char *
  read_n_bytes (bfd *abfd, char *buf, unsigned int size)
  {
!   /* Require host char == 8 bits.  Other parts of GDB already do this (findvar.c).  */
!   gdb_assert (HOST_CHAR_BIT == 8);
    return buf;
  }
  
  static char *
  read_string (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
  {
!   /* Require host char == 8 bits.  Other parts of GDB already do this (findvar.c).  */
!   gdb_assert (HOST_CHAR_BIT == 8);
    if (*buf == '\0')
      {
        *bytes_read_ptr = 1;
***************
*** 3630,3654 ****
      }
    *bytes_read_ptr = strlen (buf) + 1;
    return buf;
! #else
!   int byte;
!   unsigned int i = 0;
  
!   while ((byte = bfd_get_8 (abfd, (bfd_byte *) buf)) != 0)
      {
!       obstack_1grow (&dwarf2_tmp_obstack, byte);
!       i++;
!       buf++;
      }
!   if (i == 0)
      {
!       *bytes_read_ptr = 1;
        return NULL;
      }
!   obstack_1grow (&dwarf2_tmp_obstack, '\0');
!   *bytes_read_ptr = i + 1;
!   return obstack_finish (&dwarf2_tmp_obstack);
! #endif
  }
  
  static unsigned long
--- 3645,3675 ----
      }
    *bytes_read_ptr = strlen (buf) + 1;
    return buf;
! }
  
! static char *
! read_indirect_string (bfd *abfd, char *buf,
!                       const struct comp_unit_head *cu_header,
! 		      unsigned int *bytes_read_ptr)
! {
!   LONGEST str_offset = read_offset (abfd, buf, cu_header,
!                                     (int *) bytes_read_ptr);
!   if (dwarf_str_buffer == NULL)
      {
!       error ("DW_FORM_strp used without .debug_str section");
!       return NULL;
      }
! 
!   if (str_offset >= dwarf_str_size)
      {
!       error ("DW_FORM_strp pointing outside of .debug_str section");
        return NULL;
      }
! 
!   gdb_assert (HOST_CHAR_BIT == 8);
!   if (dwarf_str_buffer[str_offset] == '\0')
!     return NULL;
!   return dwarf_str_buffer + str_offset;
  }
  
  static unsigned long
***************
*** 5552,5557 ****
--- 5573,5579 ----
  	  fprintf (stderr, "constant: %ld", DW_UNSND (&die->attrs[i]));
  	  break;
  	case DW_FORM_string:
+ 	case DW_FORM_strp:
  	  fprintf (stderr, "string: \"%s\"",
  		   DW_STRING (&die->attrs[i])
  		   ? DW_STRING (&die->attrs[i]) : "");
***************
*** 5562,5569 ****
  	  else
  	    fprintf (stderr, "flag: FALSE");
  	  break;
- 	case DW_FORM_strp:	/* we do not support separate string
- 				   section yet */
  	case DW_FORM_indirect:	/* we do not handle indirect yet */
  	default:
  	  fprintf (stderr, "unsupported attribute form: %d.",
--- 5584,5589 ----


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
@ 2001-12-06  9:25 Michael Elizabeth Chastain
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2001-12-06  9:25 UTC (permalink / raw)
  To: ezannoni; +Cc: ac131313, drow, gdb-patches

Good morning Elena,

> Michael, have you tested 5.1 + patch with older gcc? Any problems?
> If not I'll commit it right away.

I haven't proof-read it or tested it yet.

I can do that tonight.

Michael C


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
  2001-12-04  0:41 Michael Elizabeth Chastain
@ 2001-12-06  7:12 ` Elena Zannoni
  0 siblings, 0 replies; 14+ messages in thread
From: Elena Zannoni @ 2001-12-06  7:12 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: drow, ac131313, gdb-patches

Michael Elizabeth Chastain writes:
 > Daniel Jacobowitz writes:
 > 
 > > I'm pretty sure that a patch for this was approved on mainline
 > > in November:
 > >   http://sources.redhat.com/ml/gdb-patches/2001-11/msg00231.html
 > > 
 > > You're not going to be able to use 5.1-branch with the output of GCC mainline
 > > unless this is moved to the branch.
 > 
 > Yes, for dwarf-2, that is.  stabs+ is working okay.
 > 
 > I will test this patch in the 5.1 branch and report back.

Michael, have you tested 5.1 + patch with older gcc? Any problems?
If not I'll commit it right away.

Thanks
Elena


 > 
 > Michael C


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
@ 2001-12-04  0:41 Michael Elizabeth Chastain
  2001-12-06  7:12 ` Elena Zannoni
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2001-12-04  0:41 UTC (permalink / raw)
  To: drow; +Cc: ac131313, gdb-patches

Daniel Jacobowitz writes:

> I'm pretty sure that a patch for this was approved on mainline
> in November:
>   http://sources.redhat.com/ml/gdb-patches/2001-11/msg00231.html
> 
> You're not going to be able to use 5.1-branch with the output of GCC mainline
> unless this is moved to the branch.

Yes, for dwarf-2, that is.  stabs+ is working okay.

I will test this patch in the 5.1 branch and report back.

Michael C


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
  2001-12-03  9:53 Michael Elizabeth Chastain
@ 2001-12-03  9:58 ` Daniel Jacobowitz
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Jacobowitz @ 2001-12-03  9:58 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb-patches

On Mon, Dec 03, 2001 at 11:53:28AM -0600, Michael Elizabeth Chastain wrote:
> I'm having trouble with gcc cvs mainline: gcc segfaults when
> compiling virtfunc.cc with either dwarf-2 or stabs.  This is native
> i686-pc-linux-gnu on a red hat linux 7.1 system, with a gcc pulled
> on 2001-12-01.
> 
> What v3 compiler are you using to test with?

Re-pull.  Jason found a problem with his patch and didn't fix it until
sometime last night or this morning.

> I'd like to test your current patch, but I'm not ready to yet.  My weekend
> test runs are not finished.  gdb 5.1 branch + gcc cvs mainline + dwarf-2
> ran for 18 hours (ouch!)

Ouch!  We might want to track where the performance problem there is.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFA] Allow casting of object pointers for method calls
@ 2001-12-03  9:53 Michael Elizabeth Chastain
  2001-12-03  9:58 ` Daniel Jacobowitz
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2001-12-03  9:53 UTC (permalink / raw)
  To: drow, gdb-patches

I'm having trouble with gcc cvs mainline: gcc segfaults when
compiling virtfunc.cc with either dwarf-2 or stabs.  This is native
i686-pc-linux-gnu on a red hat linux 7.1 system, with a gcc pulled
on 2001-12-01.

What v3 compiler are you using to test with?

I'd like to test your current patch, but I'm not ready to yet.  My weekend
test runs are not finished.  gdb 5.1 branch + gcc cvs mainline + dwarf-2
ran for 18 hours (ouch!)

Michael C


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [RFA] Allow casting of object pointers for method calls
@ 2001-12-03  7:41 Daniel Jacobowitz
  2001-12-21 12:04 ` Jim Blandy
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2001-12-03  7:41 UTC (permalink / raw)
  To: gdb-patches

I'd like to commit this.

From the comment on value_virtual_fn_field:
   VALUEP is a pointer to a pointer to a value, holding the object
   whose virtual function we want to invoke.  If the ABI requires a
   virtual function's caller to adjust the `this' pointer by an amount
   retrieved from the vtable before invoking the function (i.e., we're
   not using "vtable thunks" to do the adjustment automatically), then
   this function may set *VALUEP to point to a new object with an
   appropriately tweaked address.

find_overload_match went out of its way to prevent this from working.  The
cast at the end is unpleasant but, as far as I can see, correct;
value_find_oload_method_list tends to dereference pointers, and if we don't
return this rather than *this things die.

With this patch, all virtfunc tests other than:
XFAIL: gdb.c++/virtfunc.exp: print pEe->D::vg()

pass using g++ 2.95.  No other regressions.  I'll submit a separate patch to
remove their XFAILs.  This is also necessary for my g++ 3.0 support stuff,
which is pretty trivial after Jason's gcc work and this values patchs.

Anyone, comments?  I think the hack is (for now at least, maybe with a
FIXME) tolerable.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2001-12-03  Daniel Jacobowitz  <drow@mvista.com>

	* valops.c (find_overload_match): Accept obj as a
	reference parameter.  Update it before returning.
	* value.h (find_overload_match): Update prototype.
	* eval.c (evaluate_subexp_standard): Pass object to
	find_overload_match by reference.

Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.16
diff -u -p -r1.16 eval.c
--- eval.c	2001/11/12 21:20:18	1.16
+++ eval.c	2001/12/03 15:27:58
@@ -845,7 +845,7 @@ evaluate_subexp_standard (struct type *e
 
 	      (void) find_overload_match (arg_types, nargs, tstr,
 				     1 /* method */ , 0 /* strict match */ ,
-					  arg2 /* the object */ , NULL,
+					  &arg2 /* the object */ , NULL,
 					  &valp, NULL, &static_memfuncp);
 
 
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.41
diff -u -p -r1.41 valops.c
--- valops.c	2001/11/13 16:44:13	1.41
+++ valops.c	2001/12/03 15:27:58
@@ -2618,12 +2618,13 @@ value_find_oload_method_list (value_ptr 
 
 int
 find_overload_match (struct type **arg_types, int nargs, char *name, int method,
-		     int lax, value_ptr obj, struct symbol *fsym,
+		     int lax, value_ptr *objp, struct symbol *fsym,
 		     value_ptr *valp, struct symbol **symp, int *staticp)
 {
   int nparms;
   struct type **parm_types;
   int champ_nparms = 0;
+  struct value *obj = (objp ? *objp : NULL);
 
   short oload_champ = -1;	/* Index of best overloaded function */
   short oload_ambiguous = 0;	/* Current ambiguity state for overload resolution */
@@ -2847,6 +2848,15 @@ find_overload_match (struct type **arg_t
       xfree (func_name);
     }
 
+  if (objp)
+    {
+      if (TYPE_CODE (VALUE_TYPE (temp)) != TYPE_CODE_PTR
+	  && TYPE_CODE (VALUE_TYPE (*objp)) == TYPE_CODE_PTR)
+	{
+	  temp = value_addr (temp);
+	}
+      *objp = temp;
+    }
   return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
 }
 
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.22
diff -u -p -r1.22 value.h
--- value.h	2001/10/16 01:58:07	1.22
+++ value.h	2001/12/03 15:27:58
@@ -386,7 +386,7 @@ extern struct fn_field *value_find_oload
 
 extern int find_overload_match (struct type **arg_types, int nargs,
 				char *name, int method, int lax,
-				value_ptr obj, struct symbol *fsym,
+				value_ptr *obj, struct symbol *fsym,
 				value_ptr * valp, struct symbol **symp,
 				int *staticp);
 


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2002-01-04 17:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-03 10:05 [RFA] Allow casting of object pointers for method calls Michael Elizabeth Chastain
2001-12-03 10:12 ` Daniel Jacobowitz
2001-12-03 13:07   ` Andrew Cagney
2001-12-06  7:01     ` Elena Zannoni
  -- strict thread matches above, loose matches on Subject: below --
2001-12-07  3:22 Michael Elizabeth Chastain
2001-12-07  6:52 ` Elena Zannoni
2001-12-06  9:25 Michael Elizabeth Chastain
2001-12-04  0:41 Michael Elizabeth Chastain
2001-12-06  7:12 ` Elena Zannoni
2001-12-03  9:53 Michael Elizabeth Chastain
2001-12-03  9:58 ` Daniel Jacobowitz
2001-12-03  7:41 Daniel Jacobowitz
2001-12-21 12:04 ` Jim Blandy
2002-01-04  9:52   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox