From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eO2gNdh0FmCbYgAAWB0awg (envelope-from ) for ; Sun, 31 Jan 2021 04:14:00 -0500 Received: by simark.ca (Postfix, from userid 112) id D99921EF80; Sun, 31 Jan 2021 04:14:00 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=FORGED_MUA_MOZILLA, FREEMAIL_FROM,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [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 76C891E945 for ; Sun, 31 Jan 2021 04:14:00 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F01D385803C; Sun, 31 Jan 2021 09:14:00 +0000 (GMT) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075020.outbound.protection.outlook.com [40.92.75.20]) by sourceware.org (Postfix) with ESMTPS id 2E08B385803C for ; Sun, 31 Jan 2021 09:13:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2E08B385803C 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=IbCsz8oxD37DQagIev17Z4/FI4TKbxcqyLxveEHJwlJzSzWCqKY/RdIwGo7BY+2qF7n1zUMGCXjZF1mo4PY0UBq30TfAsbTNmD9WWd2ftEloSD1pp87308ZMfFx2RHsvEZA60GLPqlvl9a7ThvRrA41GFhas8crkNwvudQjr7QIN5ymCRs23LFpGF/RX7iDwkRt/To0iZ6nIJANb3HcPAHLPhfVLfpSAFT/bpfGwSutqq80dGTGVuYLdRhNg3Mpx3AlmI1tHo0keXAcFkK2yu/xjKq5YKQ4pkDi0K+KH/AAoixWlzmMhnWr3blGEO2qItcID5qqwsyrughG+EeYBNQ== 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=DliauJEBOEIuI31yMuWUHqildGBiZkToHP2amTI8aag=; b=K4V2cTfeY+YhCtwzbS6/R7g74DIBAaqffYvRcPrX8UDtgAGdfevSfoK5LN8OZk39HXWcAcDAXOWVJyXHncYmv4gEH0kcmN83d9wo9RkBBoiwqzRg4tUArqyXLznrWKBnXX/sXvs8G1iJEy+2GjUY+bYtv2MxL2639WQ08GSPBspXNQgkVifCqjC1xVXjW3bG5phHxOy8mFmvnxPVdhHfjvNvVHQj5sfF8lAGnPZXSRhq0X5CxLnOdqxGPNrgQmgyKHsaGEOOZWnDXDvJEcXNvg3elz/76EVaFyLFc86glXlqdKY23VysE3mE8BjkFWT/Ywf2DSvkQE9D9G0ft3KQ2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from HE1EUR04FT064.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::47) by HE1EUR04HT134.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::194) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11; Sun, 31 Jan 2021 09:13:55 +0000 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2a01:111:e400:7e0d::42) by HE1EUR04FT064.mail.protection.outlook.com (2a01:111:e400:7e0d::226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Sun, 31 Jan 2021 09:13:55 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E3D5579FD418BA90335D030CD828E62EA5BB9547751E0CDECEEE101BB9964F39; UpperCasedChecksum:9BB409D0F9EE85BABB11654D426DE868BC3CB62A53A3BC9DB54D98C946B96E82; SizeAsReceived:7640; Count:45 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::7510:8a00:1c00:1147]) by AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::7510:8a00:1c00:1147%5]) with mapi id 15.20.3805.024; Sun, 31 Jan 2021 09:13:55 +0000 From: Bernd Edlinger Subject: [PATCH 4/4] Skip .cold functions in search_minsyms_for_name To: "gdb-patches@sourceware.org" Message-ID: Date: Sun, 31 Jan 2021 10:13:54 +0100 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-TMN: [Fvlrqq67F7ULFf/u3JHwQDMl5iC6bW2s] X-ClientProxiedBy: AM3PR04CA0128.eurprd04.prod.outlook.com (2603:10a6:207::12) To AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:364::23) X-Microsoft-Original-Message-ID: <8736b7ed-a358-2bd6-ba68-4a072903eaf5@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (88.68.3.2) by AM3PR04CA0128.eurprd04.prod.outlook.com (2603:10a6:207::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17 via Frontend Transport; Sun, 31 Jan 2021 09:13:54 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 9f502315-4744-4349-c817-08d8c5c888a4 X-MS-TrafficTypeDiagnostic: HE1EUR04HT134: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EpsPB2I996zp986FDd7iDSRwBeFFTQ0vEWZlHLmg1tCaU/+q1fAax6kNyTQhimbGxI77DbStUrDVyzFTf/+7O2ZTfKPZK7U+G5t/PwZwYe/WGencoDlpXuwndWCsyAQ/v+fnaItQVGK4rdmzyFE8UoD4ayEVjyBVY0l9lcf6QDyi7R+xnJMldIIlERzBhc0Jv/WsU8bM4JqrBQ10tyBMD6b2bFwpxQA+JeaZmG7wAFvqezS0KW/bUsvy9D0PHGzl0C7TutuRolmzieuQB5tVL/299/Tjryg8nlzQWeEGmz44r4nP+CvD/6oUpTXu+3H91D1cqPxXVWg+rlTXgTq3gb/9ODp5/h2ICEpLoTJ1zFbRPuOJlzqLz9f4RiFY2OJEHyWrq0CVDW2frg1izKfZYtizu6MrV7gasSsRraj96CkhSM0FTqun4+b1btZBEj4M X-MS-Exchange-AntiSpam-MessageData: 4LShO4xRjhngaP0xjT4i+OslqS2ctnDerr2LdbhSXZw92ybKm7Xg4OGVoEjizxZuA5K2vvoqFJAiB4ECaNc1XfH8j1ZcaFn/2PdiPJBmEFWXUHrmceqBMHKd+yaPy1kTnyegwx3sso954QuvFuPI8A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f502315-4744-4349-c817-08d8c5c888a4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2021 09:13:55.1528 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT064.eop-eur04.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: HE1EUR04HT134 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" When a function with the same name is also available, that is preferred. The .cold function is not the external interface. Fixes 77f2120b200 ("Don't drop static function bp locations w/o debug info") gdb: 2020-11-30 Bernd Edlinger * linespec.c (search_minsyms_for_name): Filter .cold functions when a real function with the same name is found. gdb/testsuite: 2020-11-30 Bernd Edlinger * gdb.cp/step-and-next-inline-1.exp: New test. --- gdb/linespec.c | 24 ++++++++++++++++++++ gdb/testsuite/gdb.cp/step-and-next-inline-1.exp | 30 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 gdb/testsuite/gdb.cp/step-and-next-inline-1.exp diff --git a/gdb/linespec.c b/gdb/linespec.c index a9809a5..37feaed 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -4394,6 +4394,30 @@ class symtab_collector break; } } + else if (MSYMBOL_TYPE (item.minsym) == mst_file_text + && strlen (item.minsym->linkage_name ()) > 5) + { + size_t namelen = strlen (item.minsym->linkage_name ()) - 5; + if (memcmp (item.minsym->linkage_name () + namelen, ".cold", 5) == 0) + for (const bound_minimal_symbol &item2 : minsyms) + { + if (&item2 == &item) + continue; + + if (MSYMBOL_TYPE (item2.minsym) != mst_file_text + && MSYMBOL_TYPE (item2.minsym) != mst_text) + continue; + + if (strlen (item2.minsym->linkage_name ()) == namelen + && memcmp (item.minsym->linkage_name (), + item2.minsym->linkage_name (), namelen) != 0) + continue; + + /* found a real function with the same name as cold part. */ + skip = true; + break; + } + } if (!skip) info->result.minimal_symbols->push_back (item); diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline-1.exp b/gdb/testsuite/gdb.cp/step-and-next-inline-1.exp new file mode 100644 index 0000000..02200a4 --- /dev/null +++ b/gdb/testsuite/gdb.cp/step-and-next-inline-1.exp @@ -0,0 +1,30 @@ +# Copyright 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +standard_testfile step-and-next-inline.cc + +if [get_compiler_info "c++"] { + unsupported "couldn't find a valid c++ compiler" + return -1 +} + +set options {c++ debug nowarnings optimize=-O2} +if { [prepare_for_testing "failed to prepare" $testfile $srcfile $options] } { + return -1 +} + +# Test that b get_alias_set sets only one breakpoint, +# thus get_alias_set.cold is filtered away. +gdb_test "b get_alias_set" ".*Breakpoint .*$srcfile, line .*" "test1" -- 1.9.1