From 161ac41e03a819bc34e8c70a3fd1bc26f43858a2 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Tue, 1 Jul 2014 19:30:54 +0800 Subject: [PATCH] Fix gdb.trace/entry-values.exp for thumb mode We see some fails in gdb.trace/entry-values.exp in thumb mode (-mthumb -march={armv4t,armv7-a}). In thumb mode, the lsb of references to 'foo' and 'bar' in the assembly (produced by dwarf assember) is set, so the generated debug information is incorrect. This patch copies the approach used by [PATCH 4/4] Fix dw2-ifort-parameter.exp on PPC64 https://sourceware.org/ml/gdb-patches/2014-03/msg00202.html to introduce new labels 'foo_start' and 'bar_start' which are about the correct function address (without lsb set). This patch fixes these fails we've seen. gdb/testsuite: 2014-07-08 Yao Qi * gdb.trace/entry-values.c: Define labels 'foo_start' and 'bar_start' at the beginning of functions 'foo' and 'bar' respectively. * gdb.trace/entry-values.exp: Use 'foo_start' and 'bar_start' instead of 'foo' and 'bar'. --- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.trace/entry-values.c | 6 ++++++ gdb/testsuite/gdb.trace/entry-values.exp | 10 +++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1e56a7a..575e0d8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2014-07-02 Yao Qi + + * gdb.trace/entry-values.c: Define labels 'foo_start' and + 'bar_start' at the beginning of functions 'foo' and 'bar' + respectively. + * gdb.trace/entry-values.exp: Use 'foo_start' and 'bar_start' + instead of 'foo' and 'bar'. + 2014-07-08 Markus Metzger * gdb.btrace/segv.exp: New. diff --git a/gdb/testsuite/gdb.trace/entry-values.c b/gdb/testsuite/gdb.trace/entry-values.c index 4f80eb0..11bb739 100644 --- a/gdb/testsuite/gdb.trace/entry-values.c +++ b/gdb/testsuite/gdb.trace/entry-values.c @@ -15,12 +15,18 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +asm (".section \".text\""); +asm (".balign 8"); +asm ("foo_start: .globl foo_start"); + int foo (int i, int j) { return 0; } +asm ("bar_start: .globl bar_start"); + int bar (int i) { diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp index d648bd1..4838004 100644 --- a/gdb/testsuite/gdb.trace/entry-values.exp +++ b/gdb/testsuite/gdb.trace/entry-values.exp @@ -147,8 +147,8 @@ Dwarf::assemble $asm_file { foo_label: subprogram { {name foo} {decl_file 1} - {low_pc foo addr} - {high_pc "foo + $foo_length" addr} + {low_pc foo_start addr} + {high_pc "foo_start + $foo_length" addr} } { formal_parameter { {type :$int_label} @@ -165,8 +165,8 @@ Dwarf::assemble $asm_file { subprogram { {name bar} {decl_file 1} - {low_pc bar addr} - {high_pc "bar + $bar_length" addr} + {low_pc bar_start addr} + {high_pc "bar_start + $bar_length" addr} {GNU_all_call_sites 1} } { formal_parameter { @@ -175,7 +175,7 @@ Dwarf::assemble $asm_file { } GNU_call_site { - {low_pc "bar + $bar_call_foo" addr} + {low_pc "bar_start + $bar_call_foo" addr} {abstract_origin :$foo_label} } { # Faked entry values are reference to variables 'global1' -- 2.7.4