From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6290 invoked by alias); 12 Jan 2012 23:18:16 -0000 Received: (qmail 6281 invoked by uid 22791); 12 Jan 2012 23:18:15 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-qw0-f41.google.com (HELO mail-qw0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jan 2012 23:17:56 +0000 Received: by qats34 with SMTP id s34so474962qat.0 for ; Thu, 12 Jan 2012 15:17:55 -0800 (PST) Received: by 10.224.17.143 with SMTP id s15mr71730qaa.64.1326410275397; Thu, 12 Jan 2012 15:17:55 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.17.143 with SMTP id s15mr71719qaa.64.1326410275306; Thu, 12 Jan 2012 15:17:55 -0800 (PST) Received: by 10.224.195.72 with HTTP; Thu, 12 Jan 2012 15:17:55 -0800 (PST) In-Reply-To: References: <20120112030648.14DBE190AFD@elbrus2.mtv.corp.google.com> <20120112212959.GA24491@host2.jankratochvil.net> Date: Thu, 12 Jan 2012 23:25:00 -0000 Message-ID: Subject: Re: [patch] Fix for PR gdb/9538 (loading of separate debuginfo and symlinks). From: Doug Evans To: Paul Pluzhnikov Cc: Jan Kratochvil , gdb-patches@sourceware.org X-System-Of-Record: true Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-01/txt/msg00448.txt.bz2 On Thu, Jan 12, 2012 at 2:26 PM, Paul Pluzhnikov w= rote: >>> + >>> + =A0debugfile =3D find_separate_debug_file (dir1, canon_dir, debuglink, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 crc32, objfile); >>> + =A0xfree (canon_dir); >>> + >>> + =A0if (debugfile !=3D NULL) >>> + =A0 =A0goto cleanup1; >>> + >>> + =A0/* For PR gdb/9538, try again with realpath (if different from the >>> + =A0 =A0 original). =A0*/ >>> + =A0dir2 =3D lrealpath (objfile->name); >> >> Maybe some optimization would be helpful. =A0realpath is expensive and t= he >> directory path is already canonicalized. =A0Something like lstat (objfil= e->name) >> and do this step only if it is a symlink. > > Wouldn't lstat need a configury #ifdef to make it build? [for reference sake, one patch in my basenames-may-differ series (not submitted) had a use for lstat. IWBN to have lstat in gdb so we could (appropriately of course) use it. OOC, Jan, what discussion led rise to having braces here: + if (strcmp (dir1, dir2) =3D=3D 0) + { + /* Same directory, no point retrying. */ + goto cleanup; + } and does that reasoning apply here: + if (debuglink =3D=3D NULL) + /* There's no separate debug info, hence there's no way we could + load it =3D> no warning. */ + return NULL;