/* Read os9/os9k symbol tables and convert to internal format, for GDB.
- Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996
+ Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 96, 1998
Free Software Foundation, Inc.
This file is part of GDB.
#endif
#include "obstack.h"
-#include <sys/param.h>
-#ifndef NO_SYS_FILE
-#include <sys/file.h>
-#endif
#include "gdb_stat.h"
#include <ctype.h>
#include "symtab.h"
#endif
\f
/* Local function prototypes */
+
+static void
+read_minimal_symbols PARAMS ((struct objfile *, struct section_offsets *));
+
static void
os9k_read_ofile_symtab PARAMS ((struct partial_symtab *));
ms_type = mst_unknown; break;
}
- prim_record_minimal_symbol
- (obsavestring (name, strlen(name), &objfile->symbol_obstack),
- address, ms_type, objfile);
+ prim_record_minimal_symbol (name, address, ms_type, objfile);
}
/* read and process .stb file and store in minimal symbol table */
objfile->static_psymbols.size == 0)
init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
- pending_blocks = 0;
- back_to = make_cleanup (really_free_pendings, 0);
+ free_pending_blocks ();
+ back_to = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
- make_cleanup (discard_minimal_symbols, 0);
+ make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
read_minimal_symbols (objfile, section_offsets);
/* Now that the symbol table data of the executable file are all in core,
objfile->auxf1 = minfile;
/* Allocate struct to keep track of the symfile */
- objfile->sym_stab_info = (PTR)
+ objfile->sym_stab_info = (struct dbx_symfile_info *)
xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL;
}
case 'v':
- ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_STATIC,
- objfile->static_psymbols,
- CUR_SYMBOL_VALUE,
- psymtab_language, objfile);
+ add_psymbol_to_list (namestring, p - namestring,
+ VAR_NAMESPACE, LOC_STATIC,
+ &objfile->static_psymbols,
+ 0, CUR_SYMBOL_VALUE,
+ psymtab_language, objfile);
continue;
case 'V':
- ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_STATIC,
- objfile->global_psymbols,
- CUR_SYMBOL_VALUE,
- psymtab_language, objfile);
+ add_psymbol_to_list (namestring, p - namestring,
+ VAR_NAMESPACE, LOC_STATIC,
+ &objfile->global_psymbols,
+ 0, CUR_SYMBOL_VALUE,
+ psymtab_language, objfile);
continue;
case 'T':
if (p != namestring) /* a name is there, not just :T... */
{
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
+ add_psymbol_to_list (namestring, p - namestring,
STRUCT_NAMESPACE, LOC_TYPEDEF,
- objfile->static_psymbols,
- CUR_SYMBOL_VALUE,
+ &objfile->static_psymbols,
+ CUR_SYMBOL_VALUE, 0,
psymtab_language, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
+ add_psymbol_to_list (namestring, p - namestring,
VAR_NAMESPACE, LOC_TYPEDEF,
- objfile->static_psymbols,
- CUR_SYMBOL_VALUE, psymtab_language,
+ &objfile->static_psymbols,
+ CUR_SYMBOL_VALUE, 0, psymtab_language,
objfile);
p += 1;
}
else if (psymtab_language == language_cplus)
{
/* Also a typedef with the same name. */
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
+ add_psymbol_to_list (namestring, p - namestring,
VAR_NAMESPACE, LOC_TYPEDEF,
- objfile->static_psymbols,
- CUR_SYMBOL_VALUE, psymtab_language,
+ &objfile->static_psymbols,
+ CUR_SYMBOL_VALUE, 0, psymtab_language,
objfile);
}
}
case 't':
if (p != namestring) /* a name is there, not just :T... */
{
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
+ add_psymbol_to_list (namestring, p - namestring,
VAR_NAMESPACE, LOC_TYPEDEF,
- objfile->static_psymbols,
- CUR_SYMBOL_VALUE,
+ &objfile->static_psymbols,
+ CUR_SYMBOL_VALUE, 0,
psymtab_language, objfile);
}
check_enum:
;
/* Note that the value doesn't matter for
enum constants in psymtabs, just in symtabs. */
- ADD_PSYMBOL_TO_LIST (p, q - p,
+ add_psymbol_to_list (p, q - p,
VAR_NAMESPACE, LOC_CONST,
- objfile->static_psymbols, 0,
- psymtab_language, objfile);
+ &objfile->static_psymbols, 0,
+ 0, psymtab_language, objfile);
/* Point past the name. */
p = q;
/* Skip over the value. */
continue;
case 'c':
/* Constant, e.g. from "const" in Pascal. */
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
+ add_psymbol_to_list (namestring, p - namestring,
VAR_NAMESPACE, LOC_CONST,
- objfile->static_psymbols, CUR_SYMBOL_VALUE,
- psymtab_language, objfile);
+ &objfile->static_psymbols, CUR_SYMBOL_VALUE,
+ 0, psymtab_language, objfile);
continue;
case 'f':
if (pst && pst->textlow == 0)
pst->textlow = CUR_SYMBOL_VALUE;
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
+ add_psymbol_to_list (namestring, p - namestring,
VAR_NAMESPACE, LOC_BLOCK,
- objfile->static_psymbols, CUR_SYMBOL_VALUE,
- psymtab_language, objfile);
+ &objfile->static_psymbols, CUR_SYMBOL_VALUE,
+ 0, psymtab_language, objfile);
continue;
case 'F':
if (pst && pst->textlow == 0)
pst->textlow = CUR_SYMBOL_VALUE;
- ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
+ add_psymbol_to_list (namestring, p - namestring,
VAR_NAMESPACE, LOC_BLOCK,
- objfile->global_psymbols, CUR_SYMBOL_VALUE,
- psymtab_language, objfile);
+ &objfile->global_psymbols, CUR_SYMBOL_VALUE,
+ 0, psymtab_language, objfile);
continue;
case 'p':
CORE_ADDR capping_text;
struct partial_symtab **dependency_list;
int number_dependencies;
-/* struct partial_symbol *capping_global, *capping_static;*/
+ /* struct partial_symbol *capping_global, *capping_static; */
{
int i;
struct partial_symtab *p1;
&& pst->n_static_syms == 0) {
/* Throw away this psymtab, it's empty. We can't deallocate it, since
it is on the obstack, but we can forget to chain it on the list. */
- struct partial_symtab *prev_pst;
-
- /* First, snip it out of the psymtab chain */
-
- if (pst->objfile->psymtabs == pst)
- pst->objfile->psymtabs = pst->next;
- else
- for (prev_pst = pst->objfile->psymtabs; prev_pst; prev_pst = pst->next)
- if (prev_pst->next == pst)
- prev_pst->next = pst->next;
+ /* Indicate that psymtab was thrown away. */
- /* Next, put it on a free list for recycling */
- pst->next = pst->objfile->free_psymtabs;
- pst->objfile->free_psymtabs = pst;
+ discard_psymtab (pst);
- /* Indicate that psymtab was thrown away. */
pst = (struct partial_symtab *)NULL;
}
return pst;
/* Init stuff necessary for reading in symbols */
stabsread_init ();
buildsym_init ();
- old_chain = make_cleanup (really_free_pendings, 0);
+ old_chain = make_cleanup ((make_cleanup_func) really_free_pendings, 0);
/* Read in this file's symbols */
os9k_read_ofile_symtab (pst);
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 (if !IGNORE_SYMBOL (type)),
+ /* 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;
}
case N_SYM_SLINE:
/* This type of "symbol" really just records
one line-number -- core-address correspondence.
- Enter it in the line list for this symbol table. */
+ Enter it in the line list for this symbol table. */
/* Relocate for dynamic loading and for ELF acc fn-relative syms. */
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ /* FIXME: loses if sizeof (char *) > sizeof (int) */
record_line (current_subfile, (int)name, valu);
break;
start_stabs ();
os9k_stabs = 1;
start_symtab (n, dirn, valu);
+ record_debugformat ("OS9");
} else {
push_subfile();
start_subfile (n, dirn!=NULL ? dirn : current_subfile->dirname);
}
previous_stab_code = type;
}
-\f
-/* Parse the user's idea of an offset for dynamic linking, into our idea
- of how to represent it for fast symbol reading. */
-static struct section_offsets *
-os9k_symfile_offsets (objfile, addr)
- struct objfile *objfile;
- CORE_ADDR addr;
-{
- struct section_offsets *section_offsets;
- int i;
-
- objfile->num_sections = SECT_OFF_MAX;
- section_offsets = (struct section_offsets *)
- obstack_alloc (&objfile -> psymbol_obstack,
- sizeof (struct section_offsets)
- + sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1));
-
- for (i = 0; i < SECT_OFF_MAX; i++)
- ANOFFSET (section_offsets, i) = addr;
-
- return section_offsets;
-}
-\f
static struct sym_fns os9k_sym_fns =
{
bfd_target_os9k_flavour,
os9k_symfile_init, /* sym_init: read initial info, setup for sym_read() */
os9k_symfile_read, /* sym_read: read a symbol file into symtab */
os9k_symfile_finish, /* sym_finish: finished with file, cleanup */
- os9k_symfile_offsets, /* sym_offsets: parse user's offsets to internal form*/
+ default_symfile_offsets,
+ /* sym_offsets: parse user's offsets to internal form*/
NULL /* next: pointer to next struct sym_fns */
};