fnp->physname = obsavestring (physname, strlen (physname), &objfile->objfile_obstack);
fnp->physname = physname ? physname : "";
dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,		      struct type *type, struct dwarf2_cu *cu){  struct objfile *objfile = cu->objfile;  struct attribute *attr;  struct fnfieldlist *flp;  int i;  struct fn_field *fnp;  char *fieldname;  char *physname;  struct nextfnfield *new_fnfield;  /* Get name of member function.  */  attr = dwarf2_attr (die, DW_AT_name, cu);  if (attr && DW_STRING (attr))    fieldname = DW_STRING (attr);  else    return;  /* Get the mangled name.  */  physname = dwarf2_linkage_name (die, cu);  /* Look up member function name in fieldlist.  */  for (i = 0; i < fip->nfnfields; i++)    {      if (strcmp (fip->fnfieldlists[i].name, fieldname) == 0)	break;    }  /* Create new list element if necessary.  */  if (i < fip->nfnfields)    flp = &fip->fnfieldlists[i];  else    {      if ((fip->nfnfields % DW_FIELD_ALLOC_CHUNK) == 0)	{	  fip->fnfieldlists = (struct fnfieldlist *)	    xrealloc (fip->fnfieldlists,		      (fip->nfnfields + DW_FIELD_ALLOC_CHUNK)		      * sizeof (struct fnfieldlist));	  if (fip->nfnfields == 0)	    make_cleanup (free_current_contents, &fip->fnfieldlists);	}      flp = &fip->fnfieldlists[fip->nfnfields];      flp->name = fieldname;      flp->length = 0;      flp->head = NULL;      fip->nfnfields++;    }  /* Create a new member function field and chain it to the field list     entry. */  new_fnfield = (struct nextfnfield *) xmalloc (sizeof (struct nextfnfield));  make_cleanup (xfree, new_fnfield);  memset (new_fnfield, 0, sizeof (struct nextfnfield));  new_fnfield->next = flp->head;  flp->head = new_fnfield;  flp->length++;  /* Fill in the member function field info.  */  fnp = &new_fnfield->fnfield;  fnp->physname = obsavestring (physname, strlen (physname),				&objfile->objfile_obstack);  fnp->type = alloc_type (objfile);  if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC)    {      int nparams = TYPE_NFIELDS (die->type);      /* TYPE is the domain of this method, and DIE->TYPE is the type	   of the method itself (TYPE_CODE_METHOD).  */      smash_to_method_type (fnp->type, type,			    TYPE_TARGET_TYPE (die->type),			    TYPE_FIELDS (die->type),			    TYPE_NFIELDS (die->type),			    TYPE_VARARGS (die->type));      /* Handle static member functions.         Dwarf2 has no clean way to discern C++ static and non-static         member functions. G++ helps GDB by marking the first         parameter for non-static member functions (which is the         this pointer) as artificial. We obtain this information         from read_subroutine_type via TYPE_FIELD_ARTIFICIAL.  */      if (nparams == 0 || TYPE_FIELD_ARTIFICIAL (die->type, 0) == 0)	fnp->voffset = VOFFSET_STATIC;    }  else    complaint (&symfile_complaints, "member function type missing for '%s'",	       physname);  /* Get fcontext from DW_AT_containing_type if present.  */  if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)    fnp->fcontext = die_containing_type (die, cu);  /* dwarf2 doesn't have stubbed physical names, so the setting of is_const     and is_volatile is irrelevant, as it is needed by gdb_mangle_name only.  */  /* Get accessibility.  */  attr = dwarf2_attr (die, DW_AT_accessibility, cu);  if (attr)    {      switch (DW_UNSND (attr))	{	case DW_ACCESS_private:	  fnp->is_private = 1;	  break;	case DW_ACCESS_protected:	  fnp->is_protected = 1;	  break;	}    }  /* Check for artificial methods.  */  attr = dwarf2_attr (die, DW_AT_artificial, cu);  if (attr && DW_UNSND (attr) != 0)    fnp->is_artificial = 1;  /* Get index in virtual function table if it is a virtual member function.  */  attr = dwarf2_attr (die, DW_AT_vtable_elem_location, cu);  if (attr)    {      /* Support the .debug_loc offsets */      if (attr_form_is_block (attr))        {          fnp->voffset = decode_locdesc (DW_BLOCK (attr), cu) + 2;        }      else if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)        {	  dwarf2_complex_location_expr_complaint ();        }      else        {	  dwarf2_invalid_attrib_class_complaint ("DW_AT_vtable_elem_location",						 fieldname);        }   }}