]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.threads/gcore-thread.exp
Reapply: List inferiors/threads/pspaces in ascending order
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / gcore-thread.exp
index 31714c8944bc8dd4d82480202ba2604d338d9bce..f74f147cd3eb8d5f963cdfb05783e4a792a973ca 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2002-2013 Free Software Foundation, Inc.
+# Copyright 2002-2016 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
@@ -55,17 +55,6 @@ set nl "\[\r\n\]+"
 
 set timeout 30
 
-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
-    }
-    -re "Save a core file .*$gdb_prompt $" {
-       pass "help gcore"
-    }
-}
-
 if { ! [ runto_main ] } then {
     untested gcore-thread.exp
     return -1
@@ -125,37 +114,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
     }
 
@@ -165,7 +127,7 @@ foreach name { corefile core0file } { with_test_prefix $name {
     # mapping various OS's may do?  Let's assume that there must
     # be at least two threads:
 
-    gdb_test "info threads" ".*${nl}  2 ${horiz}${nl}\\* 1 .*" \
+    gdb_test "info threads" "\\* 1 ${horiz}${nl}  2 ${horiz}.*" \
            "corefile contains at least two threads"
 
     # One thread in the corefile should be in the "thread2" function.
@@ -175,6 +137,6 @@ foreach name { corefile core0file } { with_test_prefix $name {
 
     # The thread2 thread should be marked as the current thread.
 
-    gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
+    gdb_test "info threads" "\\* ${horiz} thread2 .*${nl}" \
            "thread2 is current thread in corefile"
 }}