#include <ctype.h>
#include "gdb_bfd.h"
#include "f-lang.h"
+#include "source.h"
#include <fcntl.h>
#include "gdb_string.h"
/* When non-zero, do not reject deprecated .gdb_index sections. */
static int use_deprecated_index_sections = 0;
-/* When set, the file that we're processing is known to have debugging
- info for C++ namespaces. GCC 3.3.x did not produce this information,
- but later versions do. */
-
-static int processing_has_namespace_info;
-
static const struct objfile_data *dwarf2_objfile_data_key;
struct dwarf2_section_info
unsigned int producer_is_gxx_lt_4_6 : 1;
unsigned int producer_is_gcc_lt_4_3 : 1;
unsigned int producer_is_icc : 1;
+
+ /* When set, the file that we're processing is known to have
+ debugging info for C++ namespaces. GCC 3.3.x did not produce
+ this information, but later versions do. */
+
+ unsigned int processing_has_namespace_info : 1;
};
/* Persistent data held for a compilation unit, even when not
static int
dw2_map_expand_apply (struct objfile *objfile,
struct dwarf2_per_cu_data *per_cu,
- const char *name,
- const char *full_path, const char *real_path,
+ const char *name, const char *real_path,
int (*callback) (struct symtab *, void *),
void *data)
{
all of them. */
dw2_instantiate_symtab (per_cu);
- return iterate_over_some_symtabs (name, full_path, real_path, callback, data,
+ return iterate_over_some_symtabs (name, real_path, callback, data,
objfile->symtabs, last_made);
}
static int
dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name,
- const char *full_path, const char *real_path,
+ const char *real_path,
int (*callback) (struct symtab *, void *),
void *data)
{
int i;
const char *name_basename = lbasename (name);
- int is_abs = IS_ABSOLUTE_PATH (name);
dw2_setup (objfile);
{
const char *this_name = file_data->file_names[j];
- if (FILENAME_CMP (name, this_name) == 0
- || (!is_abs && compare_filenames_for_search (this_name, name)))
+ if (compare_filenames_for_search (this_name, name))
{
- if (dw2_map_expand_apply (objfile, per_cu,
- name, full_path, real_path,
+ if (dw2_map_expand_apply (objfile, per_cu, name, real_path,
callback, data))
return 1;
}
&& FILENAME_CMP (lbasename (this_name), name_basename) != 0)
continue;
- if (full_path != NULL)
- {
- const char *this_real_name = dw2_get_real_path (objfile,
- file_data, j);
-
- if (this_real_name != NULL
- && (FILENAME_CMP (full_path, this_real_name) == 0
- || (!is_abs
- && compare_filenames_for_search (this_real_name,
- name))))
- {
- if (dw2_map_expand_apply (objfile, per_cu,
- name, full_path, real_path,
- callback, data))
- return 1;
- }
- }
-
if (real_path != NULL)
{
const char *this_real_name = dw2_get_real_path (objfile,
file_data, j);
+ gdb_assert (IS_ABSOLUTE_PATH (real_path));
+ gdb_assert (IS_ABSOLUTE_PATH (name));
if (this_real_name != NULL
- && (FILENAME_CMP (real_path, this_real_name) == 0
- || (!is_abs
- && compare_filenames_for_search (this_real_name,
- name))))
+ && FILENAME_CMP (real_path, this_real_name) == 0)
{
- if (dw2_map_expand_apply (objfile, per_cu,
- name, full_path, real_path,
+ if (dw2_map_expand_apply (objfile, per_cu, name, real_path,
callback, data))
return 1;
}
}
static void
-dw2_expand_symtabs_with_filename (struct objfile *objfile,
- const char *filename)
+dw2_expand_symtabs_with_fullname (struct objfile *objfile,
+ const char *fullname)
{
int i;
for (j = 0; j < file_data->num_file_names; ++j)
{
- const char *this_name = file_data->file_names[j];
- if (FILENAME_CMP (this_name, filename) == 0)
+ const char *this_fullname = file_data->file_names[j];
+
+ if (filename_cmp (this_fullname, fullname) == 0)
{
dw2_instantiate_symtab (per_cu);
break;
struct symbol *sym = lookup_block_symbol (block, name, VAR_DOMAIN);
if (sym)
- return SYMBOL_SYMTAB (sym)->filename;
+ {
+ /* Only file extension of returned filename is recognized. */
+ return SYMBOL_SYMTAB (sym)->filename;
+ }
}
return NULL;
}
per_cu = dw2_get_cu (GDB_INDEX_CU_VALUE (MAYBE_SWAP (vec[1])));
if (per_cu->v.quick->symtab != NULL)
- return per_cu->v.quick->symtab->filename;
+ {
+ /* Only file extension of returned filename is recognized. */
+ return per_cu->v.quick->symtab->filename;
+ }
init_cutu_and_read_dies (per_cu, NULL, 0, 0,
dw2_get_primary_filename_reader, &filename);
+ /* Only file extension of returned filename is recognized. */
return filename;
}
static void
dw2_expand_symtabs_matching
(struct objfile *objfile,
- int (*file_matcher) (const char *, void *),
+ int (*file_matcher) (const char *, void *, int basenames),
int (*name_matcher) (const char *, void *),
enum search_domain kind,
void *data)
for (j = 0; j < file_data->num_file_names; ++j)
{
- if (file_matcher (file_data->file_names[j], data))
+ if (file_matcher (file_data->file_names[j], data, 0))
{
per_cu->v.quick->mark = 1;
break;
dw2_relocate,
dw2_expand_symtabs_for_function,
dw2_expand_all_symtabs,
- dw2_expand_symtabs_with_filename,
+ dw2_expand_symtabs_with_fullname,
dw2_find_symbol_file,
dw2_map_matching_symbols,
dw2_expand_symtabs_matching,
{
struct partial_symtab *subpst = allocate_psymtab (name, objfile);
+ if (!IS_ABSOLUTE_PATH (subpst->filename))
+ {
+ /* It shares objfile->objfile_obstack. */
+ subpst->dirname = pst->dirname;
+ }
+
subpst->section_offsets = pst->section_offsets;
subpst->textlow = 0;
subpst->texthigh = 0;
const char *physname;
struct fn_fieldlist *fn_flp
= &TYPE_FN_FIELDLIST (mi->type, mi->fnfield_index);
- physname = dwarf2_physname ((char *) mi->name, mi->die, cu);
+ physname = dwarf2_physname (mi->name, mi->die, cu);
fn_flp->fn_fields[mi->index].physname = physname ? physname : "";
}
}
complaint (&symfile_complaints,
_("Symtab %s has objects from two different Go packages: %s and %s"),
(SYMBOL_SYMTAB (sym)
- ? SYMBOL_SYMTAB (sym)->filename
+ ? symtab_to_filename_for_display (SYMBOL_SYMTAB (sym))
: cu->objfile->name),
this_package_name, package_name);
xfree (this_package_name);
case DW_TAG_common_inclusion:
break;
case DW_TAG_namespace:
- processing_has_namespace_info = 1;
+ cu->processing_has_namespace_info = 1;
read_namespace (die, cu);
break;
case DW_TAG_module:
- processing_has_namespace_info = 1;
+ cu->processing_has_namespace_info = 1;
read_module (die, cu);
break;
case DW_TAG_imported_declaration:
case DW_TAG_imported_module:
- processing_has_namespace_info = 1;
+ cu->processing_has_namespace_info = 1;
if (die->child != NULL && (die->tag == DW_TAG_imported_declaration
|| cu->language != language_fortran))
complaint (&symfile_complaints, _("Tag '%s' has unexpected children"),
int ix;
struct dwarf2_section_info *section;
- gdb_assert (dwo_file->dbfd != objfile->obfd);
gdb_bfd_unref (dwo_file->dbfd);
VEC_free (dwarf2_section_info_def, dwo_file->sections.types);
/* For C++, set the block's scope. */
if ((cu->language == language_cplus || cu->language == language_fortran)
- && processing_has_namespace_info)
+ && cu->processing_has_namespace_info)
block_set_scope (block, determine_prefix (die, cu),
&objfile->objfile_obstack);
"physname, for referencing DIE 0x%x [in module %s]"),
die->offset.sect_off, objfile->name);
else
- SET_FIELD_PHYSNAME (call_site->target, (char *) target_physname);
+ SET_FIELD_PHYSNAME (call_site->target, target_physname);
}
else
{
{
/* The name is already allocated along with this objfile, so
we don't need to duplicate it for the type. */
- TYPE_TAG_NAME (type) = (char *) name;
+ TYPE_TAG_NAME (type) = name;
if (die->tag == DW_TAG_class_type)
TYPE_NAME (type) = TYPE_TAG_NAME (type);
}
TYPE_CODE (type) = TYPE_CODE_ENUM;
name = dwarf2_full_name (NULL, die, cu);
if (name != NULL)
- TYPE_TAG_NAME (type) = (char *) name;
+ TYPE_TAG_NAME (type) = name;
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr)
/* Create the type. */
type = init_type (TYPE_CODE_NAMESPACE, 0, 0, NULL,
objfile);
- TYPE_NAME (type) = (char *) name;
+ TYPE_NAME (type) = name;
TYPE_TAG_NAME (type) = TYPE_NAME (type);
return set_die_type (die, type, cu);
if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_METHOD)
type = lookup_methodptr_type (to_type);
+ else if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_FUNC)
+ {
+ struct type *new_type = alloc_type (cu->objfile);
+
+ smash_to_method_type (new_type, domain, TYPE_TARGET_TYPE (to_type),
+ TYPE_FIELDS (to_type), TYPE_NFIELDS (to_type),
+ TYPE_VARARGS (to_type));
+ type = lookup_methodptr_type (new_type);
+ }
else
type = lookup_memberptr_type (to_type, domain);
name = dwarf2_full_name (NULL, die, cu);
this_type = init_type (TYPE_CODE_TYPEDEF, 0,
TYPE_FLAG_TARGET_STUB, NULL, objfile);
- TYPE_NAME (this_type) = (char *) name;
+ TYPE_NAME (this_type) = name;
set_die_type (die, this_type, cu);
target_type = die_type (die, cu);
if (target_type != this_type)
/* We assume that we're processing GCC output. */
processing_gcc_compilation = 2;
- processing_has_namespace_info = 0;
+ cu->processing_has_namespace_info = 0;
}
static void
/* For the benefit of old versions of GCC, check for anonymous
namespaces based on the demangled name. */
- if (!processing_has_namespace_info
+ if (!cu->processing_has_namespace_info
&& cu->language == language_cplus)
cp_scan_for_anonymous_namespaces (sym, objfile);
}