Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Avoid spaces in osabi names
@ 2016-03-07 19:02 Pedro Alves
  2016-03-07 19:12 ` Simon Marchi
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Pedro Alves @ 2016-03-07 19:02 UTC (permalink / raw)
  To: gdb-patches

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>
 AIX
 Cygwin
 DICOS
 DJGPP
 Darwin
 FreeBSD ELF
 FreeBSD a.out
 GNU/Hurd
 GNU/Linux
 LynxOS178
 NetBSD ELF
 NetBSD a.out
 Newlib
 OpenBSD ELF
 OpenVMS
 QNX Neutrino
 SDE
 SVR4
 Solaris
 Symbian
 Windows CE
 auto
 default
 none
 (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, do we
want that?  "No spaces" seems simpler.

I'm thinking that if we take this route, we should probably make the
enum command registration functions assert that no possible enum value
contains spaces.  I tried that, and other than the "set architecture"
command, I found no other case.  I sent a patch to binutils@ to try to
fix that one.

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

	* osabi.c (gdb_osabi_names): Avoid spaces in osabi names.
---
 gdb/osabi.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/osabi.c b/gdb/osabi.c
index e8a77ab..f7d4e74 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -64,17 +64,17 @@ static const struct osabi_names gdb_osabi_names[] =
   { "GNU/Hurd", NULL },
   { "Solaris", NULL },
   { "GNU/Linux", "linux(-gnu)?" },
-  { "FreeBSD a.out", NULL },
-  { "FreeBSD ELF", NULL },
-  { "NetBSD a.out", NULL },
-  { "NetBSD ELF", NULL },
-  { "OpenBSD ELF", NULL },
-  { "Windows CE", NULL },
+  { "FreeBSD/a.out", NULL },
+  { "FreeBSD/ELF", NULL },
+  { "NetBSD/a.out", NULL },
+  { "NetBSD/ELF", NULL },
+  { "OpenBSD/ELF", NULL },
+  { "WindowsCE", NULL },
   { "DJGPP", NULL },
   { "Irix", NULL },
-  { "HP/UX ELF", NULL },
-  { "HP/UX SOM", NULL },
-  { "QNX Neutrino", NULL },
+  { "HP-UX/ELF", NULL },
+  { "HP-UX/SOM", NULL },
+  { "QNX-Neutrino", NULL },
   { "Cygwin", NULL },
   { "AIX", NULL },
   { "DICOS", NULL },
-- 
2.5.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-12-09 16:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-07 19:02 [PATCH] Avoid spaces in osabi names Pedro Alves
2016-03-07 19:12 ` Simon Marchi
2016-03-09  1:34   ` [RFC] Remove all a.out support and gc no-longer-supported OS ABIs? (Re: [PATCH] Avoid spaces in osabi names) Pedro Alves
2016-04-19 19:26     ` John Baldwin
2016-04-20 18:50       ` Joel Brobecker
2016-04-22 13:14         ` Pedro Alves
2016-12-09 16:25           ` [pushed] " Pedro Alves
2016-03-08 20:59 ` [PATCH] Avoid spaces in osabi names Joel Brobecker
2016-03-09 15:58   ` Pedro Alves
2016-12-09 16:57 ` [PATCH] Don't allow whitespace in enum values of enum commands (Re: [PATCH] Avoid spaces in osabi names) Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox