From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44057 invoked by alias); 7 Oct 2016 19:31:18 -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 44038 invoked by uid 89); 7 Oct 2016 19:31:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=aix, AIX, sharedlibrary, Hx-languages-length:1562 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Oct 2016 19:31:15 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u97JTAu2048603 for ; Fri, 7 Oct 2016 15:31:14 -0400 Received: from e06smtp06.uk.ibm.com (e06smtp06.uk.ibm.com [195.75.94.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 25xc3rppnd-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 07 Oct 2016 15:31:14 -0400 Received: from localhost by e06smtp06.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 7 Oct 2016 20:31:12 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp06.uk.ibm.com (192.168.101.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 7 Oct 2016 20:31:10 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id BF77E2190023 for ; Fri, 7 Oct 2016 20:30:27 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u97JV9Qx4063728 for ; Fri, 7 Oct 2016 19:31:09 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u97JV9Dt019632 for ; Fri, 7 Oct 2016 13:31:09 -0600 Received: from oc8523832656.ibm.com (icon-9-164-129-157.megacenter.de.ibm.com [9.164.129.157]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u97JV9UC019622; Fri, 7 Oct 2016 13:31:09 -0600 Received: by oc8523832656.ibm.com (Postfix, from userid 500) id 9C39210C1FE; Fri, 7 Oct 2016 21:31:07 +0200 (CEST) Subject: Re: set sysroot command on AIX has no effect. To: sangamesh.swamy@in.ibm.com (Sangamesh Mallayya) Date: Fri, 07 Oct 2016 19:31:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: from "Sangamesh Mallayya" at Oct 04, 2016 06:49:18 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16100719-0024-0000-0000-0000022ECE09 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16100719-0025-0000-0000-000020B4D7B3 Message-Id: <20161007193107.9C39210C1FE@oc8523832656.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-07_09:,, 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-1610070335 X-SW-Source: 2016-10/txt/msg00183.txt.bz2 Sangamesh Mallaya wrote: > Calling solib_find returning a prefixed sysroot path and the duplication > can be avoided as you suggested. > But calling solib_bfd_fopen after this is causing the assertion to fail on > NULL path as solib_bfd_fopen doing xfree of pathname at the end. Well, of course, you have to check for NULL. What I'm suggesting is to use something along the lines of: found_pathname = solib_find (filename, &found_file); if (found_pathname == NULL) // error handling archive_bfd = solib_bfd_fopen (found_pathname, found_file); where the code currently does: archive_bfd = gdb_bfd_open (filename, gnutarget, -1); if (archive_bfd == NULL) // error handling > + pathname = solib_find (filename, &found_file); > + if (pathname == NULL) > + perror_with_name (filename); > archive_bfd = gdb_bfd_open (filename, gnutarget, -1); > if (archive_bfd == NULL) > { This has a number of problems: - you still use gdb_bfd_open with filename, which means it still won't find the file (I assume you meant to use pathname?) - if solib_find actually finds the file, "found_file" is an open file descriptor, which the code now leaks - actually, the pathname string now also leaks - and finally, at the bottom: object_bfd->filename = xstrdup (pathname); you now miss the object file name (in parentheses), so "info sharedlibrary" will no longer show it Most of those should be fixed when using the approach above. Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com