a32d62a
Test GCORE on 32bit inferiors on 64bit platforms.
a32d62a
a32d62a
UNSUPPORTED results are valid for `-m64' on 32bit targets.
a32d62a
a32d62a
a32d62a
--- ./gdb/testsuite/gdb.base/gcore.exp	9 Jan 2007 17:59:11 -0000	1.9
a32d62a
+++ ./gdb/testsuite/gdb.base/gcore.exp	23 Apr 2007 19:20:12 -0000
a32d62a
@@ -31,9 +31,14 @@ set testfile "gcore"
a32d62a
 set srcfile  ${testfile}.c
a32d62a
 set binfile  ${objdir}/${subdir}/${testfile}
a32d62a
 
a32d62a
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
a32d62a
-     untested gcore.exp
a32d62a
-     return -1
a32d62a
+# `-static-libgcc' to avoid dependency on `libgcc.{i386,ppc}'.
a32d62a
+foreach additional_flags {{} {-m32 -static-libgcc} {-m64 -static-libgcc}} {
a32d62a
+
a32d62a
+set prefix "arch{$additional_flags}:"
a32d62a
+
a32d62a
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=$additional_flags]] != "" } {
a32d62a
+     unsupported "${prefix} gcore.exp"
a32d62a
+     continue
a32d62a
 }
a32d62a
 
a32d62a
 # Start with a fresh gdb.
a32d62a
@@ -48,23 +52,23 @@ send_gdb "help gcore\n"
a32d62a
 gdb_expect {
a32d62a
     -re "Undefined command: .gcore.*$gdb_prompt $" {
a32d62a
 	# gcore command not supported -- nothing to test here.
a32d62a
-	unsupported "gdb does not support gcore on this target"
a32d62a
-	return -1;
a32d62a
+	unsupported "${prefix} gdb does not support gcore on this target"
a32d62a
+	continue
a32d62a
     }
a32d62a
     -re "Save a core file .*$gdb_prompt $" {
a32d62a
-	pass "help gcore"
a32d62a
+	pass "${prefix} help gcore"
a32d62a
     }
a32d62a
     -re ".*$gdb_prompt $" {
a32d62a
-	fail "help gcore"
a32d62a
+	fail "${prefix} help gcore"
a32d62a
     }
a32d62a
     timeout {
a32d62a
-	fail "help gcore (timeout)"
a32d62a
+	fail "${prefix} help gcore (timeout)"
a32d62a
     }
a32d62a
 }
a32d62a
 
a32d62a
 if { ! [ runto_main ] } then {
a32d62a
-    untested gcore.exp
a32d62a
-    return -1
a32d62a
+    untested "${prefix} gcore.exp"
a32d62a
+    continue
a32d62a
 }
a32d62a
 
a32d62a
 proc capture_command_output { command prefix } {
a32d62a
@@ -78,7 +82,7 @@ proc capture_command_output { command pr
a32d62a
 	    set output_string $expect_out(1,string)
a32d62a
 	}
a32d62a
 	default {
a32d62a
-	    fail "capture_command_output failed on $command."
a32d62a
+	    fail "${prefix} capture_command_output failed on $command."
a32d62a
 	}
a32d62a
     }
a32d62a
     return $output_string
a32d62a
@@ -109,15 +113,15 @@ set pre_corefile_extern_array \
a32d62a
 set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
a32d62a
 
a32d62a
 gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
a32d62a
-	"save a corefile" \
a32d62a
+	"${prefix} save a corefile" \
a32d62a
 {
a32d62a
   -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
a32d62a
-    pass "save a corefile"
a32d62a
+    pass "${prefix} save a corefile"
a32d62a
     global core_supported
a32d62a
     set core_supported 1
a32d62a
   }
a32d62a
   -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
a32d62a
-    unsupported "save a corefile"
a32d62a
+    unsupported "${prefix} save a corefile"
a32d62a
     global core_supported
a32d62a
     set core_supported 0
a32d62a
   }
a32d62a
@@ -125,7 +129,7 @@ gdb_test_multiple "gcore ${objdir}/${sub
a32d62a
 
a32d62a
 global core_supported
a32d62a
 if {!$core_supported} {
a32d62a
-  return -1
a32d62a
+    continue
a32d62a
 }
a32d62a
 
a32d62a
 # Now restart gdb and load the corefile.
a32d62a
@@ -137,31 +141,31 @@ gdb_load ${binfile}
a32d62a
 send_gdb "core ${objdir}/${subdir}/gcore.test\n"
a32d62a
 gdb_expect {
a32d62a
     -re ".* is not a core dump:.*$gdb_prompt $" {
a32d62a
-	fail "re-load generated corefile (bad file format)"
a32d62a
+	fail "${prefix} re-load generated corefile (bad file format)"
a32d62a
 	# No use proceeding from here.
a32d62a
-	return;	
a32d62a
+	continue
a32d62a
     }
a32d62a
     -re ".*: No such file or directory.*$gdb_prompt $" {
a32d62a
-	fail "re-load generated corefile (file not found)"
a32d62a
+	fail "${prefix} re-load generated corefile (file not found)"
a32d62a
 	# No use proceeding from here.
a32d62a
-	return;	
a32d62a
+	continue
a32d62a
     }
a32d62a
     -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
a32d62a
-	fail "re-load generated corefile (incomplete note section)"
a32d62a
+	fail "${prefix} re-load generated corefile (incomplete note section)"
a32d62a
     }
