/* Read AIX xcoff symbol tables and convert to internal format, for GDB.
- Copyright (C) 1986-2014 Free Software Foundation, Inc.
+ Copyright (C) 1986-2015 Free Software Foundation, Inc.
Derived from coffread.c, dbxread.c, and a lot of hacking.
Contributed by IBM Corporation.
#define INITIAL_STABVECTOR_LENGTH 40
-/* Nonzero if within a function (so symbols should be local,
- if nothing says specifically). */
-
-int within_function;
-
/* Size of a COFF symbol. I think it is always 18, so I'm not sure
there is any reason not to just use a #define, but might as well
ask BFD for the size and store it here, I guess. */
fool it. */
#if 0
- start_subfile (inclTable[ii].name, (char *) 0);
+ start_subfile (inclTable[ii].name);
#else
{
/* Pick a fake name that will produce the same results as this
if (fakename == NULL)
fakename = " ?";
- start_subfile (fakename, (char *) 0);
+ start_subfile (fakename);
xfree (current_subfile->name);
}
current_subfile->name = xstrdup (inclTable[ii].name);
current_subfile->line_vector_length =
current_subfile->line_vector->nitems;
- start_subfile (pop_subfile (), (char *) 0);
+ start_subfile (pop_subfile ());
}
}
/* fcn_cs_saved is global because process_xcoff_symbol needs it. */
union internal_auxent fcn_aux_saved = main_aux;
- struct context_stack *new;
+ struct context_stack *newobj;
char *filestring = " _start_ "; /* Name of the current file. */
last_csect_name = 0;
start_stabs ();
- start_symtab (filestring, (char *) NULL, file_start_addr);
+ start_symtab (objfile, filestring, (char *) NULL, file_start_addr);
record_debugformat (debugfmt);
symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum;
max_symnum =
{
if (get_last_source_file ())
{
- pst->symtab = end_symtab (cur_src_end_addr, objfile,
- SECT_OFF_TEXT (objfile));
+ pst->compunit_symtab = end_symtab (cur_src_end_addr,
+ SECT_OFF_TEXT (objfile));
end_stabs ();
}
start_stabs ();
- start_symtab ("_globals_", (char *) NULL, (CORE_ADDR) 0);
+ start_symtab (objfile, "_globals_", (char *) NULL, (CORE_ADDR) 0);
record_debugformat (debugfmt);
cur_src_end_addr = first_object_file_end;
/* Done with all files, everything from here on is globals. */
{
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- end_symtab (file_end_addr, objfile,
- SECT_OFF_TEXT (objfile));
+ end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
end_stabs ();
start_stabs ();
/* Give all csects for this source file the same
name. */
- start_symtab (filestring, NULL, (CORE_ADDR) 0);
+ start_symtab (objfile, filestring, NULL,
+ (CORE_ADDR) 0);
record_debugformat (debugfmt);
}
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
+ end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
end_stabs ();
/* XCOFF, according to the AIX 3.2 documentation, puts the
filestring = cs->c_name;
start_stabs ();
- start_symtab (filestring, (char *) NULL, (CORE_ADDR) 0);
+ start_symtab (objfile, filestring, (char *) NULL, (CORE_ADDR) 0);
record_debugformat (debugfmt);
last_csect_name = 0;
within_function = 1;
- new = push_context (0, fcn_start_addr + off);
+ newobj = push_context (0, fcn_start_addr + off);
- new->name = define_symbol
+ newobj->name = define_symbol
(fcn_cs_saved.c_value + off,
fcn_stab_saved.c_name, 0, 0, objfile);
- if (new->name != NULL)
- SYMBOL_SECTION (new->name) = SECT_OFF_TEXT (objfile);
+ if (newobj->name != NULL)
+ SYMBOL_SECTION (newobj->name) = SECT_OFF_TEXT (objfile);
}
else if (strcmp (cs->c_name, ".ef") == 0)
{
within_function = 0;
break;
}
- new = pop_context ();
+ newobj = pop_context ();
/* Stack must be empty now. */
- if (context_stack_depth > 0 || new == NULL)
+ if (context_stack_depth > 0 || newobj == NULL)
{
ef_complaint (cs->c_symnum);
within_function = 0;
break;
}
- finish_block (new->name, &local_symbols, new->old_blocks,
- new->start_addr,
+ finish_block (newobj->name, &local_symbols, newobj->old_blocks,
+ newobj->start_addr,
(fcn_cs_saved.c_value
+ fcn_aux_saved.x_sym.x_misc.x_fsize
+ ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile))),
- objfile);
+ SECT_OFF_TEXT (objfile))));
within_function = 0;
}
break;
if (strcmp (cs->c_name, ".bb") == 0)
{
depth++;
- new = push_context (depth,
+ newobj = push_context (depth,
(cs->c_value
+ ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile))));
eb_complaint (cs->c_symnum);
break;
}
- new = pop_context ();
- if (depth-- != new->depth)
+ newobj = pop_context ();
+ if (depth-- != newobj->depth)
{
eb_complaint (cs->c_symnum);
break;
if (local_symbols && context_stack_depth > 0)
{
/* Make a block for the local symbols within. */
- finish_block (new->name, &local_symbols, new->old_blocks,
- new->start_addr,
+ finish_block (newobj->name, &local_symbols, newobj->old_blocks,
+ newobj->start_addr,
(cs->c_value
+ ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile))),
- objfile);
+ SECT_OFF_TEXT (objfile))));
}
- local_symbols = new->locals;
+ local_symbols = newobj->locals;
}
break;
if (get_last_source_file ())
{
- struct symtab *s;
+ struct compunit_symtab *cust;
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
- s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
+ cust = end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
/* When reading symbols for the last C_FILE of the objfile, try
- to make sure that we set pst->symtab to the symtab for the
+ to make sure that we set pst->compunit_symtab to the symtab for the
file, not to the _globals_ symtab. I'm not sure whether this
actually works right or when/if it comes up. */
- if (pst->symtab == NULL)
- pst->symtab = s;
+ if (pst->compunit_symtab == NULL)
+ pst->compunit_symtab = cust;
end_stabs ();
}
}
if (name[0] == '.')
++name;
- initialize_symbol (sym);
+ initialize_objfile_symbol (sym);
/* default assumptions */
SYMBOL_VALUE_ADDRESS (sym) = cs->c_value + off;
struct partial_symbol **static_syms)
{
struct partial_symtab *result =
- start_psymtab_common (objfile, objfile->section_offsets,
+ start_psymtab_common (objfile,
filename,
/* We fill in textlow later. */
0,
struct partial_symtab *subpst =
allocate_psymtab (include_list[i], objfile);
- subpst->section_offsets = pst->section_offsets;
subpst->read_symtab_private = obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc));
((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
subpst->n_static_syms = 0;
subpst->readin = 0;
- subpst->symtab = 0;
+ subpst->compunit_symtab = NULL;
subpst->read_symtab = pst->read_symtab;
}
case C_DECL:
case C_STSYM:
{
- char *p;
+ const char *p;
swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol,
&ssymnum, objfile);
Accept either. */
while (*p && *p != ';' && *p != ',')
{
- char *q;
+ const char *q;
/* Check for and handle cretinous dbx symbol name
continuation! */
loader-generated definitions. Keeping the global
symbols leads to "in psymbols but not in symbols"
errors. */
- if (strncmp (namestring, "@FIX", 4) == 0)
+ if (startswith (namestring, "@FIX"))
continue;
symbol.n_value += ANOFFSET (objfile->section_offsets,