From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19577 invoked by alias); 16 Dec 2010 14:23:50 -0000 Received: (qmail 19569 invoked by uid 22791); 16 Dec 2010 14:23:48 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet10.oracle.com (HELO rcsinet10.oracle.com) (148.87.113.121) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Dec 2010 14:23:43 +0000 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id oBGENbLf001462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 16 Dec 2010 14:23:39 GMT Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id oBGENVZ9015667; Thu, 16 Dec 2010 14:23:35 GMT Received: from abhmt014.oracle.com by acsmt354.oracle.com with ESMTP id 859629961292509410; Thu, 16 Dec 2010 06:23:30 -0800 Received: from [10.191.7.44] (/10.191.7.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 16 Dec 2010 06:23:29 -0800 Message-ID: <4D0A20D6.4040009@oracle.com> Date: Thu, 16 Dec 2010 14:23:00 -0000 From: Yoshinori Toshima User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Pierre Muller CC: gdb-patches@sourceware.org, yoshinori.toshima@oracle.com Subject: Re: Please add code to pick up SOLIB_SEARCH_PATH env var. References: <4D09DB33.902@oracle.com> <20101216112614.fa2rmsu5eso0o0ok@webmail.u-strasbg.fr> <4D0A128D.40201@oracle.com> In-Reply-To: <4D0A128D.40201@oracle.com> Content-Type: multipart/mixed; boundary="------------090003090603050404020207" 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: 2010-12/txt/msg00336.txt.bz2 This is a multi-part message in MIME format. --------------090003090603050404020207 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Content-length: 3165 Hello Pierre, I removed access check from the patch and specified colon separated paths including non-existing directory and a regular path. gdb picked up the libraries in the path list specified by the environment variable. Invalid elements are simply ignored. I've not checked all the details, but these multiple path elements are handled properly when interpreting solib variable solib_search_path. Maybe access() check is redundant. > Did you try 'gdb -ex "set solib-search-patch ..."' ? It worked. It worked with colon separated multiple paths too. I didn't see the option in man page, though. It is good to have alternative methods, so suggested SOLIB_SEARCH_PATH method still has value, I think. One advantage is that it does not require changing program which has a hard coded gdb invocation. Regards, Yoshinori (2010/12/16 22:22), Yoshinori Toshima wrote: > Hello Pierre, > > Thank you for your comment. > > Currently, single path element works. It is rare to have same > libraries with > same name in different directories. > > To support multiple path elements, we need to check solib_search_path > variable use in solib.c again. If it can have comma separated path > elements, > then we can check each environment variable and join valid elements with > colon and set it to solib_search_path. > > > Did you try 'gdb -ex "set solib-search-patch ..."' ? > No I haven't. I'll check it. > > Regards, > Yoshinori > > (10/12/16 19:26), Pierre Muller wrote: >> I was wondering if your patch >> would work if the environment variable had >> several entries, like; >> SOLIB_SEARCH_PATH=/myprefix/lib:/myprefix/lib64 >> >> Does access return 0 if you >> give it the whole evironment variable, or should >> you test the coponents one by one? >> >> Pierre Muller >> >>> Yoshinori Toshima a écrit : >>> >>> Hello, >>> >>> I have a small enhancement request for GDB to make it easier to >>> use when debugging core file from other systems which have >>> different libraries. >>> >>> Description: >>> When debugging a core file from released product, it is convenient >>> to have gdb use shared libraries in a directory which contains the >>> libraries and executable taken from the system which caused the >>> crash. It is possible to perform this by gdb command "set >>> solib-search-path ". This means some commands are required >>> after starting gdb. If we can set solib-search-path at gdb startup, >>> it is easier to use. This is useful when we use GDB programmatically. >>> >>> HP-UX port of GDB has this feature via env var GDB_SHLIB_PATH. >>> GDB does not have the feature yet, though it mentions SOLIB_SEARCH_PATH >>> in solib.c. >>> >>> I changed solib.c to pick up SOLIB_SEARCH_PATH at startup and set >>> it to solib_search_path in solib.c initialization. It worked as >>> expected. >>> >>> Attached solib-patch.diff is based on solib.c in gdb 7.2. >>> >>> ChangeLog entry: >>> 2010-12-16 Yoshinori Toshima >>> >>> * solib.c: Pick up SOLIB_SEARCH_PATH env var to set >>> solib-search-path at >>> startup. >>> >>> Regards, >>> Yoshinori Toshima >>> >> >> >> >> > --------------090003090603050404020207 Content-Type: text/plain; name="solib-patch-2.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="solib-patch-2.diff" Content-length: 1371 KioqIGdkYi5vcmcvc29saWIuYwkyMDEwLTEyLTE2IDE3OjUxOjExLjAwMDAw MDAwMCArMDkwMAotLS0gZ2RiL3NvbGliLmMJMjAxMC0xMi0xNiAyMzoxNTox Ny4wMDAwMDAwMDAgKzA5MDAKKioqKioqKioqKioqKioqIHNvbGliX2dsb2Jh bF9sb29rdXAgKGNvbnN0IHN0cnVjdCBvYmpmaWwKKioqIDE0NDgsMTQ1MyAq KioqCi0tLSAxNDQ4LDE0NjQgLS0tLQogICAgcmV0dXJuIE5VTEw7CiAgfQog IAorIHZvaWQgCisgY2hlY2tfc29saWJfc2VhcmNoX3BhdGhfZW52ICgpIAor IHsKKyAgIGNoYXIgKmVudnZhciA9IGdldGVudigiU09MSUJfU0VBUkNIX1BB VEgiKTsKKyAgIGlmIChlbnZ2YXIgIT0gTlVMTCkgeworICAgICAgIHNvbGli X3NlYXJjaF9wYXRoID0gZW52dmFyOworICAgICAgIGZwcmludGZfZmlsdGVy ZWQgKGdkYl9zdGRvdXQsIF8oIlBpY2tlZCB1cCBTT0xJQl9TRUFSQ0hfUEFU SCAlcy5cbiIpLAorICAgICAgICAgICAgICAgICAgICAgZW52dmFyKTsKKyAg IH0KKyB9CisgCiAgCiAgZXh0ZXJuIGluaXRpYWxpemVfZmlsZV9mdHlwZSBf aW5pdGlhbGl6ZV9zb2xpYjsgLyogLVdtaXNzaW5nLXByb3RvdHlwZXMgKi8K ICAKKioqKioqKioqKioqKioqIEZvciBvdGhlciAocmVsYXRpdmUpIGZpbGVz LCB5b3UgY2FuIGFkZCAKKioqIDE0OTEsMTQ5NiAqKioqCi0tLSAxNTAyLDE1 MDkgLS0tLQogICAgYWRkX2FsaWFzX2NtZCAoInNvbGliLWFic29sdXRlLXBy ZWZpeCIsICJzeXNyb290IiwgY2xhc3Nfc3VwcG9ydCwgMCwKICAJCSAmc2hv d2xpc3QpOwogIAorICAgY2hlY2tfc29saWJfc2VhcmNoX3BhdGhfZW52KCk7 CisgCiAgICBhZGRfc2V0c2hvd19vcHRpb25hbF9maWxlbmFtZV9jbWQgKCJz b2xpYi1zZWFyY2gtcGF0aCIsIGNsYXNzX3N1cHBvcnQsCiAgCQkJCSAgICAg JnNvbGliX3NlYXJjaF9wYXRoLCBfKCJcCiAgU2V0IHRoZSBzZWFyY2ggcGF0 aCBmb3IgbG9hZGluZyBub24tYWJzb2x1dGUgc2hhcmVkIGxpYnJhcnkgc3lt Ym9sIGZpbGVzLiIpLCBfKCJcCg== --------------090003090603050404020207--