diff options
author | Tom Tromey <tromey@adacore.com> | 2023-05-31 08:26:37 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-05-31 12:00:09 -0600 |
commit | 739f67599a85d7b809c0407765f8a7304f771e63 (patch) | |
tree | bdba17bb596aa33ce3386c0d27da716df49add28 /gdb/mi | |
parent | 20fcd1747993127c648b9a3ad393a6caa3a025ba (diff) | |
download | gdb-739f67599a85d7b809c0407765f8a7304f771e63.zip gdb-739f67599a85d7b809c0407765f8a7304f771e63.tar.gz gdb-739f67599a85d7b809c0407765f8a7304f771e63.tar.bz2 |
Improve MI -dprintf-insert documentation
I found the documentation for -dprintf-insert a bit unclear. It
didn't mention the possibility of multiple arguments, and I also
noticed that it implied that the format parameter is optional, which
it is not.
While looking into this I also noticed a few comments in the
implementation that could also be improved.
Then, I noticed a repeated call to strlen in a loop condition, so I
fixed this up as well.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-break.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 082c4da..0777fcb 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -93,8 +93,8 @@ setup_breakpoint_reporting (void) } -/* Convert arguments in ARGV to the string in "format",argv,argv... - and return it. */ +/* Convert arguments in ARGV to a string suitable for parsing by + dprintf like "FORMAT",ARG,ARG... and return it. */ static std::string mi_argv_to_format (const char *const *argv, int argc) @@ -102,9 +102,9 @@ mi_argv_to_format (const char *const *argv, int argc) int i; std::string result; - /* Convert ARGV[OIND + 1] to format string and save to FORMAT. */ + /* Convert ARGV[0] to format string and save to FORMAT. */ result += '\"'; - for (i = 0; i < strlen (argv[0]); i++) + for (i = 0; argv[0][i] != '\0'; i++) { switch (argv[0][i]) { @@ -151,7 +151,7 @@ mi_argv_to_format (const char *const *argv, int argc) } result += '\"'; - /* Apply other argv to FORMAT. */ + /* Append other arguments. */ for (i = 1; i < argc; i++) { result += ','; |