unknown_symtype_complaint (local_hex_string (type));
unknown_symtype_complaint (hex_string (type));
process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,		    struct section_offsets *section_offsets,		    struct objfile *objfile){#ifdef SUN_FIXED_LBRAC_BUG  /* If SUN_FIXED_LBRAC_BUG is defined, then it tells us whether we need     to correct the address of N_LBRAC's.  If it is not defined, then     we never need to correct the addresses.  */  /* This records the last pc address we've seen.  We depend on there being     an SLINE or FUN or SO before the first LBRAC, since the variable does     not get reset in between reads of different symbol files.  */  static CORE_ADDR last_pc_address;#endif  struct context_stack *new;  /* This remembers the address of the start of a function.  It is used     because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries are     relative to the current function's start address.  On systems     other than Solaris 2, this just holds the SECT_OFF_TEXT value, and is     used to relocate these symbol types rather than SECTION_OFFSETS.  */  static CORE_ADDR function_start_offset;  /* This holds the address of the start of a function, without the system     peculiarities of function_start_offset.  */  static CORE_ADDR last_function_start;  /* If this is nonzero, we've seen an N_SLINE since the start of the     current function.  We use this to tell us to move the first sline     to the beginning of the function regardless of what its given     value is. */  static int sline_found_in_function = 1;  /* If this is nonzero, we've seen a non-gcc N_OPT symbol for this source     file.  Used to detect the SunPRO solaris compiler.  */  static int n_opt_found;  /* The stab type used for the definition of the last function.     N_STSYM or N_GSYM for SunOS4 acc; N_FUN for other compilers.  */  static int function_stab_type = 0;  if (!block_address_function_relative)    /* N_LBRAC, N_RBRAC and N_SLINE entries are not relative to the       function start address, so just use the text offset.  */    function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));  /* Something is wrong if we see real data before     seeing a source file name.  */  if (last_source_file == NULL && type != (unsigned char) N_SO)    {      /* Ignore any symbols which appear before an N_SO symbol.         Currently no one puts symbols there, but we should deal         gracefully with the case.  A complain()t might be in order,         but this should not be an error ().  */      return;    }  switch (type)    {    case N_FUN:    case N_FNAME:      if (*name == '\000')	{	  /* This N_FUN marks the end of a function.  This closes off the	     current block.  */ 	  if (context_stack_depth <= 0) 	    {	      lbrac_mismatch_complaint (symnum); 	      break; 	    }	  /* The following check is added before recording line 0 at	     end of function so as to handle hand-generated stabs	     which may have an N_FUN stabs at the end of the function, but	     no N_SLINE stabs.  */	  if (sline_found_in_function)	    record_line (current_subfile, 0, last_function_start + valu);	  within_function = 0;	  new = pop_context ();	  /* Make a block for the local symbols within.  */	  finish_block (new->name, &local_symbols, new->old_blocks,			new->start_addr, new->start_addr + valu,			objfile);	  /* May be switching to an assembler file which may not be using	     block relative stabs, so reset the offset.  */	  if (block_address_function_relative)	    function_start_offset = 0;	  break;	}      sline_found_in_function = 0;      /* Relocate for dynamic loading */      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));      valu = SMASH_TEXT_ADDRESS (valu);      last_function_start = valu;      goto define_a_symbol;    case N_LBRAC:      /* This "symbol" just indicates the start of an inner lexical         context within a function.  */      /* Ignore extra outermost context from SunPRO cc and acc.  */      if (n_opt_found && desc == 1)	break;      if (block_address_function_relative)	/* Relocate for Sun ELF acc fn-relative syms.  */	valu += function_start_offset;      else	/* On most machines, the block addresses are relative to the	   N_SO, the linker did not relocate them (sigh).  */	valu += last_source_start_addr;#ifdef SUN_FIXED_LBRAC_BUG      if (!SUN_FIXED_LBRAC_BUG && valu < last_pc_address)	{	  /* Patch current LBRAC pc value to match last handy pc value */	  complaint (&symfile_complaints, "bad block start address patched");	  valu = last_pc_address;	}#endif      new = push_context (desc, valu);      break;    case N_RBRAC:      /* This "symbol" just indicates the end of an inner lexical         context that was started with N_LBRAC.  */      /* Ignore extra outermost context from SunPRO cc and acc.  */      if (n_opt_found && desc == 1)	break;      if (block_address_function_relative)	/* Relocate for Sun ELF acc fn-relative syms.  */	valu += function_start_offset;      else	/* On most machines, the block addresses are relative to the	   N_SO, the linker did not relocate them (sigh).  */	valu += last_source_start_addr;      if (context_stack_depth <= 0)	{	  lbrac_mismatch_complaint (symnum);	  break;	}      new = pop_context ();      if (desc != new->depth)	lbrac_mismatch_complaint (symnum);      /* Some compilers put the variable decls inside of an         LBRAC/RBRAC block.  This macro should be nonzero if this         is true.  DESC is N_DESC from the N_RBRAC symbol.         GCC_P is true if we've detected the GCC_COMPILED_SYMBOL         or the GCC2_COMPILED_SYMBOL.  */#if !defined (VARIABLES_INSIDE_BLOCK)#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) 0#endif      /* Can only use new->locals as local symbols here if we're in         gcc or on a machine that puts them before the lbrack.  */      if (!VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))	{	  if (local_symbols != NULL)	    {	      /* GCC development snapshots from March to December of		 2000 would output N_LSYM entries after N_LBRAC		 entries.  As a consequence, these symbols are simply		 discarded.  Complain if this is the case.  Note that		 there are some compilers which legitimately put local		 symbols within an LBRAC/RBRAC block; this complaint		 might also help sort out problems in which		 VARIABLES_INSIDE_BLOCK is incorrectly defined.  */	      complaint (&symfile_complaints,			 "misplaced N_LBRAC entry; discarding local symbols which have no enclosing block");	    }	  local_symbols = new->locals;	}      if (context_stack_depth	  > !VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))	{	  /* This is not the outermost LBRAC...RBRAC pair in the function,	     its local symbols preceded it, and are the ones just recovered	     from the context stack.  Define the block for them (but don't	     bother if the block contains no symbols.  Should we complain	     on blocks without symbols?  I can't think of any useful purpose	     for them).  */	  if (local_symbols != NULL)	    {	      /* Muzzle a compiler bug that makes end < start.  (which	         compilers?  Is this ever harmful?).  */	      if (new->start_addr > valu)		{		  complaint (&symfile_complaints,			     "block start larger than block end");		  new->start_addr = valu;		}	      /* Make a block for the local symbols within.  */	      finish_block (0, &local_symbols, new->old_blocks,			    new->start_addr, valu, objfile);	    }	}      else	{	  /* This is the outermost LBRAC...RBRAC pair.  There is no	     need to do anything; leave the symbols that preceded it	     to be attached to the function's own block.  We need to	     indicate that we just moved outside of the function.  */	  within_function = 0;	}      if (VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))	/* Now pop locals of block just finished.  */	local_symbols = new->locals;      break;    case N_FN:    case N_FN_SEQ:      /* This kind of symbol indicates the start of an object file.  */      /* Relocate for dynamic loading */      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));      break;    case N_SO:      /* This type of symbol indicates the start of data         for one source file.         Finish the symbol table of the previous source file         (if any) and start accumulating a new symbol table.  */      /* Relocate for dynamic loading */      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));      n_opt_found = 0;#ifdef SUN_FIXED_LBRAC_BUG      last_pc_address = valu;	/* Save for SunOS bug circumcision */#endif#ifdef PCC_SOL_BROKEN      /* pcc bug, occasionally puts out SO for SOL.  */      if (context_stack_depth > 0)	{	  start_subfile (name, NULL);	  break;	}#endif      if (last_source_file)	{	  /* Check if previous symbol was also an N_SO (with some	     sanity checks).  If so, that one was actually the directory	     name, and the current one is the real file name.	     Patch things up. */	  if (previous_stab_code == (unsigned char) N_SO)	    {	      patch_subfile_names (current_subfile, name);	      break;		/* Ignore repeated SOs */	    }	  end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));	  end_stabs ();	}      /* Null name means this just marks the end of text for this .o file.         Don't start a new symtab in this case.  */      if (*name == '\000')	break;      if (block_address_function_relative)	function_start_offset = 0;      start_stabs ();      start_symtab (name, NULL, valu);      record_debugformat ("stabs");      break;    case N_SOL:      /* This type of symbol indicates the start of data for         a sub-source-file, one whose contents were copied or         included in the compilation of the main source file         (whose name was given in the N_SO symbol.)  */      /* Relocate for dynamic loading */      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));      start_subfile (name, current_subfile->dirname);      break;    case N_BINCL:      push_subfile ();      add_new_header_file (name, valu);      start_subfile (name, current_subfile->dirname);      break;    case N_EINCL:      start_subfile (pop_subfile (), current_subfile->dirname);      break;    case N_EXCL:      add_old_header_file (name, valu);      break;    case N_SLINE:      /* This type of "symbol" really just records         one line-number -- core-address correspondence.         Enter it in the line list for this symbol table.  */      /* Relocate for dynamic loading and for ELF acc fn-relative syms.  */      valu += function_start_offset;#ifdef SUN_FIXED_LBRAC_BUG      last_pc_address = valu;	/* Save for SunOS bug circumcision */#endif      /* If this is the first SLINE note in the function, record it at	 the start of the function instead of at the listed location.  */      if (within_function && sline_found_in_function == 0)	{	  record_line (current_subfile, desc, last_function_start);	  sline_found_in_function = 1;	}      else	record_line (current_subfile, desc, valu);      break;    case N_BCOMM:      common_block_start (name, objfile);      break;    case N_ECOMM:      common_block_end (objfile);      break;      /* The following symbol types need to have the appropriate offset added         to their value; then we process symbol definitions in the name.  */    case N_STSYM:		/* Static symbol in data seg */    case N_LCSYM:		/* Static symbol in BSS seg */    case N_ROSYM:		/* Static symbol in Read-only data seg */      /* HORRID HACK DEPT.  However, it's Sun's furgin' fault.         Solaris2's stabs-in-elf makes *most* symbols relative         but leaves a few absolute (at least for Solaris 2.1 and version         2.0.1 of the SunPRO compiler).  N_STSYM and friends sit on the fence.         .stab "foo:S...",N_STSYM        is absolute (ld relocates it)         .stab "foo:V...",N_STSYM        is relative (section base subtracted).         This leaves us no choice but to search for the 'S' or 'V'...         (or pass the whole section_offsets stuff down ONE MORE function         call level, which we really don't want to do).  */      {	char *p;	/* .o files and NLMs have non-zero text seg offsets, but don't need	   their static syms offset in this fashion.  XXX - This is really a	   crock that should be fixed in the solib handling code so that I	   don't have to work around it here. */	if (!symfile_relocatable)	  {	    p = strchr (name, ':');	    if (p != 0 && p[1] == 'S')	      {		/* The linker relocated it.  We don't want to add an		   elfstab_offset_sections-type offset, but we *do* want		   to add whatever solib.c passed to symbol_file_add as		   addr (this is known to affect SunOS4, and I suspect ELF		   too).  Since elfstab_offset_sections currently does not		   muck with the text offset (there is no Ttext.text		   symbol), we can get addr from the text offset.  If		   elfstab_offset_sections ever starts dealing with the		   text offset, and we still need to do this, we need to		   invent a SECT_OFF_ADDR_KLUDGE or something.  */		valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));		goto define_a_symbol;	      }	  }	/* Since it's not the kludge case, re-dispatch to the right handler. */	switch (type)	  {	  case N_STSYM:	    goto case_N_STSYM;	  case N_LCSYM:	    goto case_N_LCSYM;	  case N_ROSYM:	    goto case_N_ROSYM;	  default:	    internal_error (__FILE__, __LINE__, "failed internal consistency check");	  }      }    case_N_STSYM:		/* Static symbol in data seg */    case N_DSLINE:		/* Source line number, data seg */      valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));      goto define_a_symbol;    case_N_LCSYM:		/* Static symbol in BSS seg */    case N_BSLINE:		/* Source line number, bss seg */      /*   N_BROWS:       overlaps with N_BSLINE */      valu += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));      goto define_a_symbol;    case_N_ROSYM:		/* Static symbol in Read-only data seg */      valu += ANOFFSET (section_offsets, SECT_OFF_RODATA (objfile));      goto define_a_symbol;    case N_ENTRY:		/* Alternate entry point */      /* Relocate for dynamic loading */      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));      goto define_a_symbol;      /* The following symbol types we don't know how to process.  Handle         them in a "default" way, but complain to people who care.  */    default:    case N_CATCH:		/* Exception handler catcher */    case N_EHDECL:		/* Exception handler name */    case N_PC:			/* Global symbol in Pascal */    case N_M2C:		/* Modula-2 compilation unit */      /*   N_MOD2:        overlaps with N_EHDECL */    case N_SCOPE:		/* Modula-2 scope information */    case N_ECOML:		/* End common (local name) */    case N_NBTEXT:		/* Gould Non-Base-Register symbols??? */    case N_NBDATA:    case N_NBBSS:    case N_NBSTS:    case N_NBLCS:      unknown_symtype_complaint (local_hex_string (type));      /* FALLTHROUGH */      /* The following symbol types don't need the address field relocated,         since it is either unused, or is absolute.  */    define_a_symbol:    case N_GSYM:		/* Global variable */    case N_NSYMS:		/* Number of symbols (ultrix) */    case N_NOMAP:		/* No map?  (ultrix) */    case N_RSYM:		/* Register variable */    case N_DEFD:		/* Modula-2 GNU module dependency */    case N_SSYM:		/* Struct or union element */    case N_LSYM:		/* Local symbol in stack */    case N_PSYM:		/* Parameter variable */    case N_LENG:		/* Length of preceding symbol type */      if (name)	{	  int deftype;	  char *colon_pos = strchr (name, ':');	  if (colon_pos == NULL)	    deftype = '\0';	  else	    deftype = colon_pos[1];	  switch (deftype)	    {	    case 'f':	    case 'F':	      function_stab_type = type;#ifdef SOFUN_ADDRESS_MAYBE_MISSING	      /* Deal with the SunPRO 3.0 compiler which omits the address	         from N_FUN symbols.  */	      if (type == N_FUN		  && valu == ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)))		{		  CORE_ADDR minsym_valu = 		    find_stab_function_addr (name, last_source_file, objfile);		  /* find_stab_function_addr will return 0 if the minimal		     symbol wasn't found.  (Unfortunately, this might also		     be a valid address.)  Anyway, if it *does* return 0,		     it is likely that the value was set correctly to begin		     with... */		  if (minsym_valu != 0)		    valu = minsym_valu;		}#endif#ifdef SUN_FIXED_LBRAC_BUG	      /* The Sun acc compiler, under SunOS4, puts out	         functions with N_GSYM or N_STSYM.  The problem is	         that the address of the symbol is no good (for N_GSYM	         it doesn't even attept an address; for N_STSYM it	         puts out an address but then it gets relocated	         relative to the data segment, not the text segment).	         Currently we can't fix this up later as we do for	         some types of symbol in scan_file_globals.	         Fortunately we do have a way of finding the address -	         we know that the value in last_pc_address is either	         the one we want (if we're dealing with the first	         function in an object file), or somewhere in the	         previous function. This means that we can use the	         minimal symbol table to get the address.  */	      /* Starting with release 3.0, the Sun acc compiler,	         under SunOS4, puts out functions with N_FUN and a value	         of zero. This gets relocated to the start of the text	         segment of the module, which is no good either.	         Under SunOS4 we can deal with this as N_SLINE and N_SO	         entries contain valid absolute addresses.	         Release 3.0 acc also puts out N_OPT entries, which makes	         it possible to discern acc from cc or gcc.  */	      if (type == N_GSYM || type == N_STSYM		  || (type == N_FUN		      && n_opt_found && !block_address_function_relative))		{		  struct minimal_symbol *m;		  int l = colon_pos - name;		  m = lookup_minimal_symbol_by_pc (last_pc_address);		  if (m && strncmp (DEPRECATED_SYMBOL_NAME (m), name, l) == 0		      && DEPRECATED_SYMBOL_NAME (m)[l] == '\0')		    /* last_pc_address was in this function */		    valu = SYMBOL_VALUE (m);		  else if (m && DEPRECATED_SYMBOL_NAME (m + 1)			   && strncmp (DEPRECATED_SYMBOL_NAME (m + 1), name, l) == 0			   && DEPRECATED_SYMBOL_NAME (m + 1)[l] == '\0')		    /* last_pc_address was in last function */		    valu = SYMBOL_VALUE (m + 1);		  else		    /* Not found - use last_pc_address (for finish_block) */		    valu = last_pc_address;		}	      last_pc_address = valu;	/* Save for SunOS bug circumcision */#endif	      if (block_address_function_relative)		/* For Solaris 2.0 compilers, the block addresses and		   N_SLINE's are relative to the start of the		   function.  On normal systems, and when using gcc on		   Solaris 2.0, these addresses are just absolute, or		   relative to the N_SO, depending on		   BLOCK_ADDRESS_ABSOLUTE.  */		function_start_offset = valu;	      within_function = 1;	      if (context_stack_depth > 1)		{		  complaint (&symfile_complaints,			     "unmatched N_LBRAC before symtab pos %d", symnum);		  break;		}	      if (context_stack_depth > 0)		{		  new = pop_context ();		  /* Make a block for the local symbols within.  */		  finish_block (new->name, &local_symbols, new->old_blocks,				new->start_addr, valu, objfile);		}	      new = push_context (0, valu);	      new->name = define_symbol (valu, name, desc, type, objfile);	      break;	    default:	      define_symbol (valu, name, desc, type, objfile);	      break;	    }	}      break;      /* We use N_OPT to carry the gcc2_compiled flag.  Sun uses it         for a bunch of other flags, too.  Someday we may parse their         flags; for now we ignore theirs and hope they'll ignore ours.  */    case N_OPT:		/* Solaris 2:  Compiler options */      if (name)	{	  if (strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0)	    {	      processing_gcc_compilation = 2;#if 0				/* Works, but is experimental.  -fnf */	      /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't		 know whether it will use the old style or v3 mangling.  */	      if (AUTO_DEMANGLING)		{		  set_demangling_style (GNU_DEMANGLING_STYLE_STRING);		}#endif	    }	  else	    n_opt_found = 1;	}      break;    case N_MAIN:		/* Name of main routine.  */      /* FIXME: If one has a symbol file with N_MAIN and then replaces	 it with a symbol file with "main" and without N_MAIN.  I'm	 not sure exactly what rule to follow but probably something	 like: N_MAIN takes precedence over "main" no matter what	 objfile it is in; If there is more than one N_MAIN, choose	 the one in the symfile_objfile; If there is more than one	 N_MAIN within a given objfile, complain() and choose	 arbitrarily. (kingdon) */      if (name != NULL)	set_main_name (name);      break;      /* The following symbol types can be ignored.  */    case N_OBJ:		/* Solaris 2:  Object file dir and name */    case N_PATCH:	/* Solaris2: Patch Run Time Checker.  */      /*   N_UNDF:                   Solaris 2:  file separator mark */      /*   N_UNDF: -- we will never encounter it, since we only process one         file's symbols at once.  */    case N_ENDM:		/* Solaris 2:  End of module */    case N_ALIAS:		/* SunPro F77: alias name, ignore for now.  */      break;    }  /* '#' is a GNU C extension to allow one symbol to refer to another     related symbol.     Generally this is used so that an alias can refer to its main     symbol.  */  if (name[0] == '#')    {      /* Initialize symbol reference names and determine if this is          a definition.  If symbol reference is being defined, go          ahead and add it.  Otherwise, just return sym. */      char *s = name;      int refnum;      /* If this stab defines a new reference ID that is not on the         reference list, then put it on the reference list.         We go ahead and advance NAME past the reference, even though         it is not strictly necessary at this time.  */      refnum = symbol_reference_defined (&s);      if (refnum >= 0)	if (!ref_search (refnum))	  ref_add (refnum, 0, name, valu);      name = s;    }  previous_stab_code = type;}