From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067087.outbound.protection.outlook.com [40.92.67.87]) by sourceware.org (Postfix) with ESMTPS id B39D9388700B for ; Thu, 9 Apr 2020 01:35:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B39D9388700B 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=dSWr2fbEcxFuRBXscoz4moIt7n73OT3AdiZF7xoACPmv4M4lovFfN7gBOwEUzfzKbx82KuCT6024wBkiTidbanr8BuCbyJAR5peaH73zZTeuxZ1DkdBY5kwDW32GDXAgV26+LPBrfsO9QRCvbvfvZRsE3SNVme/KRoKseZgLyqwS1fTxshC6oRBlirM60ZcQ+IGRuiEARnfgXAL0fI+BJzMIPJ/8w63I/LxU8KiPoF6x2CVBph/dhrhe33iAn040Q5knIu4GlkxijRZehO4FDpsk/ifgEfEq/P5ax4+v2C60a1eqsRIp7gsYbpWZfv5Qfs0VUOwVEVn4uUyol5rpAw== 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=XYNhs02iTm7x9IPYbzBIwD0M/n35DefQEivzJDOGBnY=; b=QNSkLHUVDO1nzuwSqZczSpiphC8s0/yKb2p3oikf+iYttNwtHglQKOKl7hYrJRApgPbAY2O7OBq8ltZPF61mvAFZVnTTA6m1i65kPEvb4gwEJTLPnwnV94OkyTox448N62fWY2a2p+VOndgxemHjfJ9V55/+X+fDSLkm7MZAYS15f09DLJiZZHVn/X3DYu/pZrP5p4aQz1gbyef6Ida07nrAcIZEdKXsRg7QsEnzpgNkqNQsQ+qBPoEB2yx/x7nfwH9Jp3RVM2XNE/mjIRwZZ3Qfb1ew6ScMmvoqUz3Cy0HjJ6lR81o+vyE35rBv2nspGmMeaGzmcTdOgdwpe6XmfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hotmail.de; dmarc=pass action=none header.from=hotmail.de; dkim=pass header.d=hotmail.de; arc=none Received: from AM5EUR02FT016.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::44) by AM5EUR02HT119.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::386) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15; Thu, 9 Apr 2020 01:35:19 +0000 Received: from AM6PR03MB5170.eurprd03.prod.outlook.com (2a01:111:e400:7e1c::46) by AM5EUR02FT016.mail.protection.outlook.com (2a01:111:e400:7e1c::90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Thu, 9 Apr 2020 01:35:19 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:4B04C7EE0A5F99ABBAEAE9299F416757BFB98354DBC05FDA74D3ACF435D66B4E; UpperCasedChecksum:16F57EC03A0EAEC3B04D980E34F4B3E653C496ECF99A275CDE53E15A18AE191F; SizeAsReceived:7878; Count:47 Received: from AM6PR03MB5170.eurprd03.prod.outlook.com ([fe80::d57:5853:a396:969d]) by AM6PR03MB5170.eurprd03.prod.outlook.com ([fe80::d57:5853:a396:969d%7]) with mapi id 15.20.2878.022; Thu, 9 Apr 2020 01:35:19 +0000 To: "gdb-patches@sourceware.org" , Andrew Burgess , Tom Tromey From: Bernd Edlinger Subject: [PATCH] Partially revert my UB fix in record_line Message-ID: Date: Thu, 9 Apr 2020 03:35:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AM0PR10CA0046.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::26) To AM6PR03MB5170.eurprd03.prod.outlook.com (2603:10a6:20b:ca::23) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (92.77.140.102) by AM0PR10CA0046.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.17 via Frontend Transport; Thu, 9 Apr 2020 01:35:18 +0000 X-Microsoft-Original-Message-ID: X-TMN: [NbW2k3ozdlL6Et/9byMr7DcvRHD693Mm] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: d2d893bf-924c-4d6c-98bd-08d7dc264317 X-MS-TrafficTypeDiagnostic: AM5EUR02HT119: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xsjqUe6N1myRSrBrtSne6rLqCJ0wyeKyJ0+AwAninvvvX6GnFuZS5wkv8bC981gQdQdYw5bMC1VmceYQnxPW0i9C/IHHdei4o96Vvjf3Og/dVFDspkLkeXF2IcFDOjbXl9cHqUI2ewroMNKzsLbsxMEsZN3z0OMS0Ck3N4qY9CV0HFlFkZYjAJGybN85YbVM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:0; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR03MB5170.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:; DIR:OUT; SFP:1901; X-MS-Exchange-AntiSpam-MessageData: zmXGbR6SCNAFJeGFcrMIaZIPvOoOhnL4aHqAec1WcF89rgxRaHK9rC2ETRpgkOHY2V4qt0krO31ffcP+nPzrkb7JiIqplbV66yPWoo0x4mhpufoIrw4AuFH+WZ0z9dwRZZ+Q665zKQrILd9WOXOPig== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2d893bf-924c-4d6c-98bd-08d7dc264317 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2020 01:35:19.2709 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT119 X-Spam-Status: No, score=-17.2 required=5.0 tests=BAYES_00, FORGED_MUA_MOZILLA, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 09 Apr 2020 01:35:22 -0000 This reverts the following commit partially: commit 64dc2d4bd24ff7119c913fff91184414f09b8042 Author: Bernd Edlinger Date: Thu Mar 12 11:52:34 2020 +0100 Fix an undefined behavior in record_line Additionally do not completely remove symbols at the same PC than the end marker, instead make them non-is-stmt breakpoints. We keep the undefined behavoir fix, but have to restore the original behavior regarding deletion of the line entries. 2020-04-09 Bernd Edlinger revert partially: 2020-04-01 Bernd Edlinger * buildsym.c (record_line): Fix undefined behavior and preserve lines at eof. --- gdb/buildsym.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index fe07103..c08c476 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -691,29 +691,28 @@ struct blockvector * * sizeof (struct linetable_entry)))); } - /* The end of sequence marker is special. We need to reset the - is_stmt flag on previous lines at the same PC, otherwise these - lines may cause problems since they might be at the same address - as the following function. For instance suppose a function calls - abort there is no reason to emit a ret after that point (no joke). - So the label may be at the same address where the following - function begins. A similar problem appears if a label is at the - same address where an inline function ends we cannot reliably tell - if this is considered part of the inline function or the calling - program or even the next inline function, so stack traces may - give surprising results. Expect gdb.cp/step-and-next-inline.exp - to fail if these lines are not modified here. */ - if (line == 0 && subfile->line_vector->nitems > 0) + /* Normally, we treat lines as unsorted. But the end of sequence + marker is special. We sort line markers at the same PC by line + number, so end of sequence markers (which have line == 0) appear + first. This is right if the marker ends the previous function, + and there is no padding before the next function. But it is + wrong if the previous line was empty and we are now marking a + switch to a different subfile. We must leave the end of sequence + marker at the end of this group of lines, not sort the empty line + to after the marker. The easiest way to accomplish this is to + delete any empty lines from our table, if they are followed by + end of sequence markers. All we lose is the ability to set + breakpoints at some lines which contain no instructions + anyway. */ + if (line == 0) { - e = subfile->line_vector->item + subfile->line_vector->nitems; - do + while (subfile->line_vector->nitems > 0) { - e--; - if (e->pc != pc || e->line == 0) + e = subfile->line_vector->item + subfile->line_vector->nitems - 1; + if (e->pc != pc) break; - e->is_stmt = 0; + subfile->line_vector->nitems--; } - while (e > subfile->line_vector->item); } e = subfile->line_vector->item + subfile->line_vector->nitems++; -- 1.9.1