[review v3] gdb/mi: Add -max-results parameter to some -symbol-info-* commands

Eli Zaretskii eliz@gnu.org
Fri Nov 8 10:06:00 GMT 2019


> Date: Thu, 7 Nov 2019 19:50:32 -0500
> From: "Andrew Burgess (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
> 
> Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/269
> ......................................................................
> 
> gdb/mi: Add -max-results parameter to some -symbol-info-* commands
> 
> Adds a new parameter -max-results to -symbol-info-functions,
> -symbol-info-variables, -symbol-info-types, and -symbol-info-modules.
> This parameter limits the number of results returned.
> 
> This change still leaves -symbol-info-module-functions and
> -symbol-info-module-variables always returning all results, fixing
> these commands is slightly harder.
> 
> There's currently no mechanism for the user of these commands to know
> if the result list has been truncated if you get back the maximum
> number of results, so if there are exactly 10 functions and you call
> '-symbol-info-functions --max-results 10' the reply would appear no
> different than if you had 20 functions and called with a max of 10.
> Right now, if you get back the maximum then you should assume that
> there might be more results available.
> 
> gdb/ChangeLog:
> 
> 	* mi/mi-symbol-cmds.c (mi_symbol_info): Take extra parameter, and
> 	add it into the search spec.
> 	(mi_info_functions_or_variables): Parse -max-results flag and pass
> 	it to mi_symbol_info.
> 	(mi_cmd_symbol_info_modules): Likewise.
> 	(mi_cmd_symbol_info_types): Likewise.
> 	* symtab.c (symbol_search::compare_search_syms): Update header
> 	comment.
> 	(global_symbol_searcher::is_suitable_msymbol): New function.
> 	(global_symbol_searcher::expand_symtabs): New function.
> 	(global_symbol_searcher::add_matching_symbols): New function.
> 	(global_symbol_searcher::add_matching_msymbols): New function.
> 	(global_symbol_searcher::search_symbols): Move most of the content
> 	into the new functions above, and call them as needed.
> 	* symtab.h: Add 'set' include.
> 	(global_symbol_searcher) <max_search_results>: New member
> 	variable.
> 	(global_symbol_searcher) <expand_symtabs>: New member function.
> 	(global_symbol_searcher) <add_matching_symbols>: New member
> 	function.
> 	(global_symbol_searcher) <add_matching_msymbols>: New member
> 	function.
> 	(global_symbol_searcher) <is_suitable_msymbol>: New member
> 	function.
> 
> gdb/doc/ChangeLog:
> 
> 	* doc/gdb.texinfo (GDB/MI Symbol Query): Add documentation of
> 	-max-results to some -symbol-info-* commands.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* gdb.mi/mi-sym-info.exp: Add tests for -max-results parameter.

OK for the documentation part.

Thanks.



More information about the Gdb-patches mailing list