* gdb.base/relocate.exp: Test add-symbol-file with a variable
authorDaniel Jacobowitz <drow@false.org>
Sun, 22 Jun 2003 18:32:38 +0000 (18:32 +0000)
committerDaniel Jacobowitz <drow@false.org>
Sun, 22 Jun 2003 18:32:38 +0000 (18:32 +0000)
offset.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/relocate.exp

index bc295240677e7c6075f032109ec2ba5f05b6bebb..8a1a41141f6ae38dad0bbfd4c229e67e43fb904a 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
+
+       * gdb.base/relocate.exp: Test add-symbol-file with a variable
+       offset.
+
 2003-06-22  Daniel Jacobowitz  <drow@mvista.com>
 
        * gdb.c++/pr-1210.cc: New file.
index bcaa48adbc2e0f0fbb04f3aa29c5ae950f06e0f5..8d8ff90bc9e5e28964bba641ea34bb0e05acac25 100644 (file)
@@ -105,4 +105,30 @@ if { "${function_foo_addr}" == "${function_bar_addr}" } {
   pass "functions have different addresses"
 }
 
+# Now use a variable as an offset to add-symbol-file, and check that
+# the functions' addresses change.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_test "set \$offset = 0x10000" ""
+
+# Load the object file.
+gdb_test "add-symbol-file ${binfile} \$offset" \
+       "Reading symbols from .*${testfile}\\.o\\.\\.\\.done\\." \
+       "add-symbol-file ${testfile}.o \$offset" \
+       "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = 0x10000\[\r\n\]+\\(y or n\\) " \
+       "y"
+
+# Print the addresses of functions.
+set new_function_foo_addr [get_var_address function_foo]
+
+# Make sure they have different addresses.
+if { "${function_foo_addr}" == "${new_function_foo_addr}" } {
+  fail "function foo has a different address"
+} else {
+  pass "function foo has a different address"
+}
+
 return 0
This page took 0.030244 seconds and 4 git commands to generate.