Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <hui_zhu@mentor.com>
To: <gdb-patches@sourceware.org>
Cc: <lgustavo@codesourcery.com>, Pedro Alves <palves@redhat.com>
Subject: Re: [PATCH] Support targets that know how to continue over breakpoints[4/4] -- testsuite
Date: Sun, 03 Mar 2013 02:18:00 -0000	[thread overview]
Message-ID: <5132B2EE.5090501@mentor.com> (raw)
In-Reply-To: <5132256F.2050202@mentor.com>

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

On 03/03/13 00:14, Hui Zhu wrote:
> 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  <hui_zhu@mentor.com>
>
>      * 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.

Because the option "--cob" is changed to "--continue-over-breakpoints".  So I post a new version for that change.

Thanks,
Hui

2013-03-03   Hui Zhu  <hui_zhu@mentor.com>

	* 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.

[-- Attachment #2: remote-cob-test.txt --]
[-- Type: text/plain, Size: 3906 bytes --]

--- 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 <http://www.gnu.org/licenses/>.  */
+
+#include <pthread.h>
+
+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 <http://www.gnu.org/licenses/>.
+
+# 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 " --continue-over-breakpoints"
+	}
+
 	if { $options != "" } {
 	    append gdbserver_command " $options"
 	}

  reply	other threads:[~2013-03-03  2:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-02 16:09 [PATCH] Support targets that know how to continue over breakpoints[1/4] -- GDB Hui Zhu
2013-03-02 16:11 ` [PATCH] Support targets that know how to continue over breakpoints[2/4] -- Doc Hui Zhu
2013-03-02 16:13   ` [PATCH] Support targets that know how to continue over breakpoints[3/4] -- gdbserver Hui Zhu
2013-03-02 16:14     ` [PATCH] Support targets that know how to continue over breakpoints[4/4] -- testsuite Hui Zhu
2013-03-03  2:18       ` Hui Zhu [this message]
2013-03-24 14:45         ` Hui Zhu
2013-05-07  2:46           ` Hui Zhu
2013-03-12 10:05       ` Hui Zhu
2013-03-02 16:20     ` [PATCH] Support targets that know how to continue over breakpoints[3/4] -- gdbserver Eli Zaretskii
2013-03-03  2:15       ` Hui Zhu
2013-03-24 14:10         ` Hui Zhu
2013-03-25  3:46           ` Eli Zaretskii
2013-03-25  8:06             ` Hui Zhu
2013-05-07  2:45           ` Hui Zhu
2013-03-12 10:05     ` Hui Zhu
2013-03-02 16:19   ` [PATCH] Support targets that know how to continue over breakpoints[2/4] -- Doc Eli Zaretskii
2013-03-03  2:06     ` Hui Zhu
2013-03-03  3:51       ` Eli Zaretskii
2013-03-03  3:58         ` Hui Zhu
2013-03-12 10:04   ` Hui Zhu
2013-05-07  2:37     ` Hui Zhu
2013-03-12 10:04 ` [PATCH] Support targets that know how to continue over breakpoints[1/4] -- GDB Hui Zhu
2013-03-24 12:33 ` Hui Zhu
2013-05-07  2:35   ` Hui Zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5132B2EE.5090501@mentor.com \
    --to=hui_zhu@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox