From patchwork Tue Oct 15 15:18:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 34986 Received: (qmail 49639 invoked by alias); 15 Oct 2019 15:18:28 -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 49630 invoked by uid 89); 15 Oct 2019 15:18:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=fullname, uploaded X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Oct 2019 15:18:26 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 2C497208F2; Tue, 15 Oct 2019 11:18:25 -0400 (EDT) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 21DBD208F0 for ; Tue, 15 Oct 2019 11:18:24 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id F29BC29ECF for ; Tue, 15 Oct 2019 11:18:23 -0400 (EDT) X-Gerrit-PatchSet: 1 Date: Tue, 15 Oct 2019 11:18:23 -0400 From: "Tom de Vries (Code Review)" To: gdb-patches@sourceware.org Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: Change in binutils-gdb[master]: [gdb/breakpoints] Fix fullname.exp when run from symlink dir X-Gerrit-Change-Id: I1ace62a234458781e958980f3b425edf1490df27 X-Gerrit-Change-Number: 82 X-Gerrit-ChangeURL: X-Gerrit-Commit: c5dce877c60635204d2d29f27c84ea48f7e7bde0 References: Reply-To: tdevries@suse.de, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3 Tom de Vries has uploaded a new change for review. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/82 ...................................................................... [gdb/breakpoints] Fix fullname.exp when run from symlink dir I run into this error with gdb.base/fullname.exp: ... (gdb) file /data/gdb_versions/devel/build/gdb/testsuite/outputs/\ gdb.base/fullname/fullname Reading symbols from /data/gdb_versions/devel/build/gdb/testsuite/outputs/\ gdb.base/fullname/fullname... (gdb) break /data/gdb_versions/devel/build/gdb/testsuite/\ outputs/gdb.base/fullname/tmp-fullname.c:21 No source file named /data/gdb_versions/devel/build/gdb/testsuite/outputs/\ gdb.base/fullname/tmp-fullname.c. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) FAIL: gdb.base/fullname.exp: set breakpoint by full path before loading symbols - built relative ... The FAIL is due to this comparison in iterate_over_some_symtabs failing: ... 481 if (FILENAME_CMP (real_path, fullname) == 0) (gdb) p real_path $2 = 0x1a201f0 "/data/gdb_versions/devel/build/gdb/testsuite/outputs/\ gdb.base/fullname/tmp-fullname.c" (gdb) p fullname $3 = 0x1a1de80 "/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/\ gdb.base/fullname/tmp-fullname.c" ... The difference in pathnames is due to having a symlink dir: ... $ ls -la /home/vries/gdb_versions lrwxrwxrwx 1 vries users 18 26 jun 2018 /home/vries/gdb_versions -> /data/gdb_versions ... and the test passses when eliminating it: ... $ ( cd $(pwd -P); make check RUNTESTFLAGS=gdb.base/fullname.exp ) ... The FAIL is a regression from commit a0c1ffedcf1 "Only compute realpath when basenames_may_differ is set". Before, find_and_open_source was returning a real-path, resulting in variable 'fullname' being the same as varible 'real_path' in the comparison listed above. But after, that's no longer the case. Fix the FAIL by applying gdb_realpath on the fullname variable before the comparison. Tested on x86_64-linux. I wasn't able to write a test-case. The FAIL starts at: ... $ cd build/gdb $ mv testsuite testsuite.bla $ ln -s testsuite.bla testsuite ... but already this doesn't trigger it anymore: ... $ cd build/gdb/outputs $ mv outputs outputs.bla $ ln -s outputs.bla outputs ... gdb/ChangeLog: 2019-10-15 Tom de Vries PR breakpoints/24687 * symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname. Change-Id: I1ace62a234458781e958980f3b425edf1490df27 --- M gdb/symtab.c 1 file changed, 3 insertions(+), 0 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index 8a551f1..22c09aa 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -478,6 +478,9 @@ gdb_assert (IS_ABSOLUTE_PATH (real_path)); gdb_assert (IS_ABSOLUTE_PATH (name)); + gdb::unique_xmalloc_ptr fullname_real_path + = gdb_realpath (fullname); + fullname = fullname_real_path.get (); if (FILENAME_CMP (real_path, fullname) == 0) { if (callback (s))