Avoid spaces in osabi names
authorPedro Alves <palves@redhat.com>
Wed, 9 Mar 2016 15:52:43 +0000 (15:52 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 9 Mar 2016 15:52:43 +0000 (15:52 +0000)
commitf7990f1690e9ef0471634c871c790f6cf706866d
tree1a87e1d4d15304e1d423ec76205f131635763609
parent087ccc6a4f8c754a4f4d31810839a631dbeabe0d
Avoid spaces in osabi names

It's not possible today to select some of the osabis by name.
Specifically, those that have spaces in their names and then the first
word is ambiguous...

For example:
 (gdb) set osabi <TAB>
 [...]
 FreeBSD ELF
 FreeBSD a.out
 [...]
 (gdb) set osabi FreeBSD ELF
 Ambiguous item "FreeBSD ELF".

In reality, because "set osabi" is an enum command, that was
equivalent to trying "set osabi FreeBSD", which is then obviously
ambiguous, because of "FreeBSD ELF" and "FreeBSD a.out".

Also, even if the first word is not ambiguous, we actually ignore
whatever comes after the first word:

 (gdb) set osabi GNU/Linux
 (gdb) show osabi
 The current OS ABI is "GNU/Linux".
 The default OS ABI is "GNU/Linux".
 (gdb) set osabi Windows SomeNonsense
                         ^^^^^^^^^^^^
 (gdb) show osabi
 The current OS ABI is "Windows CE".
 The default OS ABI is "GNU/Linux".
 (gdb)

Fix this by avoiding spaces in osabi names.

We could instead make "set osabi" have a custom set hook, or
alternatively make the enum set hook (in cli-setshow.c) handle values
with spaces, but OTOH, I have a feeling that could cause trouble.
E.g., in cases where we might want to write more than one enum value
in the same line.  We could support quoting as workaround, but, not
sure we want that.  "No spaces" seems like a simpler rule.

gdb/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

* osabi.c (gdb_osabi_names): Avoid spaces in osabi names.
gdb/ChangeLog
gdb/osabi.c
This page took 0.023918 seconds and 4 git commands to generate.