From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126517 invoked by alias); 30 May 2017 08:00:50 -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 125567 invoked by uid 89); 30 May 2017 08:00:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=grounds, HTo:U*palves, mixture, representative 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; Tue, 30 May 2017 08:00:13 +0000 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4U7we08076459 for ; Tue, 30 May 2017 04:00:14 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2arycp28ky-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 30 May 2017 04:00:14 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 May 2017 09:00:12 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 May 2017 09:00:11 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v4U80AAP16384398; Tue, 30 May 2017 08:00:10 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02D394C059; Tue, 30 May 2017 08:58:37 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1F664C050; Tue, 30 May 2017 08:58:36 +0100 (BST) Received: from ThinkPad (unknown [9.152.212.148]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 30 May 2017 08:58:36 +0100 (BST) Date: Tue, 30 May 2017 08:00:00 -0000 From: Philipp Rudo To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [RFC 2/7] Add unit test to builtin tdesc generated by xml In-Reply-To: <4c6f2f5a-e2c2-df09-0440-0f9431e7594a@redhat.com> References: <1494518105-15412-1-git-send-email-yao.qi@linaro.org> <1494518105-15412-3-git-send-email-yao.qi@linaro.org> <20170516140027.29636db3@ThinkPad> <4c6f2f5a-e2c2-df09-0440-0f9431e7594a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17053008-0008-0000-0000-00000457E2DE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17053008-0009-0000-0000-00001DDA0EBB Message-Id: <20170530100007.309c5669@ThinkPad> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-30_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705300152 X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00613.txt.bz2 Hi Pedro, sorry for the late answer but I was sick the last 10 days and just returned yesterday... On Wed, 17 May 2017 17:06:13 +0100 Pedro Alves wrote: > On 05/16/2017 01:00 PM, Philipp Rudo wrote: > > >> + /* Look for the features directory. If the directory of __FILE__ can't > >> + be found, __FILE__ is a file name with relative path. Guess that > >> + GDB is executed in testsuite directory like ../gdb, because I don't > >> + expect that GDB is invoked somewhere else and run self tests. */ > >> + if (stat (feature_dir.data (), &st) < 0) > >> + { > >> + feature_dir.insert (0, SLASH_STRING); > >> + feature_dir.insert (0, ".."); > > > > This would be a perfect spot for concat_path (patch 2 from my lk series > > https://sourceware.org/ml/gdb-patches/2017-03/msg00272.html). > > Then it would read > > > > feature_dir = concat_path ("..", feature_dir); > > > > I actually want to bring some of my patches upstream (mostly the > > s390-linux-tdep split up patch) to reduce maintenance cost of my > > series. This would be a good time for this patch, too. > > Could that patch be split out of the series, and justified on its > own grounds? Is there some representative place in the codebase > that you could cleanup a bit using the new API, just to show it > working nicely? Also, a unit test would be nice. The patch can be split from my series without problem. I already pulled it right to the beginning of the series, as it is independent of all other changes in the set. There are quite some places you can simplify by using the function. Just grep for SLASH_STRING to find most of them. I also had a patch once where I eliminated all use of SLASH_STRING using the concat_path. Unfortunately it had some problems with the mixture of C and C++ strings causing memory leaks and read after free's. I never had the time to clean that up and thus didn't send it to the mailing list ... > Also, and most importantly, seems to me that patch still has > a lot inefficiency related to std::string copying, e.g.: > > +static inline unsigned long > +approx_path_length (std::initializer_list args, > + std::string dir_separator) > > This is passing in the strings by value / copy. That looks like > an aweful lot of malloc/free/strdup behind the scenes. True, this can be optimized. > I still think that if we're adding some utility for building > paths from dir components, that it'd be preferred to model > the API on (a small subset of) std::experimental::filesystem::path, > since in a few years that's the API that everyone learning C++ will > be learning. Also true, let me see if I can hack something today. Currently I don't like to do what I should do and there are many meeting today anyway. So this looks like a perfect task for today ;) Philipp > Thanks, > Pedro Alves >