| # usrthcore.exp -- Expect script to test gdb with user threads |
| # Copyright (C) 1992 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 |
| # the Free Software Foundation; either version 2 of the License, or |
| # (at your option) any later version. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program; if not, write to the Free Software |
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| |
| # Please email any bugs, comments, and/or additions to this file to: |
| # bug-gdb@prep.ai.mit.edu |
| |
| # use this to debug: |
| # |
| #log_user 1 |
| |
| if $tracelevel { |
| strace $tracelevel |
| } |
| |
| if { [skip_hp_tests] } { continue } |
| |
| if { ![istarget "hppa*-*-hpux*"] || [istarget "hppa2.0w-*-*"] } { |
| verbose "HPUX thread test ignored for non-hppa or PA64 targets." |
| return 0 |
| } |
| |
| set testfile usrthcore |
| set srcfile ${srcdir}/${subdir}/${testfile}.c |
| set binfile ${srcdir}/${subdir}/${testfile} |
| |
| # To build the executable we need to link against the thread library. |
| # |
| # /opt/ansic/bin/cc -Ae +DAportable -g -o usrthcore -lcma usrthcore.c |
| # |
| ## we have trouble building it on 11.0, so we use the prebuilt |
| ## executable instead. |
| ## |
| ##if { [gdb_compile "${srcdir}/${subdir}/${testfile}.c -lcma" "${binfile}" executable {debug additional_flags=-Ae ldflags=-lcma}] != "" } { |
| ## gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." |
| ##} |
| |
| #========================= |
| # |
| # Test looking at threads in a core file |
| # |
| |
| remote_exec build "rm -f core" |
| remote_exec build "${binfile}" |
| |
| gdb_exit |
| gdb_start |
| gdb_reinitialize_dir $srcdir/$subdir |
| gdb_load ${binfile} |
| gdb_test "core-file core" \ |
| ".*Core was generated by `usrthcore'.*in main.*usrthcore.c:170.*" \ |
| "load corefile" |
| |
| gdb_test "info thread" \ |
| " 4 .*cma__dispatch.*\\* 1 .*in main.*usrthcore.c:170.*" \ |
| "info thread on core file" |
| gdb_test "bt" "#0.*in main.*usrthcore.c:170" "backtrace on active thread" |
| gdb_test "thread 4" ".*Switching to thread 4.*cma__dispatch.*" \ |
| "switch to thread 4 (thread2 procedure)" |
| gdb_test "bt" "#0.*cma__dispatch.*thread2.*usrthcore.c:99.*" \ |
| "Backtrace on inactive thread (thread2 procedure)" |
| gdb_test "b thread1" "Breakpoint 1.*usrthcore.c, line 75.*" \ |
| "break on thread1" |
| gdb_test "run" "Starting program.*Breakpoint 1, thread1.*usrthcore.c:75.*" \ |
| "run program, get to thread1 procedure" |
| gdb_test "info threads" "\\* \[23\] .*thread1.* 1 .*cma__dispatch.*" \ |
| "info threads after running core" |
| |
| |
| # Done! |
| # |
| gdb_exit |
| |
| remote_exec build "rm -f core" |
| |
| return 0 |