This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Avoid spaces in osabi names


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f7990f1690e9ef0471634c871c790f6cf706866d

commit f7990f1690e9ef0471634c871c790f6cf706866d
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Mar 9 15:52:43 2016 +0000

    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.

Diff:
---
 gdb/ChangeLog |  4 ++++
 gdb/osabi.c   | 18 +++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 56bcc67..0840a51 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2016-03-09  Pedro Alves  <palves@redhat.com>
 
+	* osabi.c (gdb_osabi_names): Avoid spaces in osabi names.
+
+2016-03-09  Pedro Alves  <palves@redhat.com>
+
 	* frv-tdep.c (frv_gdbarch_init): Handle bfd_mach_fr300.
 
 2016-03-09  Pedro Alves  <palves@redhat.com>
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 },


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]