-# Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
return 0
}
-if $tracelevel then {
- strace $tracelevel
-}
-
#
# This file uses shreloc.c, shreloc1.c and shreloc2.c
#
-set prms_id 0
-set bug_id 0
-
-set workdir ${objdir}/${subdir}
-set testfile "shreloc"
-set libfile1 "shreloc1"
-set libfile2 "shreloc2"
-set srcfile $srcdir/$subdir/$testfile.c
-set lib1src $srcdir/$subdir/$libfile1.c
-set lib2src $srcdir/$subdir/$libfile2.c
-set binfile $objdir/$subdir/$testfile
-set lib1_sl $objdir/$subdir/$libfile1.sl
-set lib2_sl $objdir/$subdir/$libfile2.sl
-
-if [get_compiler_info ${binfile}] {
+
+standard_testfile .c shreloc1.c shreloc2.c
+
+set srcfile $srcdir/$subdir/$srcfile
+set lib1src $srcdir/$subdir/$srcfile2
+set lib2src $srcdir/$subdir/$srcfile3
+set binfile [standard_output_file $testfile]
+set lib1_sl [standard_output_file shreloc1.sl]
+set lib2_sl [standard_output_file shreloc2.sl]
+
+if [get_compiler_info] {
return -1
}
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${workdir}/shreloc
+clean_restart $binfile
gdb_load_shlibs $lib1_sl $lib2_sl
# Load up the shared objects
}
proc get_var_address { var } {
- global gdb_prompt hex
-
- send_gdb "print &${var}\n"
- # Match output like:
- # $1 = (int *) 0x0
- # $5 = (int (*)()) 0
- # $6 = (int (*)()) 0x24 <function_bar>
- gdb_expect {
- -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
+ global gdb_prompt hex
+
+ # Match output like:
+ # $1 = (int *) 0x0
+ # $5 = (int (*)()) 0
+ # $6 = (int (*)()) 0x24 <function_bar>
+
+ gdb_test_multiple "print &${var}" "get address of ${var}" {
+ -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
{
- pass "get address of ${var}"
- if { $expect_out(1,string) == "0" } {
- return "0x0"
- } else {
- return $expect_out(1,string)
- }
+ pass "get address of ${var}"
+ if { $expect_out(1,string) == "0" } {
+ return "0x0"
+ } else {
+ return $expect_out(1,string)
+ }
}
- -re "${gdb_prompt} $"
- { fail "get address of ${var} (unknown output)" }
- timeout
- { fail "get address of ${var} (timeout)" }
- }
- return ""
+ }
+ return ""
}
#
global gdb_prompt
- send_gdb "${command}\n"
-
# Discard output
- gdb_expect {
+ gdb_test_multiple "${command}" "${command}" {
-re ".*\[\r\n]+${gdb_prompt} $" {
return 1
}
return 1
}
-set msymfile "${workdir}/shreloc.txt"
+if [is_remote host] {
+ set msymfile shreloc.txt
+} else {
+ set msymfile [standard_output_file shreloc.txt]
+}
if [send_gdb_discard "maint print msymbols ${msymfile}"] {
if {[check_different "static_var_\[12\]" "${msymfile}"]} {