FIXME: Figure out how to get the frame pointer register number in the
execution environment of the target. Remove R_FP kludge
-FIXME: Add generation of dependencies list to partial symtab code.
+FIXME: Do we need to generate dependencies in partial symtabs?
+(Perhaps we don't need to).
FIXME: Resolve minor differences between what information we put in the
partial symbol table and what dbxread puts in. For example, we don't yet
#define LCC_PRODUCER "NCR C/C++"
#endif
-#ifndef CFRONT_PRODUCER
-#define CFRONT_PRODUCER "CFRONT " /* A wild a** guess... */
-#endif
-
-/* start-sanitize-chill */
#ifndef CHILL_PRODUCER
#define CHILL_PRODUCER "GNU Chill "
#endif
-/* end-sanitize-chill */
-
-#define STREQ(a,b) (strcmp(a,b)==0)
-#define STREQN(a,b,n) (strncmp(a,b,n)==0)
/* Flags to target_to_host() that tell whether or not the data object is
expected to be signed. Used, for example, when fetching a signed
static int offreg; /* Kludge to identify basereg references */
/* This value is added to each symbol value. FIXME: Generalize to
- the section_offsets structure used by dbxread. */
+ the section_offsets structure used by dbxread (once this is done,
+ pass the appropriate section number to end_symtab). */
static CORE_ADDR baseaddr; /* Add to each symbol value */
/* The section offsets used in the current psymtab or symtab. FIXME,
static void
psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
-static struct symtab *
+static void
read_ofile_symtab PARAMS ((struct partial_symtab *));
static void
static void
read_tag_pointer_type PARAMS ((struct dieinfo *dip));
+static void
+read_tag_string_type PARAMS ((struct dieinfo *dip));
+
static void
read_subroutine_type PARAMS ((struct dieinfo *, char *, char *));
static int
locval PARAMS ((char *));
-static void
-record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type,
- struct objfile *));
-
static void
set_cu_language PARAMS ((struct dieinfo *));
case LANG_C_PLUS_PLUS:
cu_language = language_cplus;
break;
- /* start-sanitize-chill */
case LANG_CHILL:
cu_language = language_chill;
break;
- /* end-sanitize-chill */
case LANG_MODULA2:
cu_language = language_m2;
break;
case LANG_FORTRAN77:
case LANG_FORTRAN90:
case LANG_PASCAL83:
- default:
+ /* We don't know anything special about these yet. */
cu_language = language_unknown;
break;
+ default:
+ /* If no at_language, try to deduce one from the filename */
+ cu_language = deduce_language_from_filename (dip -> at_name);
+ break;
}
cu_language_defn = language_def (cu_language);
}
current_objfile = NULL;
}
-
-/*
-
-LOCAL FUNCTION
-
- record_minimal_symbol -- add entry to gdb's minimal symbol table
-
-SYNOPSIS
-
- static void record_minimal_symbol (char *name, CORE_ADDR address,
- enum minimal_symbol_type ms_type,
- struct objfile *objfile)
-
-DESCRIPTION
-
- Given a pointer to the name of a symbol that should be added to the
- minimal symbol table, and the address associated with that
- symbol, records this information for later use in building the
- minimal symbol table.
-
- */
-
-static void
-record_minimal_symbol (name, address, ms_type, objfile)
- char *name;
- CORE_ADDR address;
- enum minimal_symbol_type ms_type;
- struct objfile *objfile;
-{
- name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
- prim_record_minimal_symbol (name, address, ms_type);
-}
-
/*
LOCAL FUNCTION
struct nextfield *new;
int nfields = 0;
int n;
- char *tpart1;
struct dieinfo mbr;
char *nextdie;
#if !BITS_BIG_ENDIAN
{
case TAG_class_type:
TYPE_CODE (type) = TYPE_CODE_CLASS;
- tpart1 = "class";
break;
case TAG_structure_type:
TYPE_CODE (type) = TYPE_CODE_STRUCT;
- tpart1 = "struct";
break;
case TAG_union_type:
TYPE_CODE (type) = TYPE_CODE_UNION;
- tpart1 = "union";
break;
default:
/* Should never happen */
TYPE_CODE (type) = TYPE_CODE_UNDEF;
- tpart1 = "???";
complain (&missing_tag, DIE_ID, DIE_NAME);
break;
}
&& *dip -> at_name != '~'
&& *dip -> at_name != '.')
{
- TYPE_NAME (type) = obconcat (&objfile -> type_obstack,
- tpart1, " ", dip -> at_name);
+ TYPE_TAG_NAME (type) = obconcat (&objfile -> type_obstack,
+ "", "", dip -> at_name);
}
/* Use whatever size is known. Zero is a valid size. We might however
wish to check has_at_byte_size to make sure that some byte size was
/*
+LOCAL FUNCTION
+
+ read_tag_string_type -- read TAG_string_type DIE
+
+SYNOPSIS
+
+ static void read_tag_string_type (struct dieinfo *dip)
+
+DESCRIPTION
+
+ Extract all information from a TAG_string_type DIE and add to
+ the user defined type vector. It isn't really a user defined
+ type, but it behaves like one, with other DIE's using an
+ AT_user_def_type attribute to reference it.
+ */
+
+static void
+read_tag_string_type (dip)
+ struct dieinfo *dip;
+{
+ struct type *utype;
+ struct type *indextype;
+ struct type *rangetype;
+ unsigned long lowbound = 0;
+ unsigned long highbound;
+
+ if (dip -> has_at_byte_size)
+ {
+ /* A fixed bounds string */
+ highbound = dip -> at_byte_size - 1;
+ }
+ else
+ {
+ /* A varying length string. Stub for now. (FIXME) */
+ highbound = 1;
+ }
+ indextype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
+ rangetype = create_range_type ((struct type *) NULL, indextype, lowbound,
+ highbound);
+
+ utype = lookup_utype (dip -> die_ref);
+ if (utype == NULL)
+ {
+ /* No type defined, go ahead and create a blank one to use. */
+ utype = alloc_utype (dip -> die_ref, (struct type *) NULL);
+ }
+ else
+ {
+ /* Already a type in our slot due to a forward reference. Make sure it
+ is a blank one. If not, complain and leave it alone. */
+ if (TYPE_CODE (utype) != TYPE_CODE_UNDEF)
+ {
+ complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
+ return;
+ }
+ }
+
+ /* Create the string type using the blank type we either found or created. */
+ utype = create_string_type (utype, rangetype);
+}
+
+/*
+
LOCAL FUNCTION
read_subroutine_type -- process TAG_subroutine_type dies
&& *dip -> at_name != '~'
&& *dip -> at_name != '.')
{
- TYPE_NAME (type) = obconcat (&objfile -> type_obstack, "enum",
- " ", dip -> at_name);
+ TYPE_TAG_NAME (type) = obconcat (&objfile -> type_obstack,
+ "", "", dip -> at_name);
}
if (dip -> at_byte_size != 0)
{
memset (sym, 0, sizeof (struct symbol));
SYMBOL_NAME (sym) = create_name (list -> field.name,
&objfile->symbol_obstack);
+ SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = type;
processing_gcc_compilation =
STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER))
- /* start-sanitize-chill */
|| STREQN (producer, CHILL_PRODUCER, strlen (CHILL_PRODUCER))
- /* end-sanitize-chill */
|| STREQN (producer, GCC_PRODUCER, strlen (GCC_PRODUCER));
/* Select a demangling style if we can identify the producer and if
is not auto. We also leave the demangling style alone if we find a
gcc (cc1) producer, as opposed to a g++ (cc1plus) producer. */
-#if 1 /* Works, but is experimental. -fnf */
if (AUTO_DEMANGLING)
{
if (STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)))
{
set_demangling_style (LUCID_DEMANGLING_STYLE_STRING);
}
- else if (STREQN (producer, CFRONT_PRODUCER, strlen (CFRONT_PRODUCER)))
- {
- set_demangling_style (CFRONT_DEMANGLING_STYLE_STRING);
- }
}
-#endif
}
start_symtab (dip -> at_name, dip -> at_comp_dir, dip -> at_low_pc);
decode_line_numbers (lnbase);
process_dies (thisdie + dip -> die_length, enddie, objfile);
- symtab = end_symtab (dip -> at_high_pc, 0, 0, objfile);
+
+ symtab = end_symtab (dip -> at_high_pc, 0, 0, objfile, 0);
if (symtab != NULL)
{
symtab -> language = cu_language;
case TAG_pointer_type:
read_tag_pointer_type (&di);
break;
+ case TAG_string_type:
+ read_tag_string_type (&di);
+ break;
default:
new_symbol (&di, objfile);
break;
SYNOPSIS
- static struct symtab *read_ofile_symtab (struct partial_symtab *pst)
+ static void read_ofile_symtab (struct partial_symtab *pst)
DESCRIPTION
When expanding a partial symbol table entry to a full symbol table
entry, this is the function that gets called to read in the symbols
- for the compilation unit.
-
- Returns a pointer to the newly constructed symtab (which is now
- the new first one on the objfile's symtab list).
+ for the compilation unit. A pointer to the newly constructed symtab,
+ which is now the new first one on the objfile's symtab list, is
+ stashed in the partial symbol table entry.
*/
-static struct symtab *
+static void
read_ofile_symtab (pst)
struct partial_symtab *pst;
{
process_dies (dbbase, dbbase + dbsize, pst -> objfile);
do_cleanups (back_to);
current_objfile = NULL;
- return (pst -> objfile -> symtabs);
+ pst -> symtab = pst -> objfile -> symtabs;
}
/*
{
buildsym_init ();
old_chain = make_cleanup (really_free_pendings, 0);
- pst -> symtab = read_ofile_symtab (pst);
+ read_ofile_symtab (pst);
if (info_verbose)
{
printf_filtered ("%d DIE's, sorting...", diecount);
{
scan += TARGET_FT_LONG_SIZE (objfile);
ADD_PSYMBOL_TO_LIST (scan, strlen (scan), VAR_NAMESPACE, LOC_CONST,
- objfile -> static_psymbols, 0);
+ objfile -> static_psymbols, 0, cu_language,
+ objfile);
scan += strlen (scan) + 1;
}
}
switch (dip -> die_tag)
{
case TAG_global_subroutine:
- record_minimal_symbol (dip -> at_name, dip -> at_low_pc, mst_text,
- objfile);
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
VAR_NAMESPACE, LOC_BLOCK,
objfile -> global_psymbols,
- dip -> at_low_pc);
+ dip -> at_low_pc, cu_language, objfile);
break;
case TAG_global_variable:
- record_minimal_symbol (dip -> at_name, locval (dip -> at_location),
- mst_data, objfile);
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
VAR_NAMESPACE, LOC_STATIC,
objfile -> global_psymbols,
- 0);
+ 0, cu_language, objfile);
break;
case TAG_subroutine:
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
VAR_NAMESPACE, LOC_BLOCK,
objfile -> static_psymbols,
- dip -> at_low_pc);
+ dip -> at_low_pc, cu_language, objfile);
break;
case TAG_local_variable:
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
VAR_NAMESPACE, LOC_STATIC,
objfile -> static_psymbols,
- 0);
+ 0, cu_language, objfile);
break;
case TAG_typedef:
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
VAR_NAMESPACE, LOC_TYPEDEF,
objfile -> static_psymbols,
- 0);
+ 0, cu_language, objfile);
break;
case TAG_class_type:
case TAG_structure_type:
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
STRUCT_NAMESPACE, LOC_TYPEDEF,
objfile -> static_psymbols,
- 0);
+ 0, cu_language, objfile);
if (cu_language == language_cplus)
{
/* For C++, these implicitly act as typedefs as well. */
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
VAR_NAMESPACE, LOC_TYPEDEF,
objfile -> static_psymbols,
- 0);
+ 0, cu_language, objfile);
}
break;
}
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_TYPE (sym) = decode_die_type (dip);
+
+ /* If this symbol is from a C++ compilation, then attempt to cache the
+ demangled form for future reference. This is a typical time versus
+ space tradeoff, that was decided in favor of time because it sped up
+ C++ symbol lookups by a factor of about 20. */
+
+ SYMBOL_LANGUAGE (sym) = cu_language;
+ SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile -> symbol_obstack);
switch (dip -> die_tag)
{
case TAG_label:
memset (sym, 0, sizeof (struct symbol));
SYMBOL_NAME (sym) = create_name (dip -> at_name,
&objfile->symbol_obstack);
+ SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
SYMBOL_TYPE (sym) = type;
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;