aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/ChangeLog10
-rw-r--r--gdb/testsuite/gdb.trace/entry-values.c8
-rw-r--r--gdb/testsuite/gdb.trace/entry-values.exp85
3 files changed, 25 insertions, 78 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7b490ee..6bbd72b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,15 @@
2014-11-22 Yao Qi <yao@codesourcery.com>
+ * gdb.trace/entry-values.c: Remove asms.
+ (foo): Add foo_label.
+ (bar): Add bar_label.
+ * gdb.trace/entry-values.exp: Remove code computing foo's
+ length and bar's length.
+ (Dwarf::assemble): Invoke function_range for bar and use
+ MACRO_AT_func for foo.
+
+2014-11-22 Yao Qi <yao@codesourcery.com>
+
* gdb.dwarf2/dw2-compdir-oldgcc.S: Define label .Lgcc42_procstart
and .Lgcc43_procstart. Use .Lgcc42_procstart instead of gcc42.
Use .Lgcc43_procstart instead of gcc43.
diff --git a/gdb/testsuite/gdb.trace/entry-values.c b/gdb/testsuite/gdb.trace/entry-values.c
index 11bb739..c0d561a 100644
--- a/gdb/testsuite/gdb.trace/entry-values.c
+++ b/gdb/testsuite/gdb.trace/entry-values.c
@@ -15,23 +15,19 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-asm (".section \".text\"");
-asm (".balign 8");
-asm ("foo_start: .globl foo_start");
-
int
foo (int i, int j)
{
+ asm ("foo_label: .globl foo_label");
return 0;
}
-asm ("bar_start: .globl bar_start");
-
int
bar (int i)
{
int j = 2;
+ asm ("bar_label: .globl bar_label");
return foo (i, j);
}
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index 4838004..1b4d5cd 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -35,44 +35,6 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}1.o
-set foo_length ""
-
-# Calculate the offset of the last instruction from the beginning.
-set test "disassemble foo"
-gdb_test_multiple $test $test {
- -re ".*$hex <\\+($decimal)>:\[^\r\n\]+\r\nEnd of assembler dump\.\r\n$gdb_prompt $" {
- set foo_length $expect_out(1,string)
- pass $test
- }
- -re ".*$gdb_prompt $" {
- fail $test
- # Bail out here, because we can't do the following tests if
- # $foo_length is unknown.
- return -1
- }
-}
-
-# Calculate the size of the last instruction. Single instruction
-# shouldn't be longer than 10 bytes.
-
-set test "disassemble foo+$foo_length,+10"
-gdb_test_multiple $test $test {
- -re ".*($hex) <foo\\+$foo_length>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" {
- set start $expect_out(1,string)
- set end $expect_out(2,string)
-
- set foo_length [expr $foo_length + $end - $start]
- pass $test
- }
- -re ".*$gdb_prompt $" {
- fail $test
- # Bail out here, because we can't do the following tests if
- # $foo_length is unknown.
- return -1
- }
-}
-
-set bar_length ""
set bar_call_foo ""
if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
@@ -85,23 +47,18 @@ if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
set call_insn "call"
}
-# Calculate the offset of the last instruction from the beginning.
+# Calculate the offset of the instruction bar calls foo.
set test "disassemble bar"
gdb_test_multiple $test $test {
- -re ".*$hex <\\+$decimal>:\[ \t\]+$call_insn\[^\r\n\]+\r\n\[ \]+$hex <\\+($decimal)>:" {
+ -re ".*$hex <\\+$decimal>:\[ \t\]+$call_insn\[^\r\n\]+\r\n\[ \]+$hex <\\+($decimal)>:.*$gdb_prompt $" {
set bar_call_foo $expect_out(1,string)
- exp_continue
- }
- -re ".*$hex <\\+($decimal)>:\[^\r\n\]+\r\nEnd of assembler dump\.\r\n$gdb_prompt $" {
- set bar_length $expect_out(1,string)
- pass $test
}
-re ".*$gdb_prompt $" {
fail $test
}
}
-if { [string equal $bar_call_foo ""] || [string equal $bar_length ""] } {
+if { [string equal $bar_call_foo ""] } {
fail "Find the call or branch instruction offset in bar"
# The following test makes no sense if the offset is unknown. We need
# to update the pattern above to match call or branch instruction for
@@ -109,32 +66,18 @@ if { [string equal $bar_call_foo ""] || [string equal $bar_length ""] } {
return -1
}
-# Calculate the size of the last instruction.
-
-set test "disassemble bar+$bar_length,+10"
-gdb_test_multiple $test $test {
- -re ".*($hex) <bar\\+$bar_length>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" {
- set start $expect_out(1,string)
- set end $expect_out(2,string)
-
- set bar_length [expr $bar_length + $end - $start]
- pass $test
- }
- -re ".*$gdb_prompt $" {
- fail $test
- # Bail out here, because we can't do the following tests if
- # $bar_length is unknown.
- return -1
- }
-}
-
gdb_exit
# Make some DWARF for the test.
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
declare_labels int_label foo_label
- global foo_length bar_length bar_call_foo
+ global bar_call_foo
+ global srcdir subdir srcfile
+
+ set bar_result [function_range bar ${srcdir}/${subdir}/${srcfile}]
+ set bar_start [lindex $bar_result 0]
+ set bar_length [lindex $bar_result 1]
cu {} {
compile_unit {{language @DW_LANG_C}} {
@@ -145,10 +88,8 @@ Dwarf::assemble $asm_file {
}
foo_label: subprogram {
- {name foo}
{decl_file 1}
- {low_pc foo_start addr}
- {high_pc "foo_start + $foo_length" addr}
+ {MACRO_AT_func { foo ${srcdir}/${subdir}/${srcfile} }}
} {
formal_parameter {
{type :$int_label}
@@ -165,8 +106,8 @@ Dwarf::assemble $asm_file {
subprogram {
{name bar}
{decl_file 1}
- {low_pc bar_start addr}
- {high_pc "bar_start + $bar_length" addr}
+ {low_pc $bar_start addr}
+ {high_pc "$bar_start + $bar_length" addr}
{GNU_all_call_sites 1}
} {
formal_parameter {
@@ -175,7 +116,7 @@ Dwarf::assemble $asm_file {
}
GNU_call_site {
- {low_pc "bar_start + $bar_call_foo" addr}
+ {low_pc "$bar_start + $bar_call_foo" addr}
{abstract_origin :$foo_label}
} {
# Faked entry values are reference to variables 'global1'