From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway31.websitewelcome.com (gateway31.websitewelcome.com [192.185.143.46]) by sourceware.org (Postfix) with ESMTPS id 48C7F3854807 for ; Fri, 6 Aug 2021 23:32:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 48C7F3854807 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tromey.com Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 06639CE324 for ; Fri, 6 Aug 2021 17:20:59 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id C8B8mSM8FrJtZC8B8m2Skz; Fri, 06 Aug 2021 17:18:58 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=e9hNLLPGiMj2K0c3SawXVPN2d+u9Dh48jylZewEU+8A=; b=a6pLsnRyBR8k7kv8+dVFq2Tybt vXDpNQkFYNXDfTF7Ic617b4HzdZWUIYCJgYNwB2s/Ytkj+qqFpZ1A984BEUK+PoNuSL1V1id/Zw1U /jgU0kmxoQAAH6/bKiD0y5R4E; Received: from 97-122-71-26.hlrn.qwest.net ([97.122.71.26]:46166 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mC8B7-002Smw-LH; Fri, 06 Aug 2021 16:18:57 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix a latent bug in dw2-ranges-overlap.exp Date: Fri, 6 Aug 2021 16:18:55 -0600 Message-Id: <20210806221855.4137791-1-tom@tromey.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.71.26 X-Source-L: No X-Exim-ID: 1mC8B7-002Smw-LH X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-71-26.hlrn.qwest.net (localhost.localdomain) [97.122.71.26]:46166 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3030.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 06 Aug 2021 23:32:32 -0000 dw2-ranges-overlap.exp creates a program where a psymtab has two address ranges, and a function without debug info whose address is between these two ranges. Then it sets a breakpoint on this function and runs to it, expecting that the language should remain "auto; c" when stopped. However, this test case also has a "main" function described (briefly) in the DWARF, and this function is given language C++. Also, a breakpoint stop sets the current language to the language that was used when setting the breakpoint. My new DWARF scanner decides that this "main" is the main program and sets the current language to C++ at startup, causing this test to fail. This patch fixes the test in a simple way, by introducing a new function that takes the place of "main" in the DWARF. I think this still exercises the original problem, but also avoids problems with my branch. It seemed safe to me to submit this separately. --- gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c | 9 ++++++++- gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp | 10 +++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c index 5e69e4aa52b..e3d70f471dc 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.c @@ -28,9 +28,16 @@ foo (int a) return bar (a * 2) + 3; } +int +quux (int a) +{ + asm ("quux_label: .globl quux_label"); + return foo (a); +} + int main (void) { asm ("main_label: .globl main_label"); - return foo (5) + 1; + return quux (5) + 1; } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp index 972ab762a27..5da60bf3a33 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp @@ -44,10 +44,10 @@ Dwarf::assemble $asm_file { declare_labels ranges_label # Find start address and length for our functions. - set main_func \ - [function_range main [list ${srcdir}/${subdir}/$srcfile]] set foo_func \ [function_range foo [list ${srcdir}/${subdir}/$srcfile]] + set quux_func \ + [function_range quux [list ${srcdir}/${subdir}/$srcfile]] set bar_func \ [function_range bar [list ${srcdir}/${subdir}/$srcfile]] @@ -59,15 +59,15 @@ Dwarf::assemble $asm_file { } { subprogram { {external 1 flag} - {name main} + {name quux} } } } ranges {is_64 [is_64_target]} { ranges_label: sequence { - base [lindex $main_func 0] - range 0 [lindex $main_func 1] + base [lindex $quux_func 0] + range 0 [lindex $quux_func 1] base [lindex $bar_func 0] range 0 [lindex $bar_func 1] } -- 2.31.1