# This testcase is part of GDB, the GNU debugger. # Copyright 2005 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. # Test the remote TCP debug functionality of GDB. # Author: Manoj Iyer load_lib gdbserver-support.exp set testfile "basictest" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } gdb_exit global gdbport set ret [gdbserver_spawn $binfile ""] set gdbport [lindex $ret 1] gdb_start send_gdb "file $binfile \n " gdb_target_cmd "remote" $gdbport send_gdb "list \n" gdb_expect { -re ".*function1.*main.*\{.*printf.*$gdb_prompt $" { pass "list commands can display source code" } timeout { fail "list command failed to display source code" } } gdb_test "br main" "Breakpoint 1.*at.* file .*$srcfile, line \[0-9\]+.*" gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, main.*at .*$srcfile:\[0-9\].*" gdb_test "br function3" "Breakpoint 2.*at.* file .*$srcfile, line \[0-9\]+.*" gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, function3.*at .*$srcfile:\[0-9\].*" send_gdb "backtrace\n" gdb_expect_list "backtrace" ".*$gdb_prompt $" { "#0.*function3.*at .*basictest.c:\[0-9\]+" "#1.*function2.*at .*basictest.c:\[0-9\]+" "#2.*function1.*at .*basictest.c:\[0-9\]+" "#3.*main.*at .*basictest.c:\[0-9\]+" }