binutils-gdb/gdb/mi
Andrew Burgess c2512106f8 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.

One other thing to note is that the global_symbol_searcher::search by
default returns SIZE_MAX results, there's no longer a mechanism to
return an unlimited number of results, though hopefully this will not
be a huge issue.

gdb/ChangeLog:

	* mi/mi-symbol-cmds.c (mi_symbol_info): Take extra parameter, and
	add it into the search spec.
	(parse_max_results_option): New function.
	(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 (global_symbol_searcher::add_matching_symbols): Change
	return type to bool, change result container into a set, and don't
	add new results if we have enough already.
	(global_symbol_searcher::add_matching_msymbols): Change return
	type to bool, and don't add new results if we have enough already.
	(sort_search_symbols_remove_dups): Delete.
	(global_symbol_searcher::search): Early exit from search loop when
	we have enough results.  Use a std::set to collect the results
	from calling add_matching_symbols.
	* symtab.h (global_symbol_searcher) <set_max_seach_results>: New
	member function.
	(global_symbol_searcher) <m_max_search_results>: New member
	variable.
	(global_symbol_searcher) <add_matching_symbols>: Update header
	comment and change return type to bool.
	(global_symbol_searcher) <add_matching_msymbols>: Update header
	comment and change return type to bool.

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.

Change-Id: I90a28feb55b388fb46461a096c5db08b6b0bd427
2019-12-04 10:25:13 +00:00
..
ChangeLog-1999-2003
mi-cmd-break.c Rename gdb exception types 2019-04-08 09:05:40 -06:00
mi-cmd-break.h Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
mi-cmd-catch.c gdb/mi: New commands to catch C++ exceptions 2019-06-15 23:22:22 +01:00
mi-cmd-disas.c [gdb] Fix more typos in comments (2) 2019-10-26 09:55:32 +02:00
mi-cmd-env.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
mi-cmd-file.c Rename field_int to field_signed 2019-07-17 10:34:05 -06:00
mi-cmd-info.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
mi-cmd-stack.c Replace SYMBOL_*_NAME accessors with member functions 2019-11-22 12:05:14 -06:00
mi-cmd-target.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
mi-cmd-var.c Move declaration of varobjdebug to header 2019-10-10 12:37:47 -05:00
mi-cmds.c gdb/mi: Add -symbol-info-module-{variables,functions} 2019-12-04 10:24:59 +00:00
mi-cmds.h gdb/mi: Add -symbol-info-module-{variables,functions} 2019-12-04 10:24:59 +00:00
mi-common.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
mi-common.h Add debug redirect option 2019-05-17 14:21:47 +01:00
mi-console.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
mi-console.h Normalize include guards in gdb 2019-02-07 03:27:23 -07:00
mi-getopt.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
mi-getopt.h [gdb] Fix more typos in comments (2) 2019-10-26 09:55:32 +02:00
mi-interp.c Add missing includes in dwarf-index-write.c and mi/mi-interp.c 2019-11-26 14:29:19 -05:00
mi-interp.h Normalize include guards in gdb 2019-02-07 03:27:23 -07:00
mi-main.c Use strtok_r instead of strtok 2019-11-06 14:03:11 -06:00
mi-main.h Fix GDB build when using --disable-gdbmi 2019-05-10 17:22:09 -04:00
mi-out.c Introduce metadata style 2019-10-01 15:12:40 -06:00
mi-out.h Introduce metadata style 2019-10-01 15:12:40 -06:00
mi-parse.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
mi-parse.h Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
mi-symbol-cmds.c gdb/mi: Add -max-results parameter to some -symbol-info-* commands 2019-12-04 10:25:13 +00:00