aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-07-09 21:38:59 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-10-31 23:02:59 +0000
commit59c35742fb785b1e454f45c2ace663000bf34f4c (patch)
tree572be0b410f0065fd9bf704b320e0bd7388b6a87 /gdb/dwarf2read.c
parentaed61d02fb112ac2b94f67df3ed24ed29dcf911e (diff)
downloadbinutils-59c35742fb785b1e454f45c2ace663000bf34f4c.zip
binutils-59c35742fb785b1e454f45c2ace663000bf34f4c.tar.gz
binutils-59c35742fb785b1e454f45c2ace663000bf34f4c.tar.bz2
gdb/fortran: Add new 'info modules' command
Add a new command 'info modules' that lists all of the modules GDB knows about from the debug information. A module is a debugging entity in the DWARF defined with DW_TAG_module, currently Fortran is known to use this tag for its modules. I'm not aware of any other language that currently makes use of DW_TAG_module. The output style is similar to the 'info type' output: (gdb) info modules All defined modules: File info-types.f90: 16: mod1 24: mod2 (gdb) Where the user is told the file the module is defined in and, on the left hand side, the line number at which the module is defined along with the name of the module. This patch is a new implementation of an idea originally worked on by Mark O'Connor, Chris January, David Lecomber, and Xavier Oro from ARM. gdb/ChangeLog: * dwarf2read.c (dw2_symtab_iter_next): Handle MODULE_DOMAIN. (dw2_expand_marked_cus): Handle MODULES_DOMAIN. (dw2_debug_names_iterator::next): Handle MODULE_DOMAIN and MODULES_DOMAIN. (scan_partial_symbols): Only create partial module symbols for non declarations. * psymtab.c (recursively_search_psymtabs): Handle MODULE_DOMAIN and MODULES_DOMAIN. * symtab.c (search_domain_name): Likewise. (search_symbols): Likewise. (print_symbol_info): Likewise. (symtab_symbol_info): Likewise. (info_modules_command): New function. (_initialize_symtab): Register 'info modules' command. * symtab.h (enum search_domain): Add MODULES_DOMAIN. * NEWS: Mention new 'info modules' command. gdb/doc/ChangeLog: * gdb.texinfo (Symbols): Document new 'info modules' command. gdb/testsuite/ChangeLog: * gdb.fortran/info-modules.exp: New file. * gdb.fortran/info-types.exp: Build with new file. * gdb.fortran/info-types.f90: Include and use new module. * gdb.fortran/info-types-2.f90: New file. Change-Id: I2b781dd5a06bcad04620ccdc45f01a0f711adfad
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index cac719a..0a7a033 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -4042,6 +4042,10 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER)
continue;
break;
+ case MODULE_DOMAIN:
+ if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER)
+ continue;
+ break;
default:
break;
}
@@ -5064,6 +5068,10 @@ dw2_expand_marked_cus
if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
continue;
break;
+ case MODULES_DOMAIN:
+ if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER)
+ continue;
+ break;
default:
break;
}
@@ -5970,6 +5978,15 @@ dw2_debug_names_iterator::next ()
goto again;
}
break;
+ case MODULE_DOMAIN:
+ switch (indexval.dwarf_tag)
+ {
+ case DW_TAG_module:
+ break;
+ default:
+ goto again;
+ }
+ break;
default:
break;
}
@@ -6006,6 +6023,14 @@ dw2_debug_names_iterator::next ()
goto again;
}
break;
+ case MODULES_DOMAIN:
+ switch (indexval.dwarf_tag)
+ {
+ case DW_TAG_module:
+ break;
+ default:
+ goto again;
+ }
default:
break;
}
@@ -8733,7 +8758,8 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
add_partial_namespace (pdi, lowpc, highpc, set_addrmap, cu);
break;
case DW_TAG_module:
- add_partial_module (pdi, lowpc, highpc, set_addrmap, cu);
+ if (!pdi->is_declaration)
+ add_partial_module (pdi, lowpc, highpc, set_addrmap, cu);
break;
case DW_TAG_imported_unit:
{