This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[review] gdb: Add new commands to list module variables and functions
- From: "Tom Tromey (Code Review)" <gerrit at gnutoolchain-gerrit dot osci dot io>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, gdb-patches at sourceware dot org
- Date: Wed, 30 Oct 2019 10:07:17 -0400
- Subject: [review] gdb: Add new commands to list module variables and functions
- Auto-submitted: auto-generated
- References: <gerrit.1571909344000.I8c2960640e2e101b77eff54027d687e21ec22e2b@gnutoolchain-gerrit.osci.io>
- Reply-to: gnutoolchain-gerrit at osci dot io
Tom Tromey has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262
......................................................................
Patch Set 1: Code-Review+2
(4 comments)
Thanks for the patch. I had a few minor nits, plus a question.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262/1//COMMIT_MSG
Commit Message:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262/1//COMMIT_MSG@61
PS1, Line 61:
52 |
53 | (gdb) info functions mod1::.*_a.*
54 | All functions matching regular expression "mod1::.*_a":
55 |
56 | File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
57 | 25: void mod1::sub_m1_a(integer(kind=4));
58 |
59 | The benefits I see for a separate command are that the user doesn't
60 | have to think (or know) about the module prefix format, nor worry
61 | about building a proper regexp. The user can also easily can across
Maybe that 2nd "can" was supposed to be "scan"?
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262/1/gdb/doc/gdb.texinfo
File gdb/doc/gdb.texinfo:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262/1/gdb/doc/gdb.texinfo@18801
PS1, Line 18801:
18793 | The optional flag @samp{-q}, which stands for @samp{quiet}, disables
18794 | printing header information and messages explaining why no modules
18795 | have been printed.
18796 |
18797 | @kindex info module
18798 | @cindex Fortran modules, information about
18799 | @cindex functions and variables by Fortran module
18800 | @cindex module functions and variables
18801 | @item info module functions [-q] [-m @var{module-regexp}] [-t @var{type-regexp}] [@var{regexp}]
18802 | @itemx info module variables [-q] [-m @var{module-regexp}] [-t @var{type-regexp}] [@var{regexp}]
The @r{[} thing...
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262/1/gdb/symtab.h
File gdb/symtab.h:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262/1/gdb/symtab.h@2078
PS1, Line 2078:
2069 | const char *,
2070 | int,
2071 | const char **,
2072 | bool);
2073 |
2074 | /* When searching for Fortran symbols within modules (functions/variables)
2075 | we return a vector of this type. The first item in the pair is the
2076 | module symbol, and the second item is the symbol for the function or
2077 | variable we found. */
2078 | typedef std::pair<symbol_search,symbol_search> module_symbol_search;
Should be a space after the comma.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262/1/gdb/symtab.c
File gdb/symtab.c:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/262/1/gdb/symtab.c@6526
PS1, Line 6526:
6419 | info_module_subcommand (bool quiet, const char *module_regexp,
| ...
6517 |
6518 | /* Find all symbols of type KIND matching the given regular expressions
6519 | along with the symbols for the modules in which those symbols
6520 | reside. */
6521 | std::vector<module_symbol_search> module_symbols
6522 | = search_module_symbols (module_regexp, regexp, type_regexp, kind);
6523 |
6524 | const char *last_filename = "";
6525 | const symbol *last_module_symbol = nullptr;
6526 | for (const module_symbol_search &ms : module_symbols)
One thing I wondered is whether you'd want to sort
the modules here. I'm not sure it matters to me,
but I figured I'd bring it up.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I8c2960640e2e101b77eff54027d687e21ec22e2b
Gerrit-Change-Number: 262
Gerrit-PatchSet: 1
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Wed, 30 Oct 2019 14:07:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment