From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25979 invoked by alias); 2 Mar 2013 16:14:52 -0000 Received: (qmail 25969 invoked by uid 22791); 2 Mar 2013 16:14:51 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 02 Mar 2013 16:14:46 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UBp5C-0007V4-0R from Hui_Zhu@mentor.com ; Sat, 02 Mar 2013 08:14:46 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sat, 2 Mar 2013 08:14:45 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Sat, 2 Mar 2013 08:14:41 -0800 Message-ID: <5132256F.2050202@mentor.com> Date: Sat, 02 Mar 2013 16:14:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: CC: , Pedro Alves Subject: [PATCH] Support targets that know how to continue over breakpoints[4/4] -- testsuite References: <51322425.6090007@mentor.com> <513224AF.6030603@mentor.com> <51322515.60309@mentor.com> In-Reply-To: <51322515.60309@mentor.com> Content-Type: multipart/mixed; boundary="------------020905060803070906070708" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00057.txt.bz2 --------------020905060803070906070708 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 389 Hello, This patch add a new test cob.exp use the "--cob" that add by prev patch test the continue over breakpoints function of GDB. Thanks, Hui 2013-03-03 Hui Zhu * gdb.server/Makefile.in (EXECUTABLES): Add cob. * gdb.server/cob.c: New file. * gdb.server/cob.exp: New file. * lib/gdbserver-support.exp (gdbserver_start): Add check for gdbserver_use_cob_p. --------------020905060803070906070708 Content-Type: text/plain; charset="us-ascii"; name="remote-cob-test.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="remote-cob-test.txt" Content-length: 3884 --- 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" } --------------020905060803070906070708--