#include "symfile.h"
#include "objfiles.h"
#include "buildsym.h"
+#include "stabsread.h"
#include "gdb-stabs.h"
+#include "demangle.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h" /* We always use GNU stabs, not native, now */
dbx_new_init (ignore)
struct objfile *ignore;
{
+ stabsread_new_init ();
buildsym_new_init ();
init_header_files ();
}
#endif
/* FIXME POKING INSIDE BFD DATA STRUCTURES */
+ DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL;
DBX_TEXT_SECT (objfile) = bfd_get_section_by_name (sym_bfd, ".text");
if (!DBX_TEXT_SECT (objfile))
error ("Can't find .text section in symbol file");
init_bincl_list (20, objfile);
make_cleanup (free_bincl_list, objfile);
- last_source_file = 0;
+ last_source_file = NULL;
#ifdef END_OF_TEXT_DEFAULT
end_of_text_addr = END_OF_TEXT_DEFAULT;
if (LDSYMLEN(pst)) /* Otherwise it's a dummy */
{
/* Init stuff necessary for reading in symbols */
+ stabsread_init ();
buildsym_init ();
old_chain = make_cleanup (really_free_pendings, 0);
file_string_table_offset = FILE_STRING_OFFSET (pst);
unsigned char type;
unsigned max_symnum;
register bfd *abfd;
+ struct symtab *rtn;
current_objfile = objfile;
- subfile_stack = 0;
+ subfile_stack = NULL;
#ifdef hp9000s800
stringtab_global = HP_STRINGTAB (objfile);
#else
stringtab_global = DBX_STRINGTAB (objfile);
#endif
- last_source_file = 0;
+ last_source_file = NULL;
abfd = objfile->obfd;
symfile_bfd = objfile->obfd; /* Implicit param to next_text_symbol */
(bufp->n_type == N_TEXT
&& (strcmp (namestring, GCC_COMPILED_FLAG_SYMBOL) == 0
|| strcmp(namestring, GCC2_COMPILED_FLAG_SYMBOL) == 0));
+
+ /* Try to select a C++ demangling based on the compilation unit
+ producer. */
+
+ if (processing_gcc_compilation)
+ {
+#if 1 /* Works, but is experimental. -fnf */
+ if (current_demangling_style == auto_demangling)
+ {
+ set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
+ }
+#endif
+ }
}
else
{
else if (type == N_TEXT
&& (strcmp (namestring, GCC_COMPILED_FLAG_SYMBOL) == 0
|| strcmp (namestring, GCC2_COMPILED_FLAG_SYMBOL) == 0))
- /* I don't think this code will ever be executed, because
- the GCC_COMPILED_FLAG_SYMBOL usually is right before
- the N_SO symbol which starts this source file.
- However, there is no reason not to accept
- the GCC_COMPILED_FLAG_SYMBOL anywhere. */
- processing_gcc_compilation = 1;
+ {
+ /* I don't think this code will ever be executed, because
+ the GCC_COMPILED_FLAG_SYMBOL usually is right before
+ the N_SO symbol which starts this source file.
+ However, there is no reason not to accept
+ the GCC_COMPILED_FLAG_SYMBOL anywhere. */
+ processing_gcc_compilation = 1;
+#if 1 /* Works, but is experimental. -fnf */
+ if (current_demangling_style == auto_demangling)
+ {
+ set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
+ }
+#endif
+ }
else if (type & N_EXT || type == (unsigned char)N_TEXT
|| type == (unsigned char)N_NBTEXT
) {
if (last_source_start_addr == 0)
last_source_start_addr = text_offset;
- return end_symtab (text_offset + text_size, 0, 0, objfile);
+ rtn = end_symtab (text_offset + text_size, 0, 0, objfile);
+ end_stabs ();
+ return (rtn);
}
\f
/* This handles a single symbol from the symbol-file, building symbols
/* Something is wrong if we see real data before
seeing a source file name. */
- if (last_source_file == 0 && type != (unsigned char)N_SO)
+ if (last_source_file == NULL && type != (unsigned char)N_SO)
{
/* Currently this ignores N_ENTRY on Gould machines, N_NSYM on machines
where that code is defined. */
Patch things up. */
if (previous_stab_code == N_SO)
{
- if (current_subfile && current_subfile->dirname == NULL
- && current_subfile->name != NULL
- && current_subfile->name[strlen(current_subfile->name)-1] == '/')
- {
- current_subfile->dirname = current_subfile->name;
- current_subfile->name =
- obsavestring (name, strlen (name),
- &objfile -> symbol_obstack);
- }
+ patch_subfile_names (current_subfile, name);
break; /* Ignore repeated SOs */
}
end_symtab (valu, 0, 0, objfile);
+ end_stabs ();
}
+ start_stabs ();
start_symtab (name, NULL, valu);
break;
(whose name was given in the N_SO symbol.) */
/* Relocate for dynamic loading */
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
- start_subfile (name, NULL);
+ start_subfile (name, current_subfile->dirname);
break;
case N_BINCL:
push_subfile ();
add_new_header_file (name, valu);
- start_subfile (name, NULL);
+ start_subfile (name, current_subfile->dirname);
break;
case N_EINCL:
- start_subfile (pop_subfile (), NULL);
+ start_subfile (pop_subfile (), current_subfile->dirname);
break;
case N_EXCL:
define_symbol (valu, name, desc, type, objfile);
break;
+ /* We use N_OPT to carry the gcc2_compiled flag. Sun uses it
+ for a bunch of other flags, too. Someday we may parse their
+ flags; for now we ignore theirs and hope they'll ignore ours. */
+ case N_OPT: /* Solaris 2: Compiler options */
+ if (name)
+ {
+ if (!strcmp (name, GCC2_COMPILED_FLAG_SYMBOL))
+ {
+ processing_gcc_compilation = 1;
+#if 1 /* Works, but is experimental. -fnf */
+ if (current_demangling_style == auto_demangling)
+ {
+ set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
+ }
+#endif
+ }
+ }
+ break;
+
/* The following symbol types can be ignored. */
case N_OBJ: /* Solaris 2: Object file dir and name */
- case N_OPT: /* Solaris 2: Optimization level? */
/* N_UNDF: Solaris 2: file separator mark */
/* N_UNDF: -- we will never encounter it, since we only process one
file's symbols at once. */
if (val != stabstrsize)
perror_with_name (name);
+ stabsread_new_init ();
buildsym_new_init ();
free_header_files ();
init_header_files ();