return -1
}
-# Start GDB and load object file, compute the function length and
-# the offset of branch instruction in function. They are needed
-# in the Dwarf Assembler below.
+# Start GDB and load object file, compute the offset of the
+# instruction in bar returned from foo. It is needed in the Dwarf
+# Assembler.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}1.o
-set bar_call_foo ""
+set returned_from_foo ""
if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
set call_insn "bl"
set call_insn "call"
}
-# Calculate the offset of the instruction bar calls foo.
+# Calculate the offset of the instruction in bar returned from foo.
set test "disassemble bar"
gdb_test_multiple $test $test {
-re ".*$hex <\\+$decimal>:\[ \t\]+$call_insn\[^\r\n\]+\r\n\[ \]+$hex <\\+($decimal)>:.*$gdb_prompt $" {
- set bar_call_foo $expect_out(1,string)
+ set returned_from_foo $expect_out(1,string)
}
-re ".*$gdb_prompt $" {
fail $test
}
}
-if { [string equal $bar_call_foo ""] } {
+if { [string equal $returned_from_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
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
declare_labels int_label foo_label
- global bar_call_foo
+ global returned_from_foo
global srcdir subdir srcfile
set bar_result [function_range bar ${srcdir}/${subdir}/${srcfile}]
}
GNU_call_site {
- {low_pc "$bar_start + $bar_call_foo" addr}
+ {low_pc "$bar_start + $returned_from_foo" addr}
{abstract_origin :$foo_label}
} {
# Faked entry values are reference to variables 'global1'