From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95511 invoked by alias); 13 Oct 2016 13:42:46 -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 94896 invoked by uid 89); 13 Oct 2016 13:42:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SEMBACKSCATTER,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:2880, Override, bfd's, 1594 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Oct 2016 13:42:44 +0000 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9DDdbwX079192 for ; Thu, 13 Oct 2016 09:42:43 -0400 Received: from e28smtp09.in.ibm.com (e28smtp09.in.ibm.com [125.16.236.9]) by mx0b-001b2d01.pphosted.com with ESMTP id 2626bp9fvb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Oct 2016 09:42:42 -0400 Received: from localhost by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Oct 2016 19:12:39 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp09.in.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Oct 2016 19:12:38 +0530 X-IBM-Helo: d28dlp03.in.ibm.com X-IBM-MailFrom: sangamesh.swamy@in.ibm.com X-IBM-RcptTo: gdb-patches@sourceware.org Received: from d28relay09.in.ibm.com (d28relay09.in.ibm.com [9.184.220.160]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 04BC9125805E for ; Thu, 13 Oct 2016 19:13:10 +0530 (IST) Received: from e39.co.us.ibm.com (e39.boulder.ibm.com [9.17.249.49]) by d28relay09.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9DDga0P29163632 for ; Thu, 13 Oct 2016 19:12:37 +0530 Received: from localhost by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Oct 2016 07:42:36 -0600 Received: from smtp.notes.na.collabserv.com (192.155.248.91) by e39.co.us.ibm.com (192.168.2.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128/128) Thu, 13 Oct 2016 07:42:34 -0600 Received: from localhost by smtp.notes.na.collabserv.com with smtp.notes.na.collabserv.com ESMTP for from ; Thu, 13 Oct 2016 13:42:33 -0000 Received: from us1a3-smtp03.a3.dal06.isc4sb.com (10.106.154.98) by smtp.notes.na.collabserv.com (10.106.227.143) with smtp.notes.na.collabserv.com ESMTP; Thu, 13 Oct 2016 13:42:31 -0000 Received: from us1a3-mail142.a3.dal06.isc4sb.com ([10.146.38.78]) by us1a3-smtp03.a3.dal06.isc4sb.com with ESMTP id 2016101313423042-1175580 ; Thu, 13 Oct 2016 13:42:30 +0000 In-Reply-To: <20161011071648.C875B10BCC0@oc8523832656.ibm.com> To: "Ulrich Weigand" Cc: gdb-patches@sourceware.org Subject: Re: set sysroot command on AIX has no effect. From: "Sangamesh Mallayya" Date: Thu, 13 Oct 2016 13:42:00 -0000 References: <20161010162853.BEB9D10C212@oc8523832656.ibm.com> from "Ulrich Weigand" at Oct 10, 2016 06:28:53 PM <20161011071648.C875B10BCC0@oc8523832656.ibm.com> MIME-Version: 1.0 X-KeepSent: 3D3928EA:F457C5CB-6525804B:004AC6FD; type=4; name=$KeepSent X-LLNOutbound: False X-Disclaimed: 60495 X-TNEFEvaluated: 1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="US-ASCII" x-cbid: 16101313-0060-0000-0000-0000015D63E5 X-IBM-ISS-SpamDetectors: Score=0.40962; BY=0; FL=0; FP=0; FZ=0; HX=0; KW=0; PH=0; SC=0.40962; ST=0; TS=0; UL=0; ISC= X-IBM-ISS-DetailInfo: BY=3.00005904; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00767853; UDB=6.00367457; UTC=2016-10-13 13:42:32 x-cbparentid: 16101313-9952-0000-0000-000001A24025 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused X-Content-Scanned: Fidelis XPS MAILER X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-13_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610130234 X-SW-Source: 2016-10/txt/msg00359.txt.bz2 Hi Ulrich, > > This is looking mostly good. The one thing I don't like is all the=20 extra > > xfree calls. I think a better way would to not actually xstrdup the=20 found > > pathname early after all, but instead just get it from the BFD. So=20 instead > > of the original: > >=20 > > xfree (bfd_get_filename (object_bfd)); > > object_bfd->filename =3D xstrdup (pathname); > >=20 > > you'd do something like: > >=20 > > object_bfd->filename =3D xrealloc (object_bfd->filename, ...); > > strcat (object_bfd->filename, sep); >=20 > Sorry, I mixed up the two BFDs here, we need to get the pathname from > the archive_bfd, of coutse. So this would be something like: >=20 > xfree (bfd_get_filename (object_bfd)); > object_bfd->filename =3D xstrprintf ("%s%s", bfd_get_filename=20 > (archive_bfd), sep); >=20 Thanks again. Here is the updated patch and looks much better than the=20 previous one. --- ./gdb/solib-aix.c_orig 2016-10-04 03:22:01.000000000 -0500 +++ ./gdb/solib-aix.c 2016-10-13 03:09:26.000000000 -0500 @@ -648,6 +648,8 @@ char *member_name; bfd *archive_bfd, *object_bfd; struct cleanup *cleanup; + int found_file; + char *found_pathname; =20 if (pathname[path_len - 1] !=3D ')') return solib_bfd_open (pathname); @@ -669,7 +671,13 @@ member_name =3D xstrprintf ("%.*s", path_len - filename_len - 2, sep += =20 1); make_cleanup (xfree, member_name); =20 - archive_bfd =3D gdb_bfd_open (filename, gnutarget, -1); + /* Calling solib_find makes certain that sysroot path is set properly + if program has a dependency on .a archive and sysroot is set via + set sysroot command. */ + found_pathname =3D solib_find (filename, &found_file); + if (found_pathname =3D=3D NULL) + perror_with_name (pathname); + archive_bfd =3D solib_bfd_fopen (found_pathname, found_file); if (archive_bfd =3D=3D NULL) { warning (_("Could not open `%s' as an executable file: %s"), @@ -724,12 +732,14 @@ return NULL; } =20 - /* Override the returned bfd's name with our synthetic name in order - to allow commands listing all shared libraries to display that - synthetic name. Otherwise, we would only be displaying the name - of the archive member object. */ + /* Override the returned bfd's name with the name returned from=20 solib_find + along with appended parenthesized member name in order to allow=20 commands + listing all shared libraries to display.=20 + Otherwise, we would only be displaying the name of the archive=20 member + object. */ xfree (bfd_get_filename (object_bfd)); - object_bfd->filename =3D xstrdup (pathname); + object_bfd->filename =3D xstrprintf ("%s%s", + bfd_get_filename (archive_bfd),=20 sep); =20 gdb_bfd_unref (archive_bfd); do_cleanups (cleanup); I ran gdb.base regression test too and no new failures are seen. Here is the summary. # of expected passes 9860 # of unexpected failures 1594 # of expected failures 14 # of unresolved testcases 1 # of untested testcases 60 # of unsupported tests 30