summaryrefslogtreecommitdiffstats
path: root/gdb/mipsread.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-09-19 02:32:35 +0000
committerJohn Gilmore <gnu@cygnus>1991-09-19 02:32:35 +0000
commit0c4d2cc2b3a353604c3320b867ce5d471fee1ecb (patch)
treeb4285f18987cb8dbaad3a36da33ddf59be8eed0f /gdb/mipsread.c
parent6a3871df09221eac8f64e3137ba53d3190c3d311 (diff)
downloadppe42-binutils-0c4d2cc2b3a353604c3320b867ce5d471fee1ecb.tar.gz
ppe42-binutils-0c4d2cc2b3a353604c3320b867ce5d471fee1ecb.zip
* symfile.c (allocate_symtab): New fn, consolidates the work
of allocating and initializing a new struct symtab. Set the language of the symtab based on its filename extension. * symfile.h: Declare it. * mipsread.c (new_symtab): Use it. Minor formatting changes. * dbxread.c (end_symtab): Use it. * mipsread.c (parse_symbol, case stParam and stProc): Add #if 0'd code for saving types of parameters with each function definition. * dbxread.c (define_symbol, function and parameter cases): Ditto. (read_dbx_symtab, case N_DEFD): Ignore. (read_enum_type): Recognize FALSE/TRUE enum as Modula-2 BOOLEAN type. (read_range_type): Rename MAX_OF_TYPE to MAX_OF_C_TYPE, etc. #if 0 out its uses, though, since they set a dead value. * coffread.c (end_symtab): Use allocate_symtab. (process_coff_symbol): #if 0'd for functions and params as above. (read_enum_type): Recognize Modula-2 BOOLEAN.
Diffstat (limited to 'gdb/mipsread.c')
-rw-r--r--gdb/mipsread.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index c966d19482..371c92419d 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -273,7 +273,8 @@ mipscoff_symfile_read(sf, addr, mainline)
/* Exported procedure: Allocate zeroed memory */
-char *xzalloc(size)
+char *
+xzalloc(size)
{
char *p = xmalloc(size);
@@ -841,6 +842,12 @@ data: /* Common code for symbols describing data */
SYMBOL_VALUE(s) = sh->value;
SYMBOL_TYPE(s) = parse_type(ax + sh->index, sh, 0);
add_symbol(s, top_stack->cur_block);
+#if 0
+ /* FIXME: This has not been tested. See dbxread.c */
+ /* Add the type of this parameter to the function/procedure
+ type of this block. */
+ add_param_to_type(&top_stack->cur_block->function->type,s);
+#endif
break;
case stLabel: /* label, goes into current block */
@@ -852,7 +859,7 @@ data: /* Common code for symbols describing data */
add_symbol(s, top_stack->cur_block);
break;
- case stProc: /* Procedure, goes into current block? FIXME */
+ case stProc: /* Procedure, usually goes into global block */
case stStaticProc: /* Static procedure, goes into current block */
s = new_symbol(sh->iss);
SYMBOL_NAMESPACE(s) = VAR_NAMESPACE;
@@ -862,10 +869,27 @@ data: /* Common code for symbols describing data */
t = builtin_type_int;
else
t = parse_type(ax + sh->index, sh, 0);
- add_symbol(s, top_stack->cur_block);
+ 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);
+ }
+ add_symbol(s, b);
/* Make a type for the procedure itself */
+#if 0
+ /* FIXME: This has not been tested yet! See dbxread.c */
+ /* Generate a template for the type of this function. The
+ types of the arguments will be added as we read the symbol
+ table. */
+ bcopy(SYMBOL_TYPE(s),lookup_function_type(t),sizeof(struct type));
+#else
SYMBOL_TYPE(s) = lookup_function_type (t);
+#endif
/* Create and enter a new lexical context */
b = new_block(top_stack->maxsyms);
@@ -1543,7 +1567,7 @@ parse_partial_symbols(end_of_text_seg)
*
* Only parse the Local and External symbols, and the Relative FDR.
* Fixup enough of the loader symtab to be able to use it.
- * Allocate space only for the file`s portions we need to
+ * Allocate space only for the file's portions we need to
* look at. (XXX)
*/
@@ -2337,13 +2361,10 @@ struct symtab *
new_symtab(name, maxsyms, maxlines)
char *name;
{
- struct symtab *s = (struct symtab *) xzalloc(sizeof(struct symtab));
- int i;
+ struct symtab *s = allocate_symtab (name);
LINETABLE(s) = new_linetable(maxlines);
- s->filename = name;
-
/* All symtabs must have at least two blocks */
BLOCKVECTOR(s) = new_bvect(2);
BLOCKVECTOR_BLOCK(BLOCKVECTOR(s), GLOBAL_BLOCK) = new_block(maxsyms);
@@ -2380,7 +2401,7 @@ new_psymtab(name)
pst->next = partial_symtab_list;
partial_symtab_list = pst;
- /* Keep a backpointer to the file`s symbols */
+ /* Keep a backpointer to the file's symbols */
/* FIXME, we should use private data that is a proper pointer. */
pst->ldsymlen = (int)cur_hdr;
OpenPOWER on IntegriCloud