-/* Read AIXcoff symbol tables and convert to internal format, for GDB.
- Copyright (C) 1986-1991 Free Software Foundation, Inc.
+/* Read AIX xcoff symbol tables and convert to internal format, for GDB.
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992
+ Free Software Foundation, Inc.
Derived from coffread.c, dbxread.c, and a lot of hacking.
Contributed by IBM Corporation.
#include "defs.h"
#include "bfd.h"
-#ifdef IBM6000_HOST
-/* Native only: Need struct tbtable in <sys/debug.h>. */
+#if defined(IBM6000_HOST) && defined(IBM6000_TARGET)
+/* Native only: Need struct tbtable in <sys/debug.h> from host, and
+ need xcoff_add_toc_to_loadinfo in rs6000-tdep.c from target. */
-/* AIX COFF names have a preceeding dot `.' */
+/* AIX XCOFF names have a preceeding dot `.' */
#define NAMES_HAVE_DOT 1
#include <sys/types.h>
#include "symfile.h"
#include "objfiles.h"
#include "buildsym.h"
+#include "stabsread.h"
#include "gdb-stabs.h"
#include "coff/internal.h" /* FIXME, internal data from BFD */
#define INITIAL_STABVECTOR_LENGTH 40
-struct pending_stabs *global_stabs;
-
-
/* Nonzero if within a function (so symbols should be local,
if nothing says specifically). */
init_stringtab PARAMS ((bfd *, long, struct objfile *));
static void
-aixcoff_symfile_init PARAMS ((struct objfile *));
+xcoff_symfile_init PARAMS ((struct objfile *));
static void
-aixcoff_new_init PARAMS ((struct objfile *));
+xcoff_new_init PARAMS ((struct objfile *));
+
+struct section_offset;
static void
-aixcoff_symfile_read PARAMS ((struct objfile *, struct section_offset *, int));
+xcoff_symfile_read PARAMS ((struct objfile *, struct section_offset *, int));
static void
-aixcoff_symfile_finish PARAMS ((struct objfile *));
+xcoff_symfile_finish PARAMS ((struct objfile *));
static struct section_offsets *
-aixcoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
+xcoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
static int
init_lineno PARAMS ((bfd *, long, int));
record_include_begin (cs)
struct coff_symbol *cs;
{
- /* In aixcoff, we assume include files cannot be nested (not in .c files
+ /* In xcoff, we assume include files cannot be nested (not in .c files
of course, but in corresponding .s files.) */
if (inclDepth)
- fatal ("aix internal: pending include file exists.");
+ fatal ("xcoff internal: pending include file exists.");
++inclDepth;
InclTable *pTbl;
if (inclDepth == 0)
- fatal ("aix internal: Mismatch C_BINCL/C_EINCL pair found.");
+ fatal ("xcoff internal: Mismatch C_BINCL/C_EINCL pair found.");
pTbl = &inclTable [inclIndx];
pTbl->end = cs->c_value;
}
-/* aixcoff has static blocks marked in `.bs', `.es' pairs. They cannot be
+/* xcoff has static blocks marked in `.bs', `.es' pairs. They cannot be
nested. At any given time, a symbol can only be in one static block.
This is the base address of current static block, zero if non exists. */
N_BTSHFT = coff_data (abfd)->local_n_btshft;
local_symesz = coff_data (abfd)->local_symesz;
- last_source_file = 0;
+ last_source_file = NULL;
last_csect_name = 0;
last_csect_val = 0;
misc_func_recorded = 0;
+ start_stabs ();
start_symtab (filestring, (char *)NULL, file_start_addr);
symnum = 0;
first_object_file_end = 0;
/* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */
/* read one symbol into `cs' structure. After processing the whole symbol
table, only string table will be kept in memory, symbol table and debug
- section of aixcoff will be freed. Thus we can mark symbols with names
+ section of xcoff will be freed. Thus we can mark symbols with names
in string table as `alloced'. */
{
int ii;
if (cs->c_symnum == next_file_symnum && cs->c_sclass != C_FILE) {
if (last_source_file)
- end_symtab (cur_src_end_addr, 1, 0, objfile);
+ {
+ end_symtab (cur_src_end_addr, 1, 0, objfile);
+ end_stabs ();
+ }
+ start_stabs ();
start_symtab ("_globals_", (char *)NULL, (CORE_ADDR)0);
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, 1, 0, objfile);
+ end_stabs ();
+ start_stabs ();
start_symtab ((char *)NULL, (char *)NULL, (CORE_ADDR)0);
}
/* complete symbol table for last object file containing
debugging information. */
- /* Whether or not there was a csect in the previous file, we have
- to call `end_symtab' and `start_symtab' to reset type_vector,
+ /* Whether or not there was a csect in the previous file, we have to call
+ `end_stabs' and `start_stabs' to reset type_vector,
line_vector, etc. structures. */
complete_symtab (filestring, file_start_addr);
cur_src_end_addr = file_end_addr;
end_symtab (file_end_addr, 1, 0, objfile);
+ end_stabs ();
+ start_stabs ();
start_symtab (cs->c_name, (char *)NULL, (CORE_ADDR)0);
last_csect_name = 0;
} /* while */
if (last_source_file)
- end_symtab (cur_src_end_addr, 1, 0, objfile);
+ {
+ end_symtab (cur_src_end_addr, 1, 0, objfile);
+ end_stabs ();
+ }
free (symtbl);
current_objfile = NULL;
(a \ at the end of the text of a name)
call this function to get the continuation. */
/* So far, I haven't seen this happenning xlc output. I doubt we'll need this
- for aixcoff. */
+ for xcoff. */
#undef next_symbol_text
#define next_symbol_text() \
}
}
-#if 0 /* Seems to be unused, don't bother converting from old misc function
- vector usage to new minimal symbol tables. FIXME: Delete this? */
-
-/* if we now nothing about a function but its address, make a function symbol
- out of it with the limited knowladge you have. This will be used when
- somebody refers to a function, which doesn't exist in the symbol table,
- but is in the minimal symbol table. */
-
-struct symbol *
-build_function_symbol (ind, objfile)
- int ind;
- struct objfile *objfile;
-{
- struct symbol *sym =
- (struct symbol *) obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
- SYMBOL_NAME (sym) = misc_function_vector[ind].name;
- /* SYMBOL_VALUE (sym) = misc_function_vector[ind].address; */
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
- SYMBOL_CLASS (sym) = LOC_BLOCK;
- SYMBOL_TYPE (sym) = lookup_function_type (lookup_fundamental_type (current_objfile, FT_INTEGER));
- SYMBOL_BLOCK_VALUE (sym) = (struct block *)
- obstack_alloc (&objfile->symbol_obstack, sizeof (struct block));
- BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) = misc_function_vector[ind].address;
- return sym;
-}
-
-#endif
-
static void
-aixcoff_new_init (objfile)
+xcoff_new_init (objfile)
struct objfile *objfile;
{
}
static void
-aixcoff_symfile_init (objfile)
+xcoff_symfile_init (objfile)
struct objfile *objfile;
{
bfd *abfd = objfile->obfd;
objfile struct from the global list of known objfiles. */
static void
-aixcoff_symfile_finish (objfile)
+xcoff_symfile_finish (objfile)
struct objfile *objfile;
{
if (objfile -> sym_private != NULL)
}
-/* aixcoff version of symbol file read. */
+/* xcoff version of symbol file read. */
static void
-aixcoff_symfile_read (objfile, section_offset, mainline)
+xcoff_symfile_read (objfile, section_offset, mainline)
struct objfile *objfile;
struct section_offset *section_offset;
int mainline;
static
struct section_offsets *
-aixcoff_symfile_offsets (objfile, addr)
+xcoff_symfile_offsets (objfile, addr)
struct objfile *objfile;
CORE_ADDR addr;
{
return section_offsets;
}
-/* Register our ability to parse symbols for aixcoff BFD files. */
+/* Register our ability to parse symbols for xcoff BFD files. */
-static struct sym_fns aixcoff_sym_fns =
+static struct sym_fns xcoff_sym_fns =
{
"aixcoff-rs6000", /* sym_name: name or name prefix of BFD target type */
15, /* sym_namelen: number of significant sym_name chars */
- aixcoff_new_init, /* sym_new_init: init anything gbl to entire symtab */
- aixcoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
- aixcoff_symfile_read, /* sym_read: read a symbol file into symtab */
- aixcoff_symfile_finish, /* sym_finish: finished with file, cleanup */
- aixcoff_symfile_offsets, /* sym_offsets: xlate offsets ext->int form */
+ xcoff_new_init, /* sym_new_init: init anything gbl to entire symtab */
+ xcoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
+ xcoff_symfile_read, /* sym_read: read a symbol file into symtab */
+ xcoff_symfile_finish, /* sym_finish: finished with file, cleanup */
+ xcoff_symfile_offsets, /* sym_offsets: xlate offsets ext->int form */
NULL /* next: pointer to next struct sym_fns */
};
void
_initialize_xcoffread ()
{
- add_symtab_fns(&aixcoff_sym_fns);
+ add_symtab_fns(&xcoff_sym_fns);
}
#else /* IBM6000_HOST */
builtin_type (ignore)
char **ignore;
{
- fatal ("GDB internal eror: builtin_type called on non-RS/6000!");
+ fatal ("GDB internal error: builtin_type called on non-RS/6000!");
}
#endif /* IBM6000_HOST */