| 1 | # Copyright (C) 2013-2014 Free Software Foundation, Inc. |
| 2 | |
| 3 | # This program is free software; you can redistribute it and/or modify |
| 4 | # it under the terms of the GNU General Public License as published by |
| 5 | # the Free Software Foundation; either version 3 of the License, or |
| 6 | # (at your option) any later version. |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, |
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | # GNU General Public License for more details. |
| 12 | # |
| 13 | # You should have received a copy of the GNU General Public License |
| 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | |
| 16 | standard_testfile info-threads-cur-sal.c info-threads-cur-sal-2.c |
| 17 | |
| 18 | set executable ${testfile} |
| 19 | |
| 20 | if {[gdb_compile_pthreads \ |
| 21 | "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" \ |
| 22 | "${binfile}" executable {debug}] != "" } { |
| 23 | return -1 |
| 24 | } |
| 25 | |
| 26 | clean_restart ${executable} |
| 27 | |
| 28 | if ![runto_main] { |
| 29 | return -1 |
| 30 | } |
| 31 | |
| 32 | gdb_breakpoint "start" |
| 33 | gdb_continue_to_breakpoint "start" |
| 34 | |
| 35 | set line [gdb_get_line_number "should show this line" "${srcfile2}"] |
| 36 | |
| 37 | gdb_test "list $line" \ |
| 38 | "\"list\" should show this line.*" \ |
| 39 | "list before info threads" |
| 40 | |
| 41 | # There used to be a bug where "info threads" would set the current |
| 42 | # SAL to the location of the last thread displayed. |
| 43 | gdb_test "info threads" \ |
| 44 | "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \ |
| 45 | "info threads before break" |
| 46 | |
| 47 | # Check that "break" is still operating on the same file by default. |
| 48 | gdb_test "break $line" ".*${srcfile2}.*" "break on line" |
| 49 | |
| 50 | gdb_test "info threads" \ |
| 51 | "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \ |
| 52 | "info threads before list" |
| 53 | |
| 54 | # And that so is "list". |
| 55 | gdb_test "list $line" \ |
| 56 | "\"list\" should show this line.*" \ |
| 57 | "list after info threads" |