From patchwork Sat Oct 25 00:12:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 3368 Received: (qmail 19614 invoked by alias); 25 Oct 2014 00:18:07 -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 19519 invoked by uid 89); 25 Oct 2014 00:18:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 25 Oct 2014 00:18:05 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1Xhp3S-0004qW-CX from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 24 Oct 2014 17:18:02 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.181.6; Fri, 24 Oct 2014 17:18:01 -0700 From: Yao Qi To: Subject: [PATCH 6/6] Fix dw2-ifort-parameter.exp fail with clang Date: Sat, 25 Oct 2014 08:12:48 +0800 Message-ID: <1414195968-3333-7-git-send-email-yao@codesourcery.com> In-Reply-To: <1414195968-3333-1-git-send-email-yao@codesourcery.com> References: <1414195968-3333-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes The patch fixed dw2-ifort-parameter.exp on powerpc64 by adding some labels to get the start and end address of function func. This should also fix the fail on thumb mode, however, this style is quite specific to gcc, and other compiler, such as clang, may not guarantee the order of global asms and functions. The test fails with clang: $ make check RUNTESTFLAGS='dw2-ifort-parameter.exp CC_FOR_TARGET=clang' (gdb) p/x param^M No symbol "param" in current context.^M (gdb) FAIL: gdb.dwarf2/dw2-ifort-parameter.exp: p/x param With this patch applied, dw2-ifort-parameter.exp still passes for gcc on arm thumb mode and popwerpc64, and it also passes for clang on x86_linux. gdb/testsuite: 2014-10-24 Yao Qi * gdb.dwarf2/dw2-ifort-parameter.c: Remove inline asm. (func): Add label func_label. * gdb.dwarf2/dw2-ifort-parameter.exp (Dwarf::assemble): Replace low_pc and high_pc with MACRO_AT_range. Replace name, low_pc and high_pc with MACRO_AT_func. --- gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c | 7 +------ gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp | 8 +++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c index 4474814..4918d7e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c +++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c @@ -18,17 +18,12 @@ int value = 0xdeadf00d; int *ptr = &value; -asm (".section \".text\""); -asm (".balign 8"); -asm ("func_start: .globl func_start"); - static void func (void) { + asm ("func_label: .globl func_label"); } -asm ("func_end: .globl func_end"); - int main (void) { diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp index 026e071..85a6ddd 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp @@ -30,13 +30,13 @@ Dwarf::assemble $asm_file { declare_labels int_label extern func_start func_end ptr + global srcdir subdir srcfile cu {} { compile_unit { {name file1.txt} {language @DW_LANG_C} - {low_pc func_start addr} - {high_pc func_end addr} + {MACRO_AT_range { func ${srcdir}/${subdir}/${srcfile} }} } { int_label: base_type { {name int} @@ -46,9 +46,7 @@ Dwarf::assemble $asm_file { subprogram { {external 1 flag} - {name func} - {low_pc func_start addr} - {high_pc func_end addr} + {MACRO_AT_func { func ${srcdir}/${subdir}/${srcfile} }} } { formal_parameter { {name param}