From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A89CB3858C53 for ; Mon, 17 Apr 2023 17:38:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A89CB3858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681753121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VNPn+UBIWDRoxqCjILP3lm8RrQP6egxlTEVILdGgOL4=; b=iX5vTTRFjGl0YuCVxjWgVWAvVnuKjBOUE3cbe0CXwMcfBBOjVVCIEsdY56Sz3sbkW8U/K4 z3SHlgM1U+InYnFS9IN0R4qRK/vsfH1VGg5L53qq/qqVC8iQudH+FIdsQMZONPr4Nh439z o6CRKtoOeMtwM2T0kWMBdw+dO1GKmbs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-214-g4rplB-YPkGa9DVjo5Fycw-1; Mon, 17 Apr 2023 13:38:40 -0400 X-MC-Unique: g4rplB-YPkGa9DVjo5Fycw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C2B728828C1; Mon, 17 Apr 2023 17:38:39 +0000 (UTC) Received: from [10.2.16.139] (unknown [10.2.16.139]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77F36492B0C; Mon, 17 Apr 2023 17:38:39 +0000 (UTC) Message-ID: <901e6d84-2476-9108-b79c-0a3747d02b2f@redhat.com> Date: Mon, 17 Apr 2023 10:38:38 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] gdb: Fix false match issue in skip_prologue_using_linetable To: WANG Rui , gdb-patches@sourceware.org References: <20230417162428.48426-1-r@hev.cc> From: Keith Seitz In-Reply-To: <20230417162428.48426-1-r@hev.cc> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 4/17/23 09:24, WANG Rui wrote: > We should exclude matches to the ending PC to prevent false matches with the > next function, as prologue_end is located at the end PC. > > : > 0x00: ... <-- start_pc > 0x04: ... > 0x08: ... <-- breakpoint > 0x0c: ret > : > 0x10: ret <-- end_pc | prologue_end of fun2 Thank you for the patch. Indeed, my recollection is that we always record/search for pc's in [start, end). find_pc_partial_function seems to concur. > --- > gdb/symtab.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/symtab.c b/gdb/symtab.c > index f2b1a14e006..a662d7d1869 100644 > --- a/gdb/symtab.c > +++ b/gdb/symtab.c > @@ -3735,7 +3735,7 @@ skip_prologue_using_linetable (CORE_ADDR func_addr) > }); > > for (; > - it < linetable->item + linetable->nitems && it->pc <= end_pc; > + it < linetable->item + linetable->nitems && it->pc < end_pc; > it++) > if (it->prologue_end) > return {it->pc}; This appears to be against gdb 13 and will need to be rebased. I have regression tested this on x86_64 and found nothing of concern. [The patch which introduced this function contained a test case, gdb.dwarf2/dw2-prologue-end.exp, and that test also shows no regressions.] I have to ask, though, is there a way to write a test case for this? Maybe by using dw2-prologue-end.exp as an example? Keith