diff options
author | John Gilmore <gnu@cygnus> | 1991-09-28 01:35:29 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-09-28 01:35:29 +0000 |
commit | d8ce13268e9c7514b4b09757ad762bce9d0bfb0a (patch) | |
tree | 7156d8661603b50b662933c870fbc95050b43f60 /gdb/symfile.c | |
parent | dad0e12d57c432daeabe8f9a05848a60a5d08f91 (diff) | |
download | gdb-d8ce13268e9c7514b4b09757ad762bce9d0bfb0a.zip gdb-d8ce13268e9c7514b4b09757ad762bce9d0bfb0a.tar.gz gdb-d8ce13268e9c7514b4b09757ad762bce9d0bfb0a.tar.bz2 |
* coffread.c (coff_symfile_read): Use xmalloc, not malloc.
* language.c, printcmd.c: Lint.
* language.h (get_frame_language): Declare.
* saber.suppress: update.
* stack.c (find_relative_frame): Remove complex code that was
#if 0'd, stick with simple code. Lint.
* saber.suppress: Update a bit.
* symfile.c (add_symbol_file_command): Add "?" to question.
* utils.c (parse_escape): Avoid \a due to bdead compilers.
* value.h: Declare typedef_print.
* valprint.c (val_print, type_print_base): TYPE_CODE_RANGE less
kludgey.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 70 |
1 files changed, 59 insertions, 11 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index f6ecf29..9f1b302 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -42,6 +42,7 @@ extern int info_verbose; extern void qsort (); extern char *getenv (); +extern char *rindex (); /* Functions this file defines */ static bfd *symfile_open(); @@ -364,8 +365,6 @@ struct symtab * psymtab_to_symtab (pst) register struct partial_symtab *pst; { - register struct symtab *result; - /* If it's been looked up before, return it. */ if (pst->symtab) return pst->symtab; @@ -645,8 +644,8 @@ add_symbol_file_command (arg_string, from_tty) dont_repeat (); - if (!query ("add symbol table from file \"%s\" at text_addr = 0x%x\n", - name, text_addr)) + if (!query ("add symbol table from file \"%s\" at text_addr = %s?\n", + name, local_hex_string (text_addr))) error ("Not confirmed."); symbol_file_add (name, 0, text_addr, 0); @@ -748,6 +747,53 @@ clear_complaints () p->counter = 0; } +/* allocate_symtab: + + Allocate and partly initialize a new symbol table. Return a pointer + to it. error() if no space. + + Caller must set these fields: + LINETABLE(symtab) + symtab->blockvector + symtab->typevector + symtab->dirname + symtab->free_code + symtab->free_ptr + initialize any EXTRA_SYMTAB_INFO + possibly free_named_symtabs (symtab->filename); + symtab->next = symtab_list; + symtab_list = symtab; + */ + +struct symtab * +allocate_symtab(name) + char *name; +{ + register struct symtab *symtab; + char *c; + + symtab = (struct symtab *) xmalloc (sizeof (struct symtab)); + bzero (symtab, sizeof (*symtab)); + symtab->filename = name; + symtab->fullname = NULL; + symtab->nlines = 0; + symtab->line_charpos = 0; + symtab->version = 0; + symtab->language = language_unknown; /* default */ + + c = rindex (name, '.'); + + if (!c) { + ; /* Don't know language of file. */ + } else if(!strcmp(c,".mod")) { + symtab->language = language_m2; + } else if(!strcmp(c,".c") || !strcmp(c,".cc")) { + symtab->language = language_c; + } + + return symtab; +} + /* clear_symtab_users_once: This function is run after symbol reading, or from a cleanup. @@ -921,13 +967,15 @@ again2: free_symtab (s); } else - /* It is still possible that some breakpoints will be affected - even though no symtab was found, since the file might have - been compiled without debugging, and hence not be associated - with a symtab. In order to handle this correctly, we would need - to keep a list of text address ranges for undebuggable files. - For now, we do nothing, since this is a fairly obscure case. */ - ; + { + /* It is still possible that some breakpoints will be affected + even though no symtab was found, since the file might have + been compiled without debugging, and hence not be associated + with a symtab. In order to handle this correctly, we would need + to keep a list of text address ranges for undebuggable files. + For now, we do nothing, since this is a fairly obscure case. */ + ; + } /* FIXME, what about the misc function vector? */ return blewit; |