From patchwork Wed Oct 24 09:04:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 29862 Received: (qmail 81586 invoked by alias); 24 Oct 2018 09:04:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 81408 invoked by uid 89); 24 Oct 2018 09:04:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=enb X-HELO: EUR03-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr30084.outbound.protection.outlook.com (HELO EUR03-AM5-obe.outbound.protection.outlook.com) (40.107.3.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Oct 2018 09:04:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5yeUJwYeotZ0JEDqKLVGicRdZPoBo7bSE4TNi27QG8E=; b=ok0nht28lPmN2qpiUhzv1O/BQ1ElIyNyT7qbQ0XvBfajVH1fOsx4VtGXdiI5kV80RPLphtHhyLXvAIPOmSfTaW+6a75CwfHVhHPM9hakcsks1GPPPowDd+DhCLCHCuhBc+ZTHxtJlO04L/JMU1JJ68B+YFueUsTcw+xwWViz9k8= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.226.148) by DB6PR0802MB2183.eurprd08.prod.outlook.com (10.172.227.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Wed, 24 Oct 2018 09:04:39 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::748a:5f72:2321:bc11]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::748a:5f72:2321:bc11%7]) with mapi id 15.20.1250.028; Wed, 24 Oct 2018 09:04:39 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd , Alan Hayward Subject: [PATCH 2/2] Check for line notes on GCC as well as Clang Date: Wed, 24 Oct 2018 09:04:39 +0000 Message-ID: <20181024090427.22721-2-alan.hayward@arm.com> References: <20181024090427.22721-1-alan.hayward@arm.com> In-Reply-To: <20181024090427.22721-1-alan.hayward@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) MIME-Version: 1.0 X-IsSubscribed: yes i386 and amd64 only skip the prologue using line notes if the compiler is Clang. Also allow this for GCC. With this change we can revert ovldbreak.exp back to only allowing line 49 as the breakpoint for main. Fixes over 50 tests on Ubuntu x86_64. Note: Many other targets do NOT have any Clang/GNU check - they allow any valid result from skip_prologue_using_sal. Maybe that is the better fix here. However, I was erring on the side of caution. gdb/ChangeLog: 2018-10-24 Alan Hayward * amd64-tdep.c (amd64_skip_prologue): Add GNU check. * i386-tdep.c (i386_skip_prologue): Likewise. gdb/testsuite/ChangeLog: 2018-10-24 Alan Hayward * gdb.cp/ovldbreak.exp: Only allow line 49 for main breakpoint. --- gdb/amd64-tdep.c | 7 ++++--- gdb/i386-tdep.c | 7 ++++--- gdb/testsuite/gdb.cp/ovldbreak.exp | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 088542d72b..cda462b5d8 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -2474,12 +2474,13 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) = skip_prologue_using_sal (gdbarch, func_addr); struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr); - /* Clang always emits a line note before the prologue and another - one after. We trust clang to emit usable line notes. */ + /* Clang/GCC always emits a line note before the prologue and another + one after. We trust Clang/GCC to emit usable line notes. */ if (post_prologue_pc && (cust != NULL && COMPUNIT_PRODUCER (cust) != NULL - && startswith (COMPUNIT_PRODUCER (cust), "clang "))) + && (startswith (COMPUNIT_PRODUCER (cust), "clang ") + || startswith (COMPUNIT_PRODUCER (cust), "GNU ")))) return std::max (start_pc, post_prologue_pc); } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index a6994aaf12..73e1c6c420 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1844,12 +1844,13 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) = skip_prologue_using_sal (gdbarch, func_addr); struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr); - /* Clang always emits a line note before the prologue and another - one after. We trust clang to emit usable line notes. */ + /* Clang/GCC always emits a line note before the prologue and another + one after. We trust Clang/GCC to emit usable line notes. */ if (post_prologue_pc && (cust != NULL && COMPUNIT_PRODUCER (cust) != NULL - && startswith (COMPUNIT_PRODUCER (cust), "clang "))) + && (startswith (COMPUNIT_PRODUCER (cust), "clang ") + || startswith (COMPUNIT_PRODUCER (cust), "GNU ")))) return std::max (start_pc, post_prologue_pc); } diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp index f3f329d293..a2f5620ca8 100644 --- a/gdb/testsuite/gdb.cp/ovldbreak.exp +++ b/gdb/testsuite/gdb.cp/ovldbreak.exp @@ -209,7 +209,7 @@ for {set idx 0} {$idx < [llength $overloads]} {incr idx} { # Verify the breakpoints. set bptable "Num\[\t \]+Type\[\t \]+Disp Enb Address\[\t \]+What.*\[\r\n]+" -append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:4\[89\]\[\r\n\]+" +append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\[\r\n\]+" append bptable "\[\t \]+breakpoint already hit 1 time\[\r\n\]+." foreach ovld $overloads { append bptable [format "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" $ovld \