Index: gdb/testsuite/gdb.threads/gcore-thread.exp |
diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp |
index 37eadd3864b9561f350f323eddd5242f8a8caf26..b01ecb774703e04560d0a13b7f5887468596ebe6 100644 |
--- a/gdb/testsuite/gdb.threads/gcore-thread.exp |
+++ b/gdb/testsuite/gdb.threads/gcore-thread.exp |
@@ -1,4 +1,4 @@ |
-# Copyright 2002-2004, 2007-2012 Free Software Foundation, Inc. |
+# Copyright 2002-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 |
@@ -59,7 +59,7 @@ gdb_test_multiple "help gcore" "help gcore" { |
-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; |
+ return -1 |
} |
-re "Save a core file .*$gdb_prompt $" { |
pass "help gcore" |
@@ -77,7 +77,7 @@ gdb_test_multiple "info threads" "threads are supported" { |
} |
-re "${nl}$gdb_prompt $" { |
unsupported "gdb does not support threads on this target" |
- return -1; |
+ return -1 |
} |
} |
@@ -91,20 +91,8 @@ delete_breakpoints |
gdb_breakpoint "thread2" |
gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running" |
-set escapedfilename [string_to_regexp $corefile] |
# Drop corefile |
-set core_supported 0 |
-gdb_test_multiple "gcore $corefile" "save a corefile" \ |
-{ |
- -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" { |
- pass "save a corefile" |
- global core_supported |
- set core_supported 1 |
- } |
- -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { |
- unsupported "save a corefile" |
- } |
-} |
+set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"] |
if {!$core_supported} { |
return -1 |
@@ -137,37 +125,10 @@ if {"$core0file" != ""} { |
# Now restart gdb and load the corefile. |
clean_restart ${testfile} |
-proc load_core { corefile } { |
- global gdb_prompt |
- global libthread_db_seen |
- |
- gdb_test_multiple "core $corefile" \ |
- "re-load generated corefile" { |
- -re "\\\[Thread debugging using \[^ \r\n\]* enabled\\\]\r\n" { |
- exp_continue |
- } |
- -re " is not a core dump:.*\r\n$gdb_prompt $" { |
- fail "re-load generated corefile (bad file format)" |
- # No use proceeding from here. |
- return 0; |
- } |
- -re ": No such file or directory.*\r\n$gdb_prompt $" { |
- fail "re-load generated corefile (file not found)" |
- # No use proceeding from here. |
- return 0; |
- } |
- -re "Couldn't find .* registers in core file.*\r\n$gdb_prompt $" { |
- fail "re-load generated corefile (incomplete note section)" |
- } |
- -re "Core was generated by .*\r\n$gdb_prompt $" { |
- pass "re-load generated corefile" |
- } |
- } |
- return 1 |
-} |
- |
foreach name { corefile core0file } { with_test_prefix $name { |
- if ![load_core [subst $$name]] { |
+ set core_loaded [gdb_core_cmd [subst $$name] "re-load generated corefile"] |
+ if { $core_loaded == -1 } { |
+ # No use proceeding from here. |
continue |
} |