From: Yao Qi Date: Fri, 14 Nov 2014 00:53:09 +0000 (+0800) Subject: Fix dw2-ifort-parameter.exp fail with clang X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=646da0594c91719ef591d8736865a1d58fbbfc34;p=binutils-gdb.git Fix dw2-ifort-parameter.exp fail with clang 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-11-14 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 378826d7ad2..ce9c8192c0f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2014-11-14 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. + 2014-11-14 Yao Qi * gdb.dwarf2/implptr-optimized-out.exp (Dwarf::assemble): diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c index 44748147679..4918d7e76c7 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 026e071e7c1..85a6ddd4cf1 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}