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

Andrew Burgess (Code Review)
2019-12-03T21:07:55Z

Andrew Burgess has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/269
......................................................................

Patch Set 14:

(1 comment)

| --- gdb/mi/mi-symbol-cmds.c
| +++ gdb/mi/mi-symbol-cmds.c
| @@ -168,4 +170,19 @@ mi_symbol_info (enum search_domain kind, const char *name_regexp,
|
| +/* Helper to parse the option text from an -max-results argument and return
| + the parsed value. If the text can't be parsed then an error is thrown. */
| +
| +static size_t
| +parse_max_results_option (char *arg)
| +{
| + char *ptr = arg;
| + long long val = strtoll (arg, &ptr, 10);
| + if (arg == ptr || val > SIZE_MAX || val < 0)

PS13, Line 179:

I couldn't find anything. I checked the manual looking for MI
commands that might take a number or count type argument, the only
examples I could find already either used ato* or strto* functions. I
couldn't see anything obvious in utils.c or gdbsupport/*.c either -
though I'd be happy to be told I'm missed something!

Anyway, I fixed this issue you pointed out and updated the patch for
now.

| + error (_("invalid value for --max-results argument"));
| + size_t max_results = (size_t) val;
| +
| + return max_results;
| +}
| +
| /* Helper for mi_cmd_symbol_info_{functions,variables} - depending on KIND.
| Processes command line options from ARGV and ARGC. */
|

--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I90a28feb55b388fb46461a096c5db08b6b0bd427
Gerrit-Change-Number: 269
Gerrit-PatchSet: 14
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-CC: Joel Brobecker <brobecker@adacore.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Tue, 03 Dec 2019 21:07:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment