binutils-gdb/gdb/gdbsupport
Andrew Burgess 021d8588f6 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.
2019-07-11 20:18:11 +01:00
..
agent.c
agent.h
array-view.h
ax.def
break-common.h
btrace-common.c
btrace-common.h
buffer.c
buffer.h
byte-vector.h
cleanups.c
cleanups.h
common-debug.c
common-debug.h
common-defs.h
common-exceptions.c
common-exceptions.h
common-gdbthread.h
common-inferior.h
common-regcache.c
common-regcache.h
common-types.h
common-utils.c
common-utils.h
common.host
common.m4
create-version.sh
def-vector.h
default-init-alloc.h
enum-flags.h
environ.c
environ.h
errors.c
errors.h
fileio.c
fileio.h
filestuff.c
filestuff.h
filtered-iterator.h
format.c
format.h
forward-scope-exit.h
function-view.h
gdb_assert.h
gdb_locale.h
gdb_optional.h
gdb_proc_service.h
gdb_ref_ptr.h
gdb_setjmp.h
gdb_signals.h
gdb_splay_tree.h
gdb_string_view.h
gdb_string_view.tcc
gdb_sys_time.h
gdb_tilde_expand.c
gdb_tilde_expand.h
gdb_unique_ptr.h
gdb_unlinker.h
gdb_vecs.c
gdb_vecs.h
gdb_wait.h
hash_enum.h
host-defs.h
job-control.c
job-control.h
mingw-strerror.c
netstuff.c
netstuff.h
new-op.c
next-iterator.h
observable.h
offset-type.h
pathstuff.c
pathstuff.h
poison.h
posix-strerror.c
preprocessor.h
print-utils.c
print-utils.h
ptid.c
ptid.h
refcounted-object.h
rsp-low.c
rsp-low.h
run-time-clock.c
run-time-clock.h
safe-iterator.h
scope-exit.h
scoped_fd.h
scoped_mmap.c
scoped_mmap.h
scoped_restore.h
selftest.c
selftest.h
signals-state-save-restore.c
signals-state-save-restore.h
signals.c
symbol.h
tdesc.c
tdesc.h
traits.h
underlying.h
valid-expr.h
vec.c
vec.h
version.h
x86-xstate.h
xml-utils.c
xml-utils.h