a32d62a
     -re "Core was generated by .*$gdb_prompt $" {
a32d62a
-	pass "re-load generated corefile"
a32d62a
+	pass "${prefix} re-load generated corefile"
a32d62a
     }
a32d62a
     -re ".*$gdb_prompt $" {
a32d62a
-	fail "re-load generated corefile"
a32d62a
+	fail "${prefix} re-load generated corefile"
a32d62a
     }
a32d62a
     timeout {
a32d62a
-	fail "re-load generated corefile (timeout)"
a32d62a
+	fail "${prefix} re-load generated corefile (timeout)"
a32d62a
     }
a32d62a
 }
a32d62a
 
a32d62a
 send_gdb "where\n"
a32d62a
-gdb_expect_list "where in corefile" ".*$gdb_prompt $" {
a32d62a
+gdb_expect_list "${prefix} where in corefile" ".*$gdb_prompt $" {
a32d62a
     ".*\[\r\n\]+#0 .* terminal_func \\(\\) at "
a32d62a
     ".*\[\r\n\]+#1 .* array_func \\(\\) at "
a32d62a
     ".*\[\r\n\]+#2 .* factorial_func \\(value=1\\) at "
a32d62a
@@ -175,61 +179,64 @@ gdb_expect_list "where in corefile" ".*$
a32d62a
 
a32d62a
 set post_corefile_regs [capture_command_output "info registers" ""]
a32d62a
 if ![string compare $pre_corefile_regs $post_corefile_regs] then {
a32d62a
-    pass "corefile restored general registers"
a32d62a
+    pass "${prefix} corefile restored general registers"
a32d62a
 } else {
a32d62a
-    fail "corefile restored general registers"
a32d62a
+    fail "${prefix} corefile restored general registers"
a32d62a
 }
a32d62a
 
a32d62a
 set post_corefile_allregs [capture_command_output "info all-reg" ""]
a32d62a
 if ![string compare $pre_corefile_allregs $post_corefile_allregs] then {
a32d62a
-    pass "corefile restored all registers"
a32d62a
+    pass "${prefix} corefile restored all registers"
a32d62a
 } else {
a32d62a
-    fail "corefile restored all registers"
a32d62a
+    fail "${prefix} corefile restored all registers"
a32d62a
 }
a32d62a
 
a32d62a
 set post_corefile_extern_array \
a32d62a
 	[capture_command_output "print extern_array" "$print_prefix"]
a32d62a
 if ![string compare $pre_corefile_extern_array $post_corefile_extern_array]  {
a32d62a
-    pass "corefile restored extern array"
a32d62a
+    pass "${prefix} corefile restored extern array"
a32d62a
 } else {
a32d62a
-    fail "corefile restored extern array"
a32d62a
+    fail "${prefix} corefile restored extern array"
a32d62a
 }
a32d62a
 
a32d62a
 set post_corefile_static_array \
a32d62a
 	[capture_command_output "print static_array" "$print_prefix"]
a32d62a
 if ![string compare $pre_corefile_static_array $post_corefile_static_array]  {
a32d62a
-    pass "corefile restored static array"
a32d62a
+    pass "${prefix} corefile restored static array"
a32d62a
 } else {
a32d62a
-    fail "corefile restored static array"
a32d62a
+    fail "${prefix} corefile restored static array"
a32d62a
 }
a32d62a
 
a32d62a
 set post_corefile_uninit_array \
a32d62a
 	[capture_command_output "print un_initialized_array" "$print_prefix"]
a32d62a
 if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array]  {
a32d62a
-    pass "corefile restored un-initialized array"
a32d62a
+    pass "${prefix} corefile restored un-initialized array"
a32d62a
 } else {
a32d62a
-    fail "corefile restored un-initialized array"
a32d62a
+    fail "${prefix} corefile restored un-initialized array"
a32d62a
 }
a32d62a
 
a32d62a
 set post_corefile_heap_string \
a32d62a
 	[capture_command_output "print heap_string" "$print_prefix"]
a32d62a
 if ![string compare $pre_corefile_heap_string $post_corefile_heap_string]  {
a32d62a
-    pass "corefile restored heap array"
a32d62a
+    pass "${prefix} corefile restored heap array"
a32d62a
 } else {
a32d62a
-    fail "corefile restored heap array"
a32d62a
+    fail "${prefix} corefile restored heap array"
a32d62a
 }
a32d62a
 
a32d62a
 set post_corefile_local_array \
a32d62a
 	[capture_command_output "print array_func::local_array" "$print_prefix"]
a32d62a
 if ![string compare $pre_corefile_local_array $post_corefile_local_array]  {
a32d62a
-    pass "corefile restored stack array"
a32d62a
+    pass "${prefix} corefile restored stack array"
a32d62a
 } else {
a32d62a
-    fail "corefile restored stack array"
a32d62a
+    fail "${prefix} corefile restored stack array"
a32d62a
 }
a32d62a
 
a32d62a
 set post_corefile_backtrace [capture_command_output "backtrace" ""]
a32d62a
 if ![string compare $pre_corefile_backtrace $post_corefile_backtrace]  {
a32d62a
-    pass "corefile restored backtrace"
a32d62a
+    pass "${prefix} corefile restored backtrace"
a32d62a
 } else {
a32d62a
-    fail "corefile restored backtrace"
a32d62a
+    fail "${prefix} corefile restored backtrace"
a32d62a
+}
a32d62a
+
a32d62a
+# $additional_flags:
a32d62a
 }