From patchwork Thu Jan 16 17:27:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Turney X-Patchwork-Id: 37411 Received: (qmail 78240 invoked by alias); 16 Jan 2020 17:28:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 78232 invoked by uid 89); 16 Jan 2020 17:28:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL, BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=7587, jon, Jon, Turney X-HELO: sa-prd-fep-048.btinternet.com Received: from mailomta18-sa.btinternet.com (HELO sa-prd-fep-048.btinternet.com) (213.120.69.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Jan 2020 17:28:44 +0000 Received: from sa-prd-rgout-005.btmx-prd.synchronoss.net ([10.2.38.8]) by sa-prd-fep-048.btinternet.com with ESMTP id <20200116172842.CADC8264.sa-prd-fep-048.btinternet.com@sa-prd-rgout-005.btmx-prd.synchronoss.net>; Thu, 16 Jan 2020 17:28:42 +0000 Authentication-Results: btinternet.com; auth=pass (LOGIN) smtp.auth=jonturney@btinternet.com X-OWM-Source-IP: 31.51.207.12 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean Received: from localhost.localdomain (31.51.207.12) by sa-prd-rgout-005.btmx-prd.synchronoss.net (5.8.337) (authenticated as jonturney@btinternet.com) id 5D8362CD15009A28; Thu, 16 Jan 2020 17:28:42 +0000 From: Jon Turney To: gdb-patches@sourceware.org Cc: Jon Turney Subject: [PATCH] Better handling of realpath() failure in windows_make_so() on Cygwin Date: Thu, 16 Jan 2020 17:27:56 +0000 Message-Id: <20200116172756.4988-1-jon.turney@dronecode.org.uk> MIME-Version: 1.0 It seems Cygwin's realpath() can fail on certain DLLs (apparently some AV software prevent it working on it's DLLs; See [1], [2]). Warn rather than stopping with an error if that occurs. Based on an original patch from Tim Chick. [1] https://cygwin.com/ml/cygwin/2014-08/msg00401.html [2] https://cygwin.com/ml/cygwin/2015-11/msg00353.html gdb/ChangeLog: 2016-01-20 Jon Turney * windows-nat.c (windows_make_so): Warn rather than stopping with an error if realpath() fails. --- Notes: A more complex version of this patch was previously submitted as [1], the discussion of which wandered off somewhere unproductive. [1] https://sourceware.org/ml/gdb-patches/2016-01/msg00478.html gdb/ChangeLog | 5 +++++ gdb/windows-nat.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index be5955d379..2fcafda199 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -758,7 +758,10 @@ windows_make_so (const char *name, LPVOID load_addr) free (rname); } else - error (_("dll path too long")); + { + warning (_("dll path for \"%s\" too long or inaccessible"), name); + strcpy (so->so_name, so->so_original_name); + } } /* Record cygwin1.dll .text start/end. */ p = strchr (so->so_name, '\0') - (sizeof ("/cygwin1.dll") - 1);