From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9220 invoked by alias); 18 Aug 2012 17:07:51 -0000 Received: (qmail 9206 invoked by uid 22791); 18 Aug 2012 17:07:50 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RCVD_IN_NIX_SPAM,SPF_SOFTFAIL,TW_BJ,TW_CP 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, 18 Aug 2012 17:07:37 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M8Y00H00NE6FL00@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Sat, 18 Aug 2012 20:07:35 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M8Y00HD5NKNBN40@a-mtaout22.012.net.il>; Sat, 18 Aug 2012 20:07:35 +0300 (IDT) Date: Sat, 18 Aug 2012 17:07:00 -0000 From: Eli Zaretskii Subject: Re: GDB 7.5: Problems with the auto-load safe-path feature In-reply-to: <20120818161049.GI2798@adacore.com> To: Joel Brobecker Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <834no0gmca.fsf@gnu.org> References: <83d32ogz3g.fsf@gnu.org> <20120818161049.GI2798@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-08/txt/msg00515.txt.bz2 > Date: Sat, 18 Aug 2012 09:10:49 -0700 > From: Joel Brobecker > Cc: gdb-patches@sourceware.org > > > This new feature in GDB 7.5 looks like a nuisance in my (short) > > experience. > > Same here. Very very much agreed, in fact. But I don't feel we have > much of a leg to stand on, when opposing the feature. Jan and I > discussed this feature quite a bit, as I recall, and came to the best > compromise we could. Let's see what the users at large say about this. > For your own personal purposes, you can turn this feature off by > default when configuring GDB. I think that the configure option is: > --without-auto-load-safe-path It's easier to do that in ~/.gdbinit. > > 2012-08-18 Eli Zaretskii > > > > * auto-load.c (auto_load_objfile_script): If OBJFILE specifies a > > DOS/Windows-style .exe executable program, remove the .exe suffix > > when generating the script file name. > > I think that the test should ideally be target-dependent. But short of > that, how about we just try without the .exe prefix if the first attempt > failed, regardless of host and/or target? Like in the patch below? I can drop the #ifdef, if no one objects (it could surprise Unix users who call their programs FOO.exe for some reason). --- gdb/auto-load.c~ 2012-08-18 15:47:48.953125000 +0300 +++ gdb/auto-load.c 2012-08-18 19:44:20.859375000 +0300 @@ -708,20 +708,6 @@ auto_load_objfile_script (struct objfile @@ -735,6 +721,29 @@ auto_load_objfile_script (struct objfile fprintf_unfiltered (gdb_stdlog, _("auto-load: Attempted file \"%s\" %s.\n"), debugfile, input ? _("exists") : _("does not exist")); +#if defined (__MSDOS__) || defined (__MINGW32__) + /* For Windows/DOS .exe executables, strip the .exe suffix, so that + FOO-gdb.gdb could be used for FOO.exe, and try again. */ + if (!input) + { + const size_t lexe = sizeof (".exe") - 1; + + if (len > lexe + && strcasecmp (realname + len - lexe, ".exe") == 0) + { + len -= lexe; + realname[len] = '\0'; + filename = xrealloc (filename, len + strlen (language->suffix) + 1); + memcpy (filename, realname, len); + strcpy (filename + len, language->suffix); + input = fopen (filename, "r"); + debugfile = filename; + if (debug_auto_load) + fprintf_unfiltered (gdb_stdlog, _("auto-load: Attempted file \"%s\" %s.\n"), + debugfile, input ? _("exists") : _("does not exist")); + } + } +#endif if (!input) { VEC (char_ptr) *vec;