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