gdb: Allow quoting around string options in the gdb::option framework
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 11 Jul 2019 10:08:42 +0000 (11:08 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 11 Jul 2019 19:18:11 +0000 (20:18 +0100)
commit021d8588f6ca843a2aada955d00851fbb62f8a62
tree2fe3e417f14317271aa14f6916669f0aef7942a3
parentb777eb6de24ae1a1dc2f1e48d593b0a5c79937a9
gdb: Allow quoting around string options in the gdb::option framework

Currently string options must be a single string with no whitespace,
this limitation prevents the gdb::option framework being used in some
places.

After this commit, string options can be quoted in single or double
quotes, and quote characters can be escaped with a backslash if needed
to either place them within quotes, or to avoid starting a quoted
argument.

This test adds a new function extract_string_maybe_quoted which is
basically a copy of extract_arg_maybe_quoted from cli/cli-utils.c,
however, the cli-utils.c function will be deleted in the next commit.

There are tests to exercise the new quoting mechanism.

gdb/ChangeLog:

* cli/cli-option.c (parse_option): Use extract_string_maybe_quoted
to extract string arguments.
* common/common-utils.c (extract_string_maybe_quoted): New function.
* common/common-utils.h (extract_string_maybe_quoted): Declare.

gdb/testsuite/ChangeLog:

* gdb.base/options.exp (expect_string): Dequote strings in
results.
(test-string): Test strings with different quoting and reindent.
gdb/ChangeLog
gdb/cli/cli-option.c
gdb/gdbsupport/common-utils.c
gdb/gdbsupport/common-utils.h
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/options.exp
This page took 0.02732 seconds and 4 git commands to generate.