From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30119 invoked by alias); 7 Mar 2016 19:12:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 30013 invoked by uid 89); 7 Mar 2016 19:12:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=leftover, registration X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 07 Mar 2016 19:12:07 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id BF.F3.12433.2CDCDD65; Mon, 7 Mar 2016 19:51:47 +0100 (CET) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.92) with Microsoft SMTP Server id 14.3.248.2; Mon, 7 Mar 2016 14:12:04 -0500 Subject: Re: [PATCH] Avoid spaces in osabi names To: Pedro Alves , References: <1457377364-990-1-git-send-email-palves@redhat.com> From: Simon Marchi Message-ID: <56DDD284.2080408@ericsson.com> Date: Mon, 07 Mar 2016 19:12:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1457377364-990-1-git-send-email-palves@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00118.txt.bz2 On 16-03-07 02:02 PM, Pedro Alves wrote: > 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 > 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 > > * 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 }, We nuked hp-ux some time ago. Is that some leftover?