From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CCCPL/NB81+YIAAAWB0awg (envelope-from ) for ; Mon, 04 Jan 2021 11:27:31 -0500 Received: by simark.ca (Postfix, from userid 112) id C0AB71F0AA; Mon, 4 Jan 2021 11:27:31 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: * X-Spam-Status: No, score=1.9 required=5.0 tests=FORGED_MUA_MOZILLA, FREEMAIL_FROM,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2ADA91E965 for ; Mon, 4 Jan 2021 11:27:31 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 85047388A406; Mon, 4 Jan 2021 16:27:30 +0000 (GMT) Received: from EUR06-AM7-obe.outbound.protection.outlook.com (mail-am7eur06olkn2043.outbound.protection.outlook.com [40.92.16.43]) by sourceware.org (Postfix) with ESMTPS id 22F753840C2A for ; Mon, 4 Jan 2021 16:27:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 22F753840C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bernd.edlinger@hotmail.de ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m3hyv5i4uVCXdX3nKw+JCZHkr8jhh4psfTfHW+8pFVpf/7Mq72e1Y9yC/8ZbeDTmOzJzygE2kOO4gqzhxMNgkUduLZNYlUFzpCfWmdBD0tTpZXiBEXr3RtB6/vlnpN+Nxac8uhDUMnGBSROYOMa8hLLAUHsEvONQAEkFnk0cpxv1cMFVxL+iCU0Dsx44+KVqky2bt6YFpPFho+GyqBKyXVV+ricFezzyjzw/NhUEXPHzYn5zWn+oqgSt2hKRTMDXF4DlX7DgBv8Vfl6mP7LtdP25UWs3/lbqeu6zrp4IySIwaZ5hLd++QNuV3xwcsjwyXSIBy2NXDo7qVGbHr9/jsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OqA0K2L8dWPySvUXmxcFQIVKio1dsf1NA2eltrEHmnc=; b=MQ/ern/Jj9dme1jblngQQeciACeKWlwN7VmnsSA6hYl2Tz9Lt90XvxhWkBo6zZpNWIFn/z0P9vLzFKAJIgEM3CQANqrgyOw57b1vlN+0Sc9fisNs3LSGI9tVG37icrm1jvLPfLkALlcbEDt2E7bGdFylAaNgW4adiQfEqfiMPlrNVDmDnTOJt+jnUS04mgeiVmJ1wfl9J1fTgQj43JRhhaJJKkKlvikrlhm96ROgCdpLrEi5OguLpxP7wVTJACz2aWSvl545sy2nXd634xjN/2EPX8Ht/OBfC1FnsI0f7D/iOLfIMLaW9N5xrcN4M9qNjZFX+VDNLS2Lwfj75wynbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DB8EUR06FT029.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::4c) by DB8EUR06HT099.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::477) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20; Mon, 4 Jan 2021 16:27:24 +0000 Received: from AM0PR0602MB3410.eurprd06.prod.outlook.com (2a01:111:e400:fc35::46) by DB8EUR06FT029.mail.protection.outlook.com (2a01:111:e400:fc35::318) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20 via Frontend Transport; Mon, 4 Jan 2021 16:27:24 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:328B16CCED4DA1AA9B743F24851B3A90D0752C7158073C83CBB3E69EDF0B96DF; UpperCasedChecksum:5BBFD745DE8F90A212A0D095C21D44B5EB7D723BB0F6CD793939411E8D857DA9; SizeAsReceived:7763; Count:47 Received: from AM0PR0602MB3410.eurprd06.prod.outlook.com ([fe80::60c8:86c2:bdaa:f0d2]) by AM0PR0602MB3410.eurprd06.prod.outlook.com ([fe80::60c8:86c2:bdaa:f0d2%3]) with mapi id 15.20.3721.024; Mon, 4 Jan 2021 16:27:24 +0000 Subject: Re: [PATCH][gdb/symtab] Remove superfluous end-of-sequence marker To: Tom de Vries , gdb-patches@sourceware.org References: <20210104135927.GA3115@delia> From: Bernd Edlinger Message-ID: Date: Mon, 4 Jan 2021 17:27:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 In-Reply-To: <20210104135927.GA3115@delia> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TMN: [9rF/OZqIaIdHC8oQ6QIDSczg+4Nerdr+] X-ClientProxiedBy: AM8P191CA0020.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::25) To AM0PR0602MB3410.eurprd06.prod.outlook.com (2603:10a6:208:21::24) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (88.68.3.2) by AM8P191CA0020.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20 via Frontend Transport; Mon, 4 Jan 2021 16:27:24 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: aa8fd24d-0e54-4864-cba4-08d8b0cd9e92 X-MS-TrafficTypeDiagnostic: DB8EUR06HT099: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Tc8MAaRo2bQ9xwMY6LgAnU7XEgG0dxaZ5OHTD1HVm9RJ2TzHrUaA1okOxdUGxXWNXlUpvCvI//txDfCa9DiZG0ggq+18TqCmSEZUglw0oOdImCdX+yCe5BzOkUwEeeSdzjmuTp/mnI4+c3m6Hz3JldpriyIj6etIAuY2vUqhiSIFO1zRmfivIUXPX8s7INvRv/X28ksik6EvpszCJWV0Kpb79PHGI3RS6xD8l5l+D/NcsvFhWhky2RdvnmA4tMZ+ X-MS-Exchange-AntiSpam-MessageData: gnhOWggp283Z5NflEkagx/dElpXgGh/etzYAcOfyICruEjMHEYaQvh1m3pvIF/vWLI5T70I1YwYz505r4vyVkTmWb52m3ZNFYdhJkSqSvOmFoZDz43oseMO8aECga3G9PRcr+zVHGfK9K3ejde7wdA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2021 16:27:24.6910 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: aa8fd24d-0e54-4864-cba4-08d8b0cd9e92 X-MS-Exchange-CrossTenant-AuthSource: DB8EUR06FT029.eop-eur06.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR06HT099 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 1/4/21 2:59 PM, Tom de Vries wrote: > Hi, > > While working on PR26935 I noticed that when running test-case > gdb.base/morestack.exp with target board unix/-m32/-fPIE/-pie and ld linker, > I get this linetable fragment for morestack.S using readelf -wL: > ... > CU: ../../../../libgcc/config/i386/morestack.S: > Line number Starting address View Stmt > 109 0xc9c x > ... > 838 0xe03 x > - 0xe04 > > 636 0 x > 637 0x3 x > - 0x4 > ... > but with "maint info line-table" I get: > ... > INDEX LINE ADDRESS IS-STMT > 0 END 0x00000004 Y > 1 109 0x00000c9c Y > ... > 110 838 0x00000e03 Y > 111 END 0x00000e04 Y > ... > > So, apparently the entries with addresses 0x0 and 0x3 are filtered out > because the addresses are out of range, but the same doesn't happen with the > end-of-seq terminator. > > Fix this by filtering out end-of-seq terminators that do not actually > terminate anything. > > Tested on x86_64-linux. > > Any comments? > > Thanks, > - Tom > > [gdb/symtab] Remove superfluous end-of-sequence marker > > gdb/ChangeLog: > > 2021-01-04 Tom de Vries > > * buildsym.c (buildsym_compunit::record_line): Filter out end-of-seq > terminators that do not terminate anything. > > gdb/testsuite/ChangeLog: > > 2021-01-04 Tom de Vries > > * gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: New file. > > --- > gdb/buildsym.c | 8 ++ > .../gdb.dwarf2/dw2-out-of-range-end-of-seq.exp | 94 ++++++++++++++++++++++ > 2 files changed, 102 insertions(+) > > diff --git a/gdb/buildsym.c b/gdb/buildsym.c > index 1d8c579b7b8..245aecf0c38 100644 > --- a/gdb/buildsym.c > +++ b/gdb/buildsym.c > @@ -714,6 +714,14 @@ buildsym_compunit::record_line (struct subfile *subfile, int line, > break; > subfile->line_vector->nitems--; > } > + > + /* Ignore an end-of-sequence marker marking an empty sequence. */ > + struct linetable_entry *last > + = (subfile->line_vector->nitems == 0 > + ? nullptr > + : &subfile->line_vector->item[subfile->line_vector->nitems - 1]); > + if (last == nullptr || last->line == 0) > + return; > } > What you want to achieve here can probably be done more easily this way: diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 1d8c579..dda83f7 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -710,6 +710,8 @@ struct blockvector * while (subfile->line_vector->nitems > 0) { e = subfile->line_vector->item + subfile->line_vector->nitems - 1; + if (e->line == 0) + return; if (e->pc != pc) break; subfile->line_vector->nitems--; I wonder however where the out-of-range line entries are filtered away. Would it be better to filter the end of sequence markers there? Bernd.