aboutsummaryrefslogtreecommitdiff
path: root/gdb/buildsym.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r--gdb/buildsym.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 73ca9b2..1e56954 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -257,7 +257,8 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile)
{
if (symbol)
{
- complain (&innerblock_complaint, SYMBOL_NAME (symbol));
+ complain (&innerblock_complaint,
+ SYMBOL_SOURCE_NAME (symbol));
}
else
{
@@ -371,7 +372,7 @@ start_subfile (name, dirname)
for (subfile = subfiles; subfile; subfile = subfile->next)
{
- if (!strcmp (subfile->name, name))
+ if (STREQ (subfile->name, name))
{
current_subfile = subfile;
return;
@@ -393,6 +394,24 @@ start_subfile (name, dirname)
/* Initialize line-number recording for this subfile. */
subfile->line_vector = NULL;
+
+ /* Default the source language to whatever can be deduced from
+ the filename. If nothing can be deduced (such as for a C/C++
+ include file with a ".h" extension), then inherit whatever
+ language the previous subfile had. This kludgery is necessary
+ because there is no standard way in some object formats to
+ record the source language. Also, when symtabs are allocated
+ we try to deduce a language then as well, but it is too late
+ for us to use that information while reading symbols, since
+ symtabs aren't allocated until after all the symbols have
+ been processed for a given source file. */
+
+ subfile->language = deduce_language_from_filename (subfile->name);
+ if (subfile->language == language_unknown &&
+ subfile->next != NULL)
+ {
+ subfile->language = subfile->next->language;
+ }
}
/* For stabs readers, the first N_SO symbol is assumed to be the source
@@ -417,6 +436,24 @@ patch_subfile_names (subfile, name)
{
subfile->dirname = subfile->name;
subfile->name = strdup (name);
+
+ /* Default the source language to whatever can be deduced from
+ the filename. If nothing can be deduced (such as for a C/C++
+ include file with a ".h" extension), then inherit whatever
+ language the previous subfile had. This kludgery is necessary
+ because there is no standard way in some object formats to
+ record the source language. Also, when symtabs are allocated
+ we try to deduce a language then as well, but it is too late
+ for us to use that information while reading symbols, since
+ symtabs aren't allocated until after all the symbols have
+ been processed for a given source file. */
+
+ subfile->language = deduce_language_from_filename (subfile->name);
+ if (subfile->language == language_unknown &&
+ subfile->next != NULL)
+ {
+ subfile->language = subfile->next->language;
+ }
}
}
@@ -709,6 +746,13 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile)
symtab->free_code = free_linetable;
symtab->free_ptr = NULL;
+ /* Use whatever language we have been using for this subfile,
+ not the one that was deduced in allocate_symtab from the
+ filename. We already did our own deducing when we created
+ the subfile, and we may have altered our opinion of what
+ language it is from things we found in the symbols. */
+ symtab->language = subfile->language;
+
#ifdef IBM6000_TARGET
/* In case we need to duplicate symbol tables (to represent include
files), and in case our system needs relocation, we want to