From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72481 invoked by alias); 23 Oct 2017 16:16:28 -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 72037 invoked by uid 89); 23 Oct 2017 16:16:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=stable_sort 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; Mon, 23 Oct 2017 16:16:26 +0000 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9NGEsfT024889 for ; Mon, 23 Oct 2017 12:16:25 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dskdjh590-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 23 Oct 2017 12:16:24 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Oct 2017 17:16:23 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 23 Oct 2017 17:16:21 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9NGGLXt30802140; Mon, 23 Oct 2017 16:16:21 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BB4442041; Mon, 23 Oct 2017 17:11:46 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B9E14203F; Mon, 23 Oct 2017 17:11:46 +0100 (BST) Received: from oc3748833570.ibm.com (unknown [9.152.213.178]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 23 Oct 2017 17:11:46 +0100 (BST) Received: by oc3748833570.ibm.com (Postfix, from userid 1000) id 99288D80753; Mon, 23 Oct 2017 18:16:20 +0200 (CEST) Subject: Re: [RFA 1/6] Use std::vector in end_symtab_get_static_block To: palves@redhat.com (Pedro Alves) Date: Mon, 23 Oct 2017 16:16:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org, tom@tromey.com, simon.marchi@ericsson.com In-Reply-To: <3d40d7a8-65d1-3c04-1041-475457acfe48@redhat.com> from "Pedro Alves" at Oct 20, 2017 05:47:18 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17102316-0016-0000-0000-000004F8FD55 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102316-0017-0000-0000-000028346B9E Message-Id: <20171023161620.99288D80753@oc3748833570.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-23_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-1707230000 definitions=main-1710230228 X-SW-Source: 2017-10/txt/msg00725.txt.bz2 Pedro Alves wrote: > On 10/20/2017 04:33 PM, Ulrich Weigand wrote: > > [Re-sent since the original seems to have gotten lost somehow.] > > > >>>>>>> "Simon" == Simon Marchi writes: > >> > >> Simon> That made me doubt for a second, since we're more used to see "<" > >> Simon> in these functions. I then saw that block_compar did sort them > >> Simon> in descending order. Could you add a comment here to indicate that? > >> > >> Done, thanks. > > > > This causes a number of regressions in the gdb.opt/inline-cmds.exp > > test case for me. Not sure exactly why, but changing the std::sort > > to a std::stable_sort like below fixes those regressions for me. > > Maybe the logic for handling inline function blocks somehow relied > > on some (undocumented) behavior of qsort for handling elements that > > compare as equal? > > > > Sounds like we should improve the sort predicate to disambiguate > better, define a total order? I don't really know which sorting > is assumed, but e.g., if the block start addresses are the same, > compare the blocks' end addresses. If those match as well, > repeat but with the blocks' superblocks. And/or sort function > blocks before non-function blocks. Etc. I don't believe we can do this, actually. At this point in time, a block's superblock is not yet known -- in fact, the superblock links are set up afterwards *based on* the order determined here. We could compare end addresses, but that doesn't fully resolve the issue, in case an inline function 100% overlaps its caller. It looks like the only place where have the information which function is the caller and which the callee is in fact the original order of blocks in the pending_blocks list, since they were placed in the correct order by the DWARF reader based on DWARF info. Now, the reason why we re-sort pending_blocks here is to allow for object code reordering (hot/cold sections and the like). But this type of reordering never actually affects inline function relationships. So it may be that just using stable_sort here is actually the *correct* fix ... Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com