From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3562 invoked by alias); 20 Oct 2012 08:03:35 -0000 Received: (qmail 3549 invoked by uid 22791); 20 Oct 2012 08:03:34 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout22.012.net.il (HELO mtaout22.012.net.il) (80.179.55.172) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 20 Oct 2012 08:03:28 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MC600300LLP1D00@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Sat, 20 Oct 2012 10:02:29 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MC6002DFMC5NDC0@a-mtaout22.012.net.il>; Sat, 20 Oct 2012 10:02:29 +0200 (IST) Date: Sat, 20 Oct 2012 08:03:00 -0000 From: Eli Zaretskii Subject: Re: [RFA/commit/Windows] run program with space in path to exe. In-reply-to: <1350692925-14181-1-git-send-email-brobecker@adacore.com> To: Joel Brobecker Cc: gdb-patches@sourceware.org, brobecker@adacore.com Reply-to: Eli Zaretskii Message-id: <83happzi44.fsf@gnu.org> References: <1350692925-14181-1-git-send-email-brobecker@adacore.com> X-IsSubscribed: yes 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 X-SW-Source: 2012-10/txt/msg00367.txt.bz2 > From: Joel Brobecker > Cc: Joel Brobecker > Date: Fri, 19 Oct 2012 17:28:45 -0700 > > The following works... > > % gdb c:\path to exe\foo.exe > (gdb) start > > ... unless a file or directory called "c:\path" or "c:\path to" exists. > This is what happens in the latter case: > > (gdb) start > [...] > Error creating process C:\path to exe\foo.exe (error 193). > > This is because we are calling CreateProcess (et al) without specifying > the lpApplicationName, so Windows determines the name of the executable > using the second argument, which is the entire command line. This > command line is a space-separated list of tokens, so the space in > the path to the executable which potentially creates an ambiguity. > The ambiguity is automatically resolved unless we're in the situation > above. Does it work if you say % gdb "\"c:\path to exe\foo.exe\"" instead? > 3. Theoretically, I have a feeling that we're breaking the case > where the executable name contains a double quote in it. This is impossible, at least in the MinGW case: Windows file names cannot include the quote character. See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx But what happens if the program name is already quoted? A user can do that if she realizes the problem in advance, certainly if the program name is specified at the GDB prompt, as in 'file "c:\foo bar\my.exe"'. I think we should detect this case and not quote it again. Also, what about the arguments to the program? Don't they have the same issue when you use --args on the GDB command line?