From 59c35742fb785b1e454f45c2ace663000bf34f4c Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 9 Jul 2019 21:38:59 +0100 Subject: 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 --- gdb/doc/gdb.texinfo | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gdb/doc/gdb.texinfo') diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 7cf4141..ee06df2 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -18886,6 +18886,16 @@ If both @var{regexp} and @var{type_regexp} are provided, an argument is printed only if its name matches @var{regexp} and its type matches @var{type_regexp}. +@kindex info modules +@cindex modules +@item info modules @r{[}-q@r{]} @r{[}@var{regexp}@r{]} +List all Fortran modules in the program, or all modules matching the +optional regular expression @var{regexp}. + +The optional flag @samp{-q}, which stands for @samp{quiet}, disables +printing header information and messages explaining why no modules +have been printed. + @kindex info classes @cindex Objective-C, classes and selectors @item info classes -- cgit v1.1