--- a/gdb/testsuite/gdb.server/Makefile.in +++ b/gdb/testsuite/gdb.server/Makefile.in @@ -1,7 +1,7 @@ VPATH = @srcdir@ srcdir = @srcdir@ -EXECUTABLES = ext-attach ext-run file-transfer server-mon server-run \ +EXECUTABLES = cob ext-attach ext-run file-transfer server-mon server-run \ no-thread-db MISCELLANEOUS = --- /dev/null +++ b/gdb/testsuite/gdb.server/cob.c @@ -0,0 +1,54 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 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 + the Free Software Foundation; either version 3 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, see . */ + +#include + +void +foo (void) +{ +} + +void +bar (void) +{ +} + +void * +thread_function (void *arg) +{ + sleep (2); + foo (); + + return 0; +} + +int +main (int argc, char **argv) +{ + pthread_t thread; + int i; + + pthread_create (&thread, NULL, thread_function, NULL); + bar (); + + for (i = 0; i < 10; i++) + foo (); + + pthread_join (thread, NULL); + + return 0; +} --- /dev/null +++ b/gdb/testsuite/gdb.server/cob.exp @@ -0,0 +1,56 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 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 +# the Free Software Foundation; either version 3 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, see . + +# Test the basic functionality of gdbserver. + +load_lib gdbserver-support.exp + +standard_testfile .c + +if { [skip_gdbserver_tests] } { + return 0 +} + +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" \ + "${binfile}" executable {debug}] == -1} { + return -1 +} + +gdb_exit +gdb_start +gdb_load $binfile + +# Make sure we're disconnected, in case we're testing with an +# extended-remote board, therefore already connected. +gdb_test "disconnect" ".*" + +set gdbserver_use_cob_p 1 +gdbserver_run "" +gdb_reinitialize_dir $srcdir/$subdir + +gdb_breakpoint bar +gdb_test "continue" "Breakpoint.* bar .*" "continue to bar" + +gdb_test "info threads" ".*2 *Thread.*\\* 1 *Thread.*" "info threads before set thread breakpoint, current thread is 1" + +gdb_test_no_output "set debug infrun 1" + +gdb_breakpoint "foo thread 2" +gdb_test "continue" ".*infrun: thread_hop_needed.*infrun: continue over breakpoints.*Breakpoint.* foo .*" "continue to foo" + +gdb_test "info threads" ".*\\* 2 *Thread.*1 *Thread.*" "info threads after continue over breakpoint, current thread is 2" + --- a/gdb/testsuite/lib/gdbserver-support.exp +++ b/gdb/testsuite/lib/gdbserver-support.exp @@ -247,6 +247,11 @@ proc gdbserver_start { options arguments append gdbserver_command " --once" } + global gdbserver_use_cob_p + if {[info exists gdbserver_use_cob_p] && $gdbserver_use_cob_p} { + append gdbserver_command " --cob" + } + if { $options != "" } { append gdbserver_command " $options" }