diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-06-29 22:05:16 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-06-29 22:05:16 +0000 |
commit | 32019081a7af77c58fc3b4dbbf43a77e6f1a7c86 (patch) | |
tree | 9de855a84068a36b94476a2b5338e8559b6e6040 /gdb/dwarf2read.c | |
parent | 70c622a3d28b08cb57b8c8569658aa767241e161 (diff) | |
download | gdb-32019081a7af77c58fc3b4dbbf43a77e6f1a7c86.zip gdb-32019081a7af77c58fc3b4dbbf43a77e6f1a7c86.tar.gz gdb-32019081a7af77c58fc3b4dbbf43a77e6f1a7c86.tar.bz2 |
gdb/
Fix non-only rename list for Fortran modules import.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Adjust the
cp_add_using_directive caller.
(cp_add_using_directive): New parameter excludes, describe it. New
variables ix and param. Compare if also excludes match. Allocate NEW
with variable size, initialize EXCLUDES there.
(cp_lookup_symbol_imports): New variable excludep, test
current->EXCLUDES with it.
* cp-support.h: Include vec.h.
(struct using_direct): New field excludes, describe it.
(DEF_VEC_P (const_char_ptr)): New.
(cp_add_using_directive): New parameter excludes.
* defs.h (const_char_ptr): New typedef.
* dwarf2read.c (read_import_statement): New variables child_die,
excludes and cleanups, read in excludes.
(read_namespace): Adjust the cp_add_using_directive caller.
gdb/testsuite/
Fix non-only rename list for Fortran modules import.
* gdb.fortran/module.exp (print var_x, print var_y, print var_z): New
tests.
* gdb.fortran/module.f90 (module moduse): New.
(program module): use moduse, test var_x, var_y and var_z.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index bc958bb..ce43284 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -5178,7 +5178,7 @@ static void read_import_statement (struct die_info *die, struct dwarf2_cu *cu) { struct attribute *import_attr; - struct die_info *imported_die; + struct die_info *imported_die, *child_die; struct dwarf2_cu *imported_cu; const char *imported_name; const char *imported_name_prefix; @@ -5186,6 +5186,8 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) const char *import_alias; const char *imported_declaration = NULL; const char *import_prefix; + VEC (const_char_ptr) *excludes = NULL; + struct cleanup *cleanups; char *temp; @@ -5265,11 +5267,60 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) else canonical_name = imported_name; + cleanups = make_cleanup (VEC_cleanup (const_char_ptr), &excludes); + + if (die->tag == DW_TAG_imported_module && cu->language == language_fortran) + for (child_die = die->child; child_die && child_die->tag; + child_die = sibling_die (child_die)) + { + /* DWARF-4: A Fortran use statement with a “rename list” may be + represented by an imported module entry with an import attribute + referring to the module and owned entries corresponding to those + entities that are renamed as part of being imported. */ + + if (child_die->tag != DW_TAG_imported_declaration) + { + complaint (&symfile_complaints, + _("child DW_TAG_imported_declaration expected " + "- DIE at 0x%x [in module %s]"), + child_die->offset, cu->objfile->name); + continue; + } + + import_attr = dwarf2_attr (child_die, DW_AT_import, cu); + if (import_attr == NULL) + { + complaint (&symfile_complaints, _("Tag '%s' has no DW_AT_import"), + dwarf_tag_name (child_die->tag)); + continue; + } + + imported_cu = cu; + imported_die = follow_die_ref_or_sig (child_die, import_attr, + &imported_cu); + imported_name = dwarf2_name (imported_die, imported_cu); + if (imported_name == NULL) + { + complaint (&symfile_complaints, + _("child DW_TAG_imported_declaration has unknown " + "imported name - DIE at 0x%x [in module %s]"), + child_die->offset, cu->objfile->name); + continue; + } + + VEC_safe_push (const_char_ptr, excludes, imported_name); + + process_die (child_die, cu); + } + cp_add_using_directive (import_prefix, canonical_name, import_alias, imported_declaration, + excludes, &cu->objfile->objfile_obstack); + + do_cleanups (cleanups); } static void @@ -7797,7 +7848,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) const char *previous_prefix = determine_prefix (die, cu); cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, - NULL, &objfile->objfile_obstack); + NULL, NULL, &objfile->objfile_obstack); } } |