From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74840 invoked by alias); 14 Apr 2016 11:28:52 -0000 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 Received: (qmail 74815 invoked by uid 89); 14 Apr 2016 11:28:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Maintain, favorite X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 14 Apr 2016 11:28:49 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C1C881100; Thu, 14 Apr 2016 11:28:48 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3EBSkUQ030982; Thu, 14 Apr 2016 07:28:47 -0400 Subject: Re: [PATCH 1/2] Change gdb_load_shlibs to gdb_load_shlib To: Simon Marchi , gdb-patches@sourceware.org References: <1460502865-10999-1-git-send-email-simon.marchi@ericsson.com> <570E8D61.3010100@redhat.com> <570EB491.7090001@ericsson.com> Cc: qiyaoltc@gmail.com, antoine.tremblay@ericsson.com From: Pedro Alves Message-ID: <570F7EEE.3050106@redhat.com> Date: Thu, 14 Apr 2016 11:28:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <570EB491.7090001@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-04/txt/msg00323.txt.bz2 On 04/13/2016 10:05 PM, Simon Marchi wrote: > On 16-04-13 02:18 PM, Pedro Alves wrote: >> We'll now only end up with $libobj2's dirname in the solib-search-path. >> This usually won't be a problem since the dirnames will be the same, >> though I guess some test might be doing something with subdirs. >> Grepping a bit I found solib-search.exp, though it's currently disabled >> on remote testing. > > Ah that's true. For some reason I thought it appended to the list in GDB. > > In the original implementation, it only used the dirname of the first passed > shared library, didn't it? You're right. I only realized that after hitting send. > So the behavior will change (we will keep the > directory of the last one, where we used to keep the directory of the first > one), but is the situation worse than it was? Probably not. > >> Do we need to maintain a list of dirnames, and clear it somewhere? > > If a test case needs to have multiple different values in solib-search-path, > we have multiple options. > > Option #1 > > Maintain a list somewhere in the TCL code. It's not my favorite, because > we already have a ton of global stuff hard to keep track of. Indeed. > > Option #2 > > Get the current value using "show solib-search-path" and append the new value > to it. Interesting idea. > > Option #3 > > Initially I thought of a lazy way to achieve what I want. I thought to > make gdb_load_shlibs return a list of the destination paths (one for each > passed solib). This way I wouldn't have had to modify all the callers. If > we used this approach, we could build the list of all the directories and pass > that to set solib-search-path. > Right. Several tests call gdb_load_shlibs once for each lib, and we'd need to merge those, for correct solib-search-path. > Options #4 > > Maybe it's not a big deal, tests that do some special solib path stuff can > just override solib-search-path as they see fit. If testing something that needs to exercise something related to debugging a set of libraries laid out in different directories like, e.g. having: plugin.so dir_1/plugin.so dir_1/dir_2/plugin.so dir_2/plugin.so dir_2/dir_1/plugin.so dir_2/dir_2/plugin.so and exercising symbol the search code in solib.c:solib_find (e.g., mess with PATH/LD_LIBRARY_PATH), you still shouldn't need solib-search-path when testing locally, and the testcase shouldn't need to explicitly set solib-search-path. It's just theoretical at this point though, given that as you found, we already have the issue. > The setting of > solib-search-path in gdb_load_shlib[s] is only for convenience in the > general case. Since this turns out to be a pre-existing issue, I'm fine with ignoring it for now. Thanks, Pedro Alves