X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.base%2Frelocate.exp;h=77f6a8815939e5be429208f67522d2ef1ad08af5;hb=d4d429d589c4d6a4450146fbcac8e1aad445114d;hp=89f2fffcd9c8fd566fd681e9a80ba93e6485823f;hpb=39b27ab6ae77d4fe1735417f2de90eada658dc6b;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp index 89f2fffcd9..77f6a88159 100644 --- a/gdb/testsuite/gdb.base/relocate.exp +++ b/gdb/testsuite/gdb.base/relocate.exp @@ -196,6 +196,30 @@ if { "${function_foo_addr}" == "${new_function_foo_addr}" } { pass "function foo has a different address" } +# Load the object using symbol-file with an offset and check that +# all addresses are moved by that offset. + +set offset 0x10000 +clean_restart +gdb_test "symbol-file -o $offset $binfile" \ + "Reading symbols from ${binfile}\.\.\.done\." \ + "symbol-file with offset" + +# Make sure the address of a static variable is moved by offset. +set new_static_foo_addr [get_var_address static_foo] +gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \ + "static variable foo is moved by offset" + +# Make sure the address of a global variable is moved by offset. +set new_global_foo_addr [get_var_address global_foo] +gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \ + "global variable foo is moved by offset" + +# Make sure the address of a function is moved by offset. +set new_function_foo_addr [get_var_address function_foo] +gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \ + "function foo is moved by offset" + # Now try loading the object as an exec-file; we should be able to print # the values of variables after we do this.