complain (&index_complaint, sym_name);
index_complaint (sym_name);
parse_type PARAMS ((int, union aux_ext *, unsigned int, int *, int, char *));static struct symbol *mylookup_symbol PARAMS ((char *, struct block *, namespace_enum,			 enum address_class));static struct block *shrink_block PARAMS ((struct block *, struct symtab *));static PTRxzalloc PARAMS ((unsigned int));static voidsort_blocks PARAMS ((struct symtab *));static intcompare_blocks PARAMS ((const void *, const void *));static struct partial_symtab *new_psymtab PARAMS ((char *, struct objfile *, struct section_offsets *));static voidpsymtab_to_symtab_1 PARAMS ((struct partial_symtab *, char *));static voidadd_block PARAMS ((struct block *, struct symtab *));static voidadd_symbol PARAMS ((struct symbol *, struct block *));static intadd_line PARAMS ((struct linetable *, int, CORE_ADDR, int));static struct linetable *shrink_linetable PARAMS ((struct linetable *));static voidhandle_psymbol_enumerators PARAMS ((struct objfile *, FDR *, int, CORE_ADDR));static char *mdebug_next_symbol_text PARAMS ((struct objfile *));/* Address bounds for the signal trampoline in inferior, if any */CORE_ADDR sigtramp_address, sigtramp_end;/* Allocate zeroed memory */static PTRxzalloc (size)     unsigned int size;{  PTR p = xmalloc (size);  memset (p, 0, size);  return p;}/* Exported procedure: Builds a symtab from the PST partial one.   Restores the environment in effect when PST was created, delegates   most of the work to an ancillary procedure, and sorts   and reorders the symtab list at the end */static voidmdebug_psymtab_to_symtab (pst)     struct partial_symtab *pst;{  if (!pst)    return;  if (info_verbose)    {      printf_filtered ("Reading in symbols for %s...", pst->filename);      gdb_flush (gdb_stdout);    }  next_symbol_text_func = mdebug_next_symbol_text;  psymtab_to_symtab_1 (pst, pst->filename);  /* Match with global symbols.  This only needs to be done once,     after all of the symtabs and dependencies have been read in.   */  scan_file_globals (pst->objfile);  if (info_verbose)    printf_filtered ("done.\n");}/* File-level interface functions *//* Find a file descriptor given its index RF relative to a file CF */static FDR *get_rfd (cf, rf)     int cf, rf;{  FDR *fdrs;  register FDR *f;  RFDT rfd;  fdrs = debug_info->fdr;  f = fdrs + cf;  /* Object files do not have the RFD table, all refs are absolute */  if (f->rfdBase == 0)    return fdrs + rf;  (*debug_swap->swap_rfd_in) (cur_bfd,			     ((char *) debug_info->external_rfd			      + ((f->rfdBase + rf)				 * debug_swap->external_rfd_size)),			     &rfd);  return fdrs + rfd;}/* Return a safer print NAME for a file descriptor */static char *fdr_name (f)     FDR *f;{  if (f->rss == -1)    return "<stripped file>";  if (f->rss == 0)    return "<NFY>";  return debug_info->ss + f->issBase + f->rss;}/* Read in and parse the symtab of the file OBJFILE.  Symbols from   different sections are relocated via the SECTION_OFFSETS.  */voidmdebug_build_psymtabs (objfile, swap, info, section_offsets)     struct objfile *objfile;     const struct ecoff_debug_swap *swap;     struct ecoff_debug_info *info;     struct section_offsets *section_offsets;{  cur_bfd = objfile->obfd;  debug_swap = swap;  debug_info = info;  /* Make sure all the FDR information is swapped in.  */  if (info->fdr == (FDR *) NULL)    {      char *fdr_src;      char *fdr_end;      FDR *fdr_ptr;      info->fdr = (FDR *) obstack_alloc (&objfile->psymbol_obstack,					 (info->symbolic_header.ifdMax					  * sizeof (FDR)));      fdr_src = info->external_fdr;      fdr_end = (fdr_src		 + info->symbolic_header.ifdMax * swap->external_fdr_size);      fdr_ptr = info->fdr;      for (; fdr_src < fdr_end; fdr_src += swap->external_fdr_size, fdr_ptr++)	(*swap->swap_fdr_in) (objfile->obfd, fdr_src, fdr_ptr);    }  parse_partial_symbols (objfile, section_offsets);#if 0  /* Check to make sure file was compiled with -g.  If not, warn the     user of this limitation.  */  if (compare_glevel (max_glevel, GLEVEL_2) < 0)    {      if (max_gdbinfo == 0)	printf_unfiltered ("\n%s not compiled with -g, debugging support is limited.\n",		 objfile->name);      printf_unfiltered ("You should compile with -g2 or -g3 for best debugging support.\n");      gdb_flush (gdb_stdout);    }#endif}/* Local utilities *//* Map of FDR indexes to partial symtabs */struct pst_map{  struct partial_symtab *pst;	/* the psymtab proper */  long n_globals;		/* exported globals (external symbols) */  long globals_offset;		/* cumulative */};/* Utility stack, used to nest procedures and blocks properly.   It is a doubly linked list, to avoid too many alloc/free.   Since we might need it quite a few times it is NOT deallocated   after use. */static struct parse_stack{  struct parse_stack *next, *prev;  struct symtab *cur_st;	/* Current symtab. */  struct block *cur_block;	/* Block in it. */  /* What are we parsing.  stFile, or stBlock are for files and     blocks.  stProc or stStaticProc means we have seen the start of a     procedure, but not the start of the block within in.  When we see     the start of that block, we change it to stNil, without pushing a     new block, i.e. stNil means both a procedure and a block.  */  int blocktype;  int maxsyms;			/* Max symbols in this block. */  struct type *cur_type;	/* Type we parse fields for. */  int cur_field;		/* Field number in cur_type. */  CORE_ADDR procadr;		/* Start addres of this procedure */  int numargs;			/* Its argument count */} *top_stack;			/* Top stack ptr *//* Enter a new lexical context */static voidpush_parse_stack (){  struct parse_stack *new;  /* Reuse frames if possible */  if (top_stack && top_stack->prev)    new = top_stack->prev;  else    new = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));  /* Initialize new frame with previous content */  if (top_stack)    {      register struct parse_stack *prev = new->prev;      *new = *top_stack;      top_stack->prev = new;      new->prev = prev;      new->next = top_stack;    }  top_stack = new;}/* Exit a lexical context */static voidpop_parse_stack (){  if (!top_stack)    return;  if (top_stack->next)    top_stack = top_stack->next;}/* Cross-references might be to things we haven't looked at   yet, e.g. type references.  To avoid too many type   duplications we keep a quick fixup table, an array   of lists of references indexed by file descriptor */struct mdebug_pending{  struct mdebug_pending *next;	/* link */  char *s;			/* the unswapped symbol */  struct type *t;		/* its partial type descriptor */};/* The pending information is kept for an entire object file, and used   to be in the sym_private field.  I took it out when I split   mdebugread from mipsread, because this might not be the only type   of symbols read from an object file.  Instead, we allocate the   pending information table when we create the partial symbols, and   we store a pointer to the single table in each psymtab.  */static struct mdebug_pending **pending_list;/* Check whether we already saw symbol SH in file FH */static struct mdebug_pending *is_pending_symbol (fh, sh)     FDR *fh;     char *sh;{  int f_idx = fh - debug_info->fdr;  register struct mdebug_pending *p;  /* Linear search is ok, list is typically no more than 10 deep */  for (p = pending_list[f_idx]; p; p = p->next)    if (p->s == sh)      break;  return p;}/* Add a new symbol SH of type T */static voidadd_pending (fh, sh, t)     FDR *fh;     char *sh;     struct type *t;{  int f_idx = fh - debug_info->fdr;  struct mdebug_pending *p = is_pending_symbol (fh, sh);  /* Make sure we do not make duplicates */  if (!p)    {      p = ((struct mdebug_pending *)	   obstack_alloc (&current_objfile->psymbol_obstack,			  sizeof (struct mdebug_pending)));      p->s = sh;      p->t = t;      p->next = pending_list[f_idx];      pending_list[f_idx] = p;    }}/* Parsing Routines proper. *//* Parse a single symbol. Mostly just make up a GDB symbol for it.   For blocks, procedures and types we open a new lexical context.   This is basically just a big switch on the symbol's type.  Argument   AX is the base pointer of aux symbols for this file (fh->iauxBase).   EXT_SH points to the unswapped symbol, which is needed for struct,   union, etc., types; it is NULL for an EXTR.  BIGEND says whether   aux symbols are big-endian or little-endian.  Return count of   SYMR's handled (normally one).  */static intparse_symbol (sh, ax, ext_sh, bigend, section_offsets)     SYMR *sh;     union aux_ext *ax;     char *ext_sh;     int bigend;     struct section_offsets *section_offsets;{  const bfd_size_type external_sym_size = debug_swap->external_sym_size;  void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *)) =    debug_swap->swap_sym_in;  char *name;  struct symbol *s;  struct block *b;  struct mdebug_pending *pend;  struct type *t;  struct field *f;  int count = 1;  enum address_class class;  TIR tir;  long svalue = sh->value;  int bitsize;  if (ext_sh == (char *) NULL)    name = debug_info->ssext + sh->iss;  else    name = debug_info->ss + cur_fdr->issBase + sh->iss;  switch (sh->sc)    {    case scText:    case scRConst:      /* Do not relocate relative values.	 The value of a stEnd symbol is the displacement from the	 corresponding start symbol value.	 The value of a stBlock symbol is the displacement from the	 procedure address.  */      if (sh->st != stEnd && sh->st != stBlock)	sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT);      break;    case scData:    case scSData:    case scRData:    case scPData:    case scXData:      sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA);      break;    case scBss:    case scSBss:      sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS);      break;    }  switch (sh->st)    {    case stNil:      break;    case stGlobal:		/* external symbol, goes into global block */      class = LOC_STATIC;      b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack->cur_st),			     GLOBAL_BLOCK);      s = new_symbol (name);      SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;      goto data;    case stStatic:		/* static data, goes into current block. */      class = LOC_STATIC;      b = top_stack->cur_block;      s = new_symbol (name);      if (sh->sc == scCommon || sh->sc == scSCommon)	{	  /* It is a FORTRAN common block.  At least for SGI Fortran the	     address is not in the symbol; we need to fix it later in	     scan_file_globals.  */	  int bucket = hashname (SYMBOL_NAME (s));	  SYMBOL_VALUE_CHAIN (s) = global_sym_chain[bucket];	  global_sym_chain[bucket] = s;	}      else	SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;      goto data;    case stLocal:		/* local variable, goes into current block */      if (sh->sc == scRegister)	{	  class = LOC_REGISTER;	  svalue = ECOFF_REG_TO_REGNUM (svalue);	}      else	class = LOC_LOCAL;      b = top_stack->cur_block;      s = new_symbol (name);      SYMBOL_VALUE (s) = svalue;    data:			/* Common code for symbols describing data */      SYMBOL_NAMESPACE (s) = VAR_NAMESPACE;      SYMBOL_CLASS (s) = class;      add_symbol (s, b);      /* Type could be missing if file is compiled without debugging info.  */      if (sh->sc == scUndefined || sh->sc == scSUndefined	  || sh->sc == scNil || sh->index == indexNil)	SYMBOL_TYPE (s) = nodebug_var_symbol_type;      else	SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);      /* Value of a data symbol is its memory address */      break;    case stParam:		/* arg to procedure, goes into current block */      max_gdbinfo++;      found_ecoff_debugging_info = 1;      top_stack->numargs++;      /* Special GNU C++ name.  */      if (is_cplus_marker (name[0]) && name[1] == 't' && name[2] == 0)	name = "this";		/* FIXME, not alloc'd in obstack */      s = new_symbol (name);      SYMBOL_NAMESPACE (s) = VAR_NAMESPACE;      switch (sh->sc)	{	case scRegister:	  /* Pass by value in register.  */	  SYMBOL_CLASS(s) = LOC_REGPARM;	  svalue = ECOFF_REG_TO_REGNUM (svalue);	  break;	case scVar:	  /* Pass by reference on stack.  */	  SYMBOL_CLASS(s) = LOC_REF_ARG;	  break;	case scVarRegister:	  /* Pass by reference in register.  */	  SYMBOL_CLASS(s) = LOC_REGPARM_ADDR;	  svalue = ECOFF_REG_TO_REGNUM (svalue);	  break;	default:	  /* Pass by value on stack.  */	  SYMBOL_CLASS(s) = LOC_ARG;	  break;	}      SYMBOL_VALUE (s) = svalue;      SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);      add_symbol (s, top_stack->cur_block);      break;    case stLabel:		/* label, goes into current block */      s = new_symbol (name);      SYMBOL_NAMESPACE (s) = VAR_NAMESPACE;	/* so that it can be used */      SYMBOL_CLASS (s) = LOC_LABEL;	/* but not misused */      SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;      SYMBOL_TYPE (s) = mdebug_type_int;      add_symbol (s, top_stack->cur_block);      break;    case stProc:		/* Procedure, usually goes into global block */    case stStaticProc:		/* Static procedure, goes into current block */      s = new_symbol (name);      SYMBOL_NAMESPACE (s) = VAR_NAMESPACE;      SYMBOL_CLASS (s) = LOC_BLOCK;      /* Type of the return value */      if (sh->sc == scUndefined || sh->sc == scSUndefined || sh->sc == scNil)	t = mdebug_type_int;      else	{	  t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name);	  if (STREQ(name, "malloc") && t->code == TYPE_CODE_VOID)	    {	      /* I don't know why, but, at least under Linux/Alpha,		 when linking against a malloc without debugging		 symbols, its read as a function returning void---this		 is bad because it means we cannot call functions with		 string arguments interactively; i.e., "call		 printf("howdy\n")" would fail with the error message		 "program has no memory available".  To avoid this, we		 patch up the type and make it void*		 instead. (davidm@azstarnet.com)		 */	      t = make_pointer_type (t, NULL);	    }	}      b = top_stack->cur_block;      if (sh->st == stProc)	{	  struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);	  /* The next test should normally be true, but provides a	     hook for nested functions (which we don't want to make	     global). */	  if (b == BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK))	    b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);	  /* Irix 5 sometimes has duplicate names for the same	     function.  We want to add such names up at the global	     level, not as a nested function.  */	  else if (sh->value == top_stack->procadr)	    b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);	}      add_symbol (s, b);      /* Make a type for the procedure itself */      SYMBOL_TYPE (s) = lookup_function_type (t);      /* Create and enter a new lexical context */      b = new_block (top_stack->maxsyms);      SYMBOL_BLOCK_VALUE (s) = b;      BLOCK_FUNCTION (b) = s;      BLOCK_START (b) = BLOCK_END (b) = sh->value;      BLOCK_SUPERBLOCK (b) = top_stack->cur_block;      add_block (b, top_stack->cur_st);      /* Not if we only have partial info */      if (sh->sc == scUndefined || sh->sc == scSUndefined || sh->sc == scNil)	break;      push_parse_stack ();      top_stack->cur_block = b;      top_stack->blocktype = sh->st;      top_stack->cur_type = SYMBOL_TYPE (s);      top_stack->cur_field = -1;      top_stack->procadr = sh->value;      top_stack->numargs = 0;      break;      /* Beginning of code for structure, union, and enum definitions.	       They all share a common set of local variables, defined here.  */      {	enum type_code type_code;	char *ext_tsym;	int nfields;	long max_value;	struct field *f;    case stStruct:		/* Start a block defining a struct type */	type_code = TYPE_CODE_STRUCT;	goto structured_common;    case stUnion:		/* Start a block defining a union type */	type_code = TYPE_CODE_UNION;	goto structured_common;    case stEnum:		/* Start a block defining an enum type */	type_code = TYPE_CODE_ENUM;	goto structured_common;    case stBlock:		/* Either a lexical block, or some type */	if (sh->sc != scInfo && sh->sc != scCommon && sh->sc != scSCommon)	  goto case_stBlock_code;	/* Lexical block */	type_code = TYPE_CODE_UNDEF;	/* We have a type.  */	/* Common code for handling struct, union, enum, and/or as-yet-	   unknown-type blocks of info about structured data.  `type_code'	   has been set to the proper TYPE_CODE, if we know it.  */      structured_common:	found_ecoff_debugging_info = 1;	push_parse_stack ();	top_stack->blocktype = stBlock;	/* First count the number of fields and the highest value. */	nfields = 0;	max_value = 0;	for (ext_tsym = ext_sh + external_sym_size;	     ;	     ext_tsym += external_sym_size)	  {	    SYMR tsym;	    (*swap_sym_in) (cur_bfd, ext_tsym, &tsym);	    switch (tsym.st)	      {	      case stEnd:		goto end_of_fields;	      case stMember:		if (nfields == 0 && type_code == TYPE_CODE_UNDEF)		  /* If the type of the member is Nil (or Void),		     without qualifiers, assume the tag is an		     enumeration.		     Alpha cc -migrate enums are recognized by a zero		     index and a zero symbol value.  */		  if (tsym.index == indexNil		      || (tsym.index == 0 && sh->value == 0))		    type_code = TYPE_CODE_ENUM;		  else		    {		      (*debug_swap->swap_tir_in) (bigend,						  &ax[tsym.index].a_ti,						  &tir);		      if ((tir.bt == btNil || tir.bt == btVoid)			  && tir.tq0 == tqNil)			type_code = TYPE_CODE_ENUM;		    }		nfields++;		if (tsym.value > max_value)		  max_value = tsym.value;		break;	      case stBlock:	      case stUnion:	      case stEnum:	      case stStruct:		{#if 0		  /* This is a no-op; is it trying to tell us something		     we should be checking?  */		  if (tsym.sc == scVariant);	/*UNIMPLEMENTED*/#endif		  if (tsym.index != 0)		    {		      /* This is something like a struct within a			 struct.  Skip over the fields of the inner			 struct.  The -1 is because the for loop will			 increment ext_tsym.  */		      ext_tsym = ((char *) debug_info->external_sym				  + ((cur_fdr->isymBase + tsym.index - 1)				     * external_sym_size));		    }		}		break;	      case stTypedef:		/* mips cc puts out a typedef for struct x if it is not yet		   defined when it encounters		   struct y { struct x *xp; };		   Just ignore it. */		break;	      case stIndirect:		/* Irix5 cc puts out a stIndirect for struct x if it is not		   yet defined when it encounters		   struct y { struct x *xp; };		   Just ignore it. */		break;	      default:		complain (&block_member_complaint, tsym.st);	      }	  }      end_of_fields:;	/* In an stBlock, there is no way to distinguish structs,	   unions, and enums at this point.  This is a bug in the	   original design (that has been fixed with the recent	   addition of the stStruct, stUnion, and stEnum symbol	   types.)  The way you can tell is if/when you see a variable	   or field of that type.  In that case the variable's type	   (in the AUX table) says if the type is struct, union, or	   enum, and points back to the stBlock here.  So you can	   patch the tag kind up later - but only if there actually is	   a variable or field of that type.	   So until we know for sure, we will guess at this point.	   The heuristic is:	   If the first member has index==indexNil or a void type,	   assume we have an enumeration.	   Otherwise, if there is more than one member, and all	   the members have offset 0, assume we have a union.	   Otherwise, assume we have a struct.	   The heuristic could guess wrong in the case of of an	   enumeration with no members or a union with one (or zero)	   members, or when all except the last field of a struct have	   width zero.  These are uncommon and/or illegal situations,	   and in any case guessing wrong probably doesn't matter	   much.	   But if we later do find out we were wrong, we fixup the tag	   kind.  Members of an enumeration must be handled	   differently from struct/union fields, and that is harder to	   patch up, but luckily we shouldn't need to.  (If there are	   any enumeration members, we can tell for sure it's an enum	   here.) */	if (type_code == TYPE_CODE_UNDEF)	  if (nfields > 1 && max_value == 0)	    type_code = TYPE_CODE_UNION;	  else	    type_code = TYPE_CODE_STRUCT;	/* Create a new type or use the pending type.  */	pend = is_pending_symbol (cur_fdr, ext_sh);	if (pend == (struct mdebug_pending *) NULL)	  {	    t = new_type (NULL);	    add_pending (cur_fdr, ext_sh, t);	  }	else	  t = pend->t;	/* Do not set the tag name if it is a compiler generated tag name	   (.Fxx or .xxfake or empty) for unnamed struct/union/enums.	   Alpha cc puts out an sh->iss of zero for those.  */	if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')	  TYPE_TAG_NAME (t) = NULL;	else	  TYPE_TAG_NAME (t) = obconcat (&current_objfile->symbol_obstack,					"", "", name);	TYPE_CODE (t) = type_code;	TYPE_LENGTH (t) = sh->value;	TYPE_NFIELDS (t) = nfields;	TYPE_FIELDS (t) = f = ((struct field *)			       TYPE_ALLOC (t,					   nfields * sizeof (struct field)));	if (type_code == TYPE_CODE_ENUM)	  {	    int unsigned_enum = 1;	    /* This is a non-empty enum. */	    /* DEC c89 has the number of enumerators in the sh.value field,	       not the type length, so we have to compensate for that	       incompatibility quirk.	       This might do the wrong thing for an enum with one or two	       enumerators and gcc -gcoff -fshort-enums, but these cases	       are hopefully rare enough.	       Alpha cc -migrate has a sh.value field of zero, we adjust	       that too.  */	    if (TYPE_LENGTH (t) == TYPE_NFIELDS (t)		|| TYPE_LENGTH (t) == 0)	      TYPE_LENGTH (t) = TARGET_INT_BIT / HOST_CHAR_BIT;	    for (ext_tsym = ext_sh + external_sym_size;		 ;		 ext_tsym += external_sym_size)	      {		SYMR tsym;		struct symbol *enum_sym;		(*swap_sym_in) (cur_bfd, ext_tsym, &tsym);		if (tsym.st != stMember)		  break;		f->bitpos = tsym.value;		f->type = t;		f->name = debug_info->ss + cur_fdr->issBase + tsym.iss;		f->bitsize = 0;		enum_sym = ((struct symbol *)			    obstack_alloc (&current_objfile->symbol_obstack,					   sizeof (struct symbol)));		memset ((PTR) enum_sym, 0, sizeof (struct symbol));		SYMBOL_NAME (enum_sym) =		  obsavestring (f->name, strlen (f->name),				&current_objfile->symbol_obstack);		SYMBOL_CLASS (enum_sym) = LOC_CONST;		SYMBOL_TYPE (enum_sym) = t;		SYMBOL_NAMESPACE (enum_sym) = VAR_NAMESPACE;		SYMBOL_VALUE (enum_sym) = tsym.value;		if (SYMBOL_VALUE (enum_sym) < 0)		  unsigned_enum = 0;		add_symbol (enum_sym, top_stack->cur_block);		/* Skip the stMembers that we've handled. */		count++;		f++;	      }	    if (unsigned_enum)	      TYPE_FLAGS (t) |= TYPE_FLAG_UNSIGNED;	  }	/* make this the current type */	top_stack->cur_type = t;	top_stack->cur_field = 0;	/* Do not create a symbol for alpha cc unnamed structs.  */	if (sh->iss == 0)	  break;	/* gcc puts out an empty struct for an opaque struct definitions,	   do not create a symbol for it either.  */	if (TYPE_NFIELDS (t) == 0)	  {	    TYPE_FLAGS (t) |= TYPE_FLAG_STUB;	    break;	  }	s = new_symbol (name);	SYMBOL_NAMESPACE (s) = STRUCT_NAMESPACE;	SYMBOL_CLASS (s) = LOC_TYPEDEF;	SYMBOL_VALUE (s) = 0;	SYMBOL_TYPE (s) = t;	add_symbol (s, top_stack->cur_block);	break;	/* End of local variables shared by struct, union, enum, and	   block (as yet unknown struct/union/enum) processing.  */      }    case_stBlock_code:      found_ecoff_debugging_info = 1;      /* beginnning of (code) block. Value of symbol	 is the displacement from procedure start */      push_parse_stack ();      /* Do not start a new block if this is the outermost block of a	 procedure.  This allows the LOC_BLOCK symbol to point to the	 block with the local variables, so funcname::var works.  */      if (top_stack->blocktype == stProc	  || top_stack->blocktype == stStaticProc)	{	  top_stack->blocktype = stNil;	  break;	}      top_stack->blocktype = stBlock;      b = new_block (top_stack->maxsyms);      BLOCK_START (b) = sh->value + top_stack->procadr;      BLOCK_SUPERBLOCK (b) = top_stack->cur_block;      top_stack->cur_block = b;      add_block (b, top_stack->cur_st);      break;    case stEnd:		/* end (of anything) */      if (sh->sc == scInfo || sh->sc == scCommon || sh->sc == scSCommon)	{	  /* Finished with type */	  top_stack->cur_type = 0;	}      else if (sh->sc == scText &&	       (top_stack->blocktype == stProc ||		top_stack->blocktype == stStaticProc))	{	  /* Finished with procedure */	  struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);	  struct mips_extra_func_info *e;	  struct block *b;	  struct type *ftype = top_stack->cur_type;	  int i;	  BLOCK_END (top_stack->cur_block) += sh->value;	/* size */	  /* Make up special symbol to contain procedure specific info */	  s = new_symbol (MIPS_EFI_SYMBOL_NAME);	  SYMBOL_NAMESPACE (s) = LABEL_NAMESPACE;	  SYMBOL_CLASS (s) = LOC_CONST;	  SYMBOL_TYPE (s) = mdebug_type_void;	  e = ((struct mips_extra_func_info *)	       obstack_alloc (&current_objfile->symbol_obstack,			      sizeof (struct mips_extra_func_info)));	  memset ((PTR) e, 0, sizeof (struct mips_extra_func_info));	  SYMBOL_VALUE (s) = (long) e;	  e->numargs = top_stack->numargs;	  e->pdr.framereg = -1;	  add_symbol (s, top_stack->cur_block);	  /* Reallocate symbols, saving memory */	  b = shrink_block (top_stack->cur_block, top_stack->cur_st);	  /* f77 emits proc-level with address bounds==[0,0],	     So look for such child blocks, and patch them.  */	  for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); i++)	    {	      struct block *b_bad = BLOCKVECTOR_BLOCK (bv, i);	      if (BLOCK_SUPERBLOCK (b_bad) == b		  && BLOCK_START (b_bad) == top_stack->procadr		  && BLOCK_END (b_bad) == top_stack->procadr)		{		  BLOCK_START (b_bad) = BLOCK_START (b);		  BLOCK_END (b_bad) = BLOCK_END (b);		}	    }	  if (TYPE_NFIELDS (ftype) <= 0)	    {	      /* No parameter type information is recorded with the function's		 type.  Set that from the type of the parameter symbols. */	      int nparams = top_stack->numargs;	      int iparams;	      struct symbol *sym;	      if (nparams > 0)		{		  TYPE_NFIELDS (ftype) = nparams;		  TYPE_FIELDS (ftype) = (struct field *)		    TYPE_ALLOC (ftype, nparams * sizeof (struct field));						    		  for (i = iparams = 0; iparams < nparams; i++)		    {		      sym = BLOCK_SYM (b, i);		      switch (SYMBOL_CLASS (sym))			{			case LOC_ARG:			case LOC_REF_ARG:			case LOC_REGPARM:			case LOC_REGPARM_ADDR:			  TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);			  iparams++;			  break;			default:			  break;			}		    }		}	    }	}      else if (sh->sc == scText && top_stack->blocktype == stBlock)	{	  /* End of (code) block. The value of the symbol is the	     displacement from the procedure`s start address of the	     end of this block. */	  BLOCK_END (top_stack->cur_block) = sh->value + top_stack->procadr;	  shrink_block (top_stack->cur_block, top_stack->cur_st);	}      else if (sh->sc == scText && top_stack->blocktype == stNil)	{	  /* End of outermost block.  Pop parse stack and ignore.  The	     following stEnd of stProc will take care of the block.  */	  ;	}      else if (sh->sc == scText && top_stack->blocktype == stFile)	{	  /* End of file.  Pop parse stack and ignore.  Higher	     level code deals with this.  */	  ;	}      else	complain (&stEnd_complaint, sh->sc);      pop_parse_stack ();	/* restore previous lexical context */      break;    case stMember:		/* member of struct or union */      f = &TYPE_FIELDS (top_stack->cur_type)[top_stack->cur_field++];      f->name = name;      f->bitpos = sh->value;      bitsize = 0;      f->type = parse_type (cur_fd, ax, sh->index, &bitsize, bigend, name);      f->bitsize = bitsize;      break;    case stIndirect:		/* forward declaration on Irix5 */      /* Forward declarations from Irix5 cc are handled by cross_ref,	 skip them.  */      break;    case stTypedef:		/* type definition */      found_ecoff_debugging_info = 1;      /* Typedefs for forward declarations and opaque structs from alpha cc	 are handled by cross_ref, skip them.  */      if (sh->iss == 0)	break;      /* Parse the type or use the pending type.  */      pend = is_pending_symbol (cur_fdr, ext_sh);      if (pend == (struct mdebug_pending *) NULL)	{	  t = parse_type (cur_fd, ax, sh->index, (int *)NULL, bigend, name);	  add_pending (cur_fdr, ext_sh, t);	}      else	t = pend->t;      /* mips cc puts out a typedef with the name of the struct for forward	 declarations. These should not go into the symbol table and	 TYPE_NAME should not be set for them.	 They can't be distinguished from an intentional typedef to	 the same name however:	 x.h:		struct x { int ix; int jx; };		struct xx;	 x.c:		typedef struct x x;		struct xx {int ixx; int jxx; };	 generates a cross referencing stTypedef for x and xx.	 The user visible effect of this is that the type of a pointer	 to struct foo sometimes is given as `foo *' instead of `struct foo *'.	 The problem is fixed with alpha cc and Irix5 cc.  */      /* However if the typedef cross references to an opaque aggregate, it	 is safe to omit it from the symbol table.  */      if (has_opaque_xref (cur_fdr, sh))	break;      s = new_symbol (name);      SYMBOL_NAMESPACE (s) = VAR_NAMESPACE;      SYMBOL_CLASS (s) = LOC_TYPEDEF;      SYMBOL_BLOCK_VALUE (s) = top_stack->cur_block;      SYMBOL_TYPE (s) = t;      add_symbol (s, top_stack->cur_block);      /* Incomplete definitions of structs should not get a name.  */      if (TYPE_NAME (SYMBOL_TYPE (s)) == NULL	  && (TYPE_NFIELDS (SYMBOL_TYPE (s)) != 0              || (TYPE_CODE (SYMBOL_TYPE (s)) != TYPE_CODE_STRUCT		  && TYPE_CODE (SYMBOL_TYPE (s)) != TYPE_CODE_UNION)))	{	  if (TYPE_CODE (SYMBOL_TYPE (s)) == TYPE_CODE_PTR	      || TYPE_CODE (SYMBOL_TYPE (s)) == TYPE_CODE_FUNC)	    {	      /* If we are giving a name to a type such as "pointer to		 foo" or "function returning foo", we better not set		 the TYPE_NAME.  If the program contains "typedef char		 *caddr_t;", we don't want all variables of type char		 * to print as caddr_t.  This is not just a		 consequence of GDB's type management; CC and GCC (at		 least through version 2.4) both output variables of		 either type char * or caddr_t with the type		 refering to the stTypedef symbol for caddr_t.  If a future		 compiler cleans this up it GDB is not ready for it		 yet, but if it becomes ready we somehow need to		 disable this check (without breaking the PCC/GCC2.4		 case).		 Sigh.		 Fortunately, this check seems not to be necessary		 for anything except pointers or functions.  */	    }	  else	    TYPE_NAME (SYMBOL_TYPE (s)) = SYMBOL_NAME (s);	}      break;    case stFile:		/* file name */      push_parse_stack ();      top_stack->blocktype = sh->st;      break;      /* I`ve never seen these for C */    case stRegReloc:      break;			/* register relocation */    case stForward:      break;			/* forwarding address */    case stConstant:      break;			/* constant */    default:      complain (&unknown_mdebug_symtype_complaint, sh->st);      break;    }  return count;}/* Parse the type information provided in the raw AX entries for   the symbol SH. Return the bitfield size in BS, in case.   We must byte-swap the AX entries before we use them; BIGEND says whether   they are big-endian or little-endian (from fh->fBigendian).  */static struct type *parse_type (fd, ax, aux_index, bs, bigend, sym_name)     int fd;     union aux_ext *ax;     unsigned int aux_index;     int *bs;     int bigend;     char *sym_name;{  /* Null entries in this map are treated specially */  static struct type **map_bt[] =  {    &mdebug_type_void,			/* btNil */    &mdebug_type_adr_32,		/* btAdr */    &mdebug_type_char,			/* btChar */    &mdebug_type_unsigned_char,		/* btUChar */    &mdebug_type_short,			/* btShort */    &mdebug_type_unsigned_short,	/* btUShort */    &mdebug_type_int_32,		/* btInt */    &mdebug_type_unsigned_int_32,	/* btUInt */    &mdebug_type_long_32,		/* btLong */    &mdebug_type_unsigned_long_32,	/* btULong */    &mdebug_type_float,			/* btFloat */    &mdebug_type_double,		/* btDouble */    0,					/* btStruct */    0,					/* btUnion */    0,					/* btEnum */    0,					/* btTypedef */    0,					/* btRange */    0,					/* btSet */    &mdebug_type_complex,		/* btComplex */    &mdebug_type_double_complex,	/* btDComplex */    0,					/* btIndirect */    &mdebug_type_fixed_dec,		/* btFixedDec */    &mdebug_type_float_dec,		/* btFloatDec */    &mdebug_type_string,		/* btString */    0,					/* btBit */    0,					/* btPicture */    &mdebug_type_void,			/* btVoid */    0,					/* DEC C++:  Pointer to member */    0,					/* DEC C++:  Virtual function table */    0,					/* DEC C++:  Class (Record) */    &mdebug_type_long_64,		/* btLong64  */    &mdebug_type_unsigned_long_64,	/* btULong64 */    &mdebug_type_long_long_64,		/* btLongLong64  */    &mdebug_type_unsigned_long_long_64,	/* btULongLong64 */    &mdebug_type_adr_64,		/* btAdr64 */    &mdebug_type_int_64,		/* btInt64  */    &mdebug_type_unsigned_int_64,	/* btUInt64 */  };  TIR t[1];  struct type *tp = 0;  enum type_code type_code = TYPE_CODE_UNDEF;  /* Handle undefined types, they have indexNil. */  if (aux_index == indexNil)    return mdebug_type_int;  /* Handle corrupt aux indices.  */  if (aux_index >= (debug_info->fdr + fd)->caux)    {      complain (&index_complaint, sym_name);      return mdebug_type_int;    }  ax += aux_index;  /* Use aux as a type information record, map its basic type.  */  (*debug_swap->swap_tir_in) (bigend, &ax->a_ti, t);  if (t->bt >= (sizeof (map_bt) / sizeof (*map_bt)))    {      complain (&basic_type_complaint, t->bt, sym_name);      return mdebug_type_int;    }  if (map_bt[t->bt])    {      tp = *map_bt[t->bt];    }  else    {      tp = NULL;      /* Cannot use builtin types -- build our own */      switch (t->bt)	{	case btStruct:	  type_code = TYPE_CODE_STRUCT;	  break;	case btUnion:	  type_code = TYPE_CODE_UNION;	  break;	case btEnum:	  type_code = TYPE_CODE_ENUM;	  break;	case btRange:	  type_code = TYPE_CODE_RANGE;	  break;	case btSet:	  type_code = TYPE_CODE_SET;	  break;	case btIndirect:	  /* alpha cc -migrate uses this for typedefs. The true type will	     be obtained by crossreferencing below.  */	  type_code = TYPE_CODE_ERROR;	  break;	case btTypedef:	  /* alpha cc uses this for typedefs. The true type will be	     obtained by crossreferencing below.  */	  type_code = TYPE_CODE_ERROR;	  break;	default:	  complain (&basic_type_complaint, t->bt, sym_name);	  return mdebug_type_int;	}    }  /* Move on to next aux */  ax++;  if (t->fBitfield)    {      int width = AUX_GET_WIDTH (bigend, ax);      /* Inhibit core dumps with some cfront generated objects that	 corrupt the TIR.  */      if (bs == (int *)NULL)	{	  /* Alpha cc -migrate encodes char and unsigned char types	     as short and unsigned short types with a field width of 8.	     Enum types also have a field width which we ignore for now.  */	  if (t->bt == btShort && width == 8)	    tp = mdebug_type_char;	  else if (t->bt == btUShort && width == 8)	    tp = mdebug_type_unsigned_char;	  else if (t->bt == btEnum)	    ;	  else	    complain (&bad_fbitfield_complaint, sym_name);	}      else        *bs = width;      ax++;    }  /* A btIndirect entry cross references to an aux entry containing     the type.  */  if (t->bt == btIndirect)    {      RNDXR rn[1];      int rf;      FDR *xref_fh;      int xref_fd;      (*debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, rn);      ax++;      if (rn->rfd == 0xfff)	{	  rf = AUX_GET_ISYM (bigend, ax);	  ax++;	}      else	rf = rn->rfd;      if (rf == -1)	{	  complain (&bad_indirect_xref_complaint, sym_name);	  return mdebug_type_int;	}      xref_fh = get_rfd (fd, rf);      xref_fd = xref_fh - debug_info->fdr;      tp = parse_type (xref_fd, debug_info->external_aux + xref_fh->iauxBase,		       rn->index, (int *) NULL, xref_fh->fBigendian, sym_name);    }  /* All these types really point to some (common) MIPS type     definition, and only the type-qualifiers fully identify     them.  We'll make the same effort at sharing. */  if (t->bt == btStruct ||      t->bt == btUnion ||      t->bt == btEnum ||      /* btSet (I think) implies that the name is a tag name, not a typedef	 name.  This apparently is a MIPS extension for C sets.  */      t->bt == btSet)    {      char *name;      /* Try to cross reference this type, build new type on failure.  */      ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);      if (tp == (struct type *) NULL)	tp = init_type (type_code, 0, 0, (char *) NULL, current_objfile);      /* DEC c89 produces cross references to qualified aggregate types,	 dereference them.  */      while (TYPE_CODE (tp) == TYPE_CODE_PTR	     || TYPE_CODE (tp) == TYPE_CODE_ARRAY)	tp = tp->target_type;      /* Make sure that TYPE_CODE(tp) has an expected type code.	 Any type may be returned from cross_ref if file indirect entries	 are corrupted.  */      if (TYPE_CODE (tp) != TYPE_CODE_STRUCT	  && TYPE_CODE (tp) != TYPE_CODE_UNION	  && TYPE_CODE (tp) != TYPE_CODE_ENUM)	{	  complain (&unexpected_type_code_complaint, sym_name);	}      else	{	  /* Usually, TYPE_CODE(tp) is already type_code.  The main	     exception is if we guessed wrong re struct/union/enum.	     But for struct vs. union a wrong guess is harmless, so	     don't complain().  */	  if ((TYPE_CODE (tp) == TYPE_CODE_ENUM	       && type_code != TYPE_CODE_ENUM)	      || (TYPE_CODE (tp) != TYPE_CODE_ENUM		  && type_code == TYPE_CODE_ENUM))	    {	      complain (&bad_tag_guess_complaint, sym_name);	    }	  if (TYPE_CODE (tp) != type_code)	    {	      TYPE_CODE (tp) = type_code;	    }	  /* Do not set the tag name if it is a compiler generated tag name	      (.Fxx or .xxfake or empty) for unnamed struct/union/enums.  */	  if (name[0] == '.' || name[0] == '\0')	    TYPE_TAG_NAME (tp) = NULL;	  else if (TYPE_TAG_NAME (tp) == NULL		   || !STREQ (TYPE_TAG_NAME (tp), name))	    TYPE_TAG_NAME (tp) = obsavestring (name, strlen (name),					       &current_objfile->type_obstack);	}    }  /* All these types really point to some (common) MIPS type     definition, and only the type-qualifiers fully identify     them.  We'll make the same effort at sharing.     FIXME: We are not doing any guessing on range types.  */  if (t->bt == btRange)    {      char *name;      /* Try to cross reference this type, build new type on failure.  */      ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);      if (tp == (struct type *) NULL)	tp = init_type (type_code, 0, 0, (char *) NULL, current_objfile);      /* Make sure that TYPE_CODE(tp) has an expected type code.	 Any type may be returned from cross_ref if file indirect entries	 are corrupted.  */      if (TYPE_CODE (tp) != TYPE_CODE_RANGE)	{	  complain (&unexpected_type_code_complaint, sym_name);	}      else	{	  /* Usually, TYPE_CODE(tp) is already type_code.  The main	     exception is if we guessed wrong re struct/union/enum. */	  if (TYPE_CODE (tp) != type_code)	    {	      complain (&bad_tag_guess_complaint, sym_name);	      TYPE_CODE (tp) = type_code;	    }	  if (TYPE_NAME (tp) == NULL || !STREQ (TYPE_NAME (tp), name))	    TYPE_NAME (tp) = obsavestring (name, strlen (name),					   &current_objfile->type_obstack);	}    }  if (t->bt == btTypedef)    {      char *name;      /* Try to cross reference this type, it should succeed.  */      ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);      if (tp == (struct type *) NULL)	{	  complain (&unable_to_cross_ref_complaint, sym_name);	  tp = mdebug_type_int;	}    }  /* Deal with range types */  if (t->bt == btRange)    {      TYPE_NFIELDS (tp) = 2;      TYPE_FIELDS (tp) = ((struct field *)			  TYPE_ALLOC (tp, 2 * sizeof (struct field)));      TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"),					      &current_objfile->type_obstack);      TYPE_FIELD_BITPOS (tp, 0) = AUX_GET_DNLOW (bigend, ax);      ax++;      TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"),					      &current_objfile->type_obstack);      TYPE_FIELD_BITPOS (tp, 1) = AUX_GET_DNHIGH (bigend, ax);      ax++;    }  /* Parse all the type qualifiers now. If there are more     than 6 the game will continue in the next aux */  while (1)    {#define PARSE_TQ(tq) \      if (t->tq != tqNil) \	ax += upgrade_type(fd, &tp, t->tq, ax, bigend, sym_name); \      else \	break;      PARSE_TQ (tq0);      PARSE_TQ (tq1);      PARSE_TQ (tq2);      PARSE_TQ (tq3);      PARSE_TQ (tq4);      PARSE_TQ (tq5);#undef	PARSE_TQ      /* mips cc 2.x and gcc never put out continued aux entries.  */      if (!t->continued)	break;      (*debug_swap->swap_tir_in) (bigend, &ax->a_ti, t);      ax++;    }  /* Complain for illegal continuations due to corrupt aux entries.  */  if (t->continued)    complain (&bad_continued_complaint, sym_name);   return tp;}