From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47031 invoked by alias); 4 Oct 2016 13:19:38 -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 46927 invoked by uid 89); 4 Oct 2016 13:19:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SEMBACKSCATTER,SPF_PASS autolearn=ham version=3.3.2 spammy=xfree, H*x:Release, H*UA:Release 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; Tue, 04 Oct 2016 13:19:35 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u94DI3TN082315 for ; Tue, 4 Oct 2016 09:19:33 -0400 Received: from e28smtp05.in.ibm.com (e28smtp05.in.ibm.com [125.16.236.5]) by mx0b-001b2d01.pphosted.com with ESMTP id 25vcrn1efn-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 04 Oct 2016 09:19:33 -0400 Received: from localhost by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Oct 2016 18:49:28 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp05.in.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 4 Oct 2016 18:49:25 +0530 X-IBM-Helo: d28dlp01.in.ibm.com X-IBM-MailFrom: sangamesh.swamy@in.ibm.com X-IBM-RcptTo: gdb-patches@sourceware.org Received: from d28relay06.in.ibm.com (d28relay06.in.ibm.com [9.184.220.150]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 5BB13E005A for ; Tue, 4 Oct 2016 18:48:58 +0530 (IST) Received: from d50lp31.co.us.ibm.com (d50lp31.boulder.ibm.com [9.17.249.32]) by d28relay06.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u94DJNgi48103524 for ; Tue, 4 Oct 2016 18:49:24 +0530 Received: from localhost by d50lp31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Oct 2016 07:19:22 -0600 Received: from smtp.notes.na.collabserv.com (192.155.248.73) by d50lp31.co.us.ibm.com (192.168.2.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128/128) Tue, 4 Oct 2016 07:19:22 -0600 Received: from localhost by smtp.notes.na.collabserv.com with smtp.notes.na.collabserv.com ESMTP for from ; Tue, 4 Oct 2016 13:19:20 -0000 Received: from us1a3-smtp04.a3.dal06.isc4sb.com (10.106.154.237) by smtp.notes.na.collabserv.com (10.106.227.90) with smtp.notes.na.collabserv.com ESMTP; Tue, 4 Oct 2016 13:19:19 -0000 Received: from us1a3-mail142.a3.dal06.isc4sb.com ([10.146.38.78]) by us1a3-smtp04.a3.dal06.isc4sb.com with ESMTP id 2016100413191849-223935 ; Tue, 4 Oct 2016 13:19:18 +0000 In-Reply-To: <20160930141503.698BC11C24D@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: Tue, 04 Oct 2016 13:19:00 -0000 References: from "Sangamesh Mallayya" at Sep 30, 2016 07:38:48 PM <20160930141503.698BC11C24D@oc8523832656.ibm.com> MIME-Version: 1.0 X-KeepSent: D72EBFAF:9D379364-65258042:0048192D; type=4; name=$KeepSent X-LLNOutbound: False X-Disclaimed: 47683 X-TNEFEvaluated: 1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="US-ASCII" x-cbid: 16100413-0016-0000-0000-0000034344C5 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.00005850; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00764191; UDB=6.00364923; UTC=2016-10-04 13:19:20 x-cbparentid: 16100413-3108-0000-0000-00000145DCC8 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-04_04:,, 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-1610040228 X-SW-Source: 2016-10/txt/msg00040.txt.bz2 Hi Ulrich, >=20 > > If we call solib_bfd_open for .a files then the call to open file=20 using > > gdb_open_cloexec inside solib_find function is failing. > > The reason for this is, > > we will be getting library information from ld_info in the form of > > "/usr/lib/libc.a(shr.o)", but actually we will be having the > > file in filesystem as /usr/lib/libc.a. This is the reason initially i > > didn't use solib_bfd_open. >=20 > Yes, I understand why you cannot use solib_bfd_open directly. That's=20 why > I suggested to use *solib_bfd_fopen* (note the "f") :-) >=20 > > But i experimented some more and tried to see how gdb behaves if we=20 pass > > modified pathname exactly as the file which we are having in the=20 machine, > > like "/usr/lib/libc.a". > > Then bfd bfd_check_format is failing with the error "not in executable > > format". > > Looks like bfd isn't able to recognise the .a archives. > > I can have a look on why bfd check is failing. >=20 > That's because solib_bfd_open uses the bfd_object argument to > bfd_check_format, which is explicitly supposed to reject .a archives. > Instead, to check for archives, you need to use bfd_archive, like > solib_aix_bfd_open does. I'm not suggesting to change that, just to > open the bfd using solib_find and solib_bfd_fopen before performing > the check, instead of using gdb_bfd_open. Calling solib_find returning a prefixed sysroot path and the duplication=20 can be avoided as you suggested. But calling solib_bfd_fopen after this is causing the assertion to fail on= =20 NULL path as solib_bfd_fopen doing xfree of pathname at the end. As we still want to refer to sysroot path returned from solib_find or=20 filename inside solib_aix_bfd_open until assigning path to bfd filename "( object_bfd->filename =3D xstrdup (pathname)" So calling solib_bfd_fopen is causing assertion failure like this. utils.c:2971: internal-error: char* gdb_abspath(const char*): Assertion=20 `path !=3D NULL && path[0] !=3D '\0'' failed.=20 This is the change i have it right now. char *member_name; bfd *archive_bfd, *object_bfd; struct cleanup *cleanup; + int found_file; =20 if (pathname[path_len - 1] !=3D ')') return solib_bfd_open (pathname); @@ -669,6 +670,9 @@ member_name =3D xstrprintf ("%.*s", path_len - filename_len - 2, sep += =20 1); make_cleanup (xfree, member_name); =20 + pathname =3D solib_find (filename, &found_file); + if (pathname =3D=3D NULL) + perror_with_name (filename); archive_bfd =3D gdb_bfd_open (filename, gnutarget, -1); if (archive_bfd =3D=3D NULL) { Let me know your view.