From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id BBMVMgTjFmBibAAAWB0awg (envelope-from ) for ; Sun, 31 Jan 2021 12:04:04 -0500 Received: by simark.ca (Postfix, from userid 112) id 7077C1EF80; Sun, 31 Jan 2021 12:04:04 -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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham 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 DD0C81E590 for ; Sun, 31 Jan 2021 12:04:02 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 44AB0385802B; Sun, 31 Jan 2021 17:04:02 +0000 (GMT) Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 6B2C9385802B for ; Sun, 31 Jan 2021 17:03:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6B2C9385802B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x32a.google.com with SMTP id m2so10667441wmm.1 for ; Sun, 31 Jan 2021 09:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=b3UtO2nNWcxT4yRKZB28ZgkzDj2DLWVORalBWzzTvlw=; b=E7y6JhmKu/OE3iDvOwyp3goxVAfGcr1FRP9X3DDdQDXXisd8k7QCKXkUYQ0UglJPBj 8RwJ5+dXSOTzqr2eDORZpYqA73IDqy0aRBnwkAbWdy/MvcqBl1BGyDXYqo5cSy5/Ase7 dVO3IyaO5Wj2prqL/XZJ/SJNjfcGhum5ZNUvLmEbZaxpyuB9QJK3RJryWUHuZpmPwy/U L9PzPqRD9jEKrsp3cHJqj9MMLAaS6+QU4J9DUdniuCjbUtaGeRwV3z1aDdeHcumlk80c P66xiEBJ2f0LOF0c9ZCWQS+qY+xQ7xASxkyDjv6KG71nH89stUJkUwaPZcdIKFjKs7Cu AVfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=b3UtO2nNWcxT4yRKZB28ZgkzDj2DLWVORalBWzzTvlw=; b=QBJcL+6Rjg0eY9U6rWMkcH/NG8Qhpcoo+oXJNMetG4Qq/v/w2HnuVpFTA86VcCC/8P eG77NCp3gPW3TT7wItrPiOPohuLreHXkTpxwWAzwjlHwumTUboWC8t0cG469fqtttNsY 0BRPlgVqdKajQSr1+urjP1r6Kk12pX247glW4DHygqZCn5sIrzzWlN1+8ZsN4ElYPyxF lEE+qrBWngwTyu7ginPKFoXPVwVL+3v7JrYZxP9XZhIAsphnmyNqe/B6cWb7X/v6DgNT omEjCwV60zbs1fDBBVlnojamn2UYmmMcnVTDEdi+cfrIIW/7Usb56WG9LgViDER+iAdW +Gvw== X-Gm-Message-State: AOAM5304O9bQLfBsVwMj8bRBIfQ+RTJCmcIBeGhwZnIxt8im7KeYefth gley0nbgbbwMWZxk+3pRuRqVNLW1iA6iTw== X-Google-Smtp-Source: ABdhPJxofJNYJ40BJhDLUmMlsp8NjYJyIB0OVn1/xVOjyTVRLlD3XU77FSoB02lA2i4zBXaE+yDLMw== X-Received: by 2002:a1c:2d48:: with SMTP id t69mr11393256wmt.124.1612112638198; Sun, 31 Jan 2021 09:03:58 -0800 (PST) Received: from localhost (host86-191-239-31.range86-191.btcentralplus.com. [86.191.239.31]) by smtp.gmail.com with ESMTPSA id n187sm4310825wmf.29.2021.01.31.09.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 09:03:57 -0800 (PST) Date: Sun, 31 Jan 2021 17:03:56 +0000 From: Andrew Burgess To: Bernd Edlinger Subject: Re: [PATCH 4/4] Skip .cold functions in search_minsyms_for_name Message-ID: <20210131170356.GR265215@embecosm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux/5.8.13-100.fc31.x86_64 (x86_64) X-Uptime: 17:01:16 up 53 days, 21:45, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] 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: , Cc: "gdb-patches@sourceware.org" Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" * Bernd Edlinger [2021-01-31 10:13:54 +0100]: > 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") I assume that this last sentence means that there's a bug / oversight with this previous commit. You should explain what this issue with this commit is and how this commit fixes it. For contrast, notice that the commit you reference took ~200 lines to explain the change, while you've given us just 7. A good commit message makes reviewing this a lot easier. Thanks, Andrew > > 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