public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Don Breazeal <donb@codesourcery.com>
To: Pedro Alves <palves@redhat.com>,
	"Breazeal, Don"	<Don_Breazeal@mentor.com>,
	"gdb-patches@sourceware.org"	<gdb-patches@sourceware.org>
Subject: [pushed] Re: [PATCH v2 1/3] Target remote mode fork and exec tests
Date: Mon, 14 Dec 2015 19:29:00 -0000	[thread overview]
Message-ID: <566F189A.6000808@codesourcery.com> (raw)
In-Reply-To: <5666D3E5.1060506@redhat.com>

On 12/8/2015 4:58 AM, Pedro Alves wrote:
> On 12/07/2015 10:14 PM, Don Breazeal wrote:
> 
>> +# In remote mode we cannot use the 'set args' command, and this
>> +# test requires it.
>> +if { [target_info exists gdb_protocol] } then {
>> +    if { [target_info gdb_protocol] == "remote" } then {
>> +	continue
>> +    }
>>  }
>>  
> 
> It looks a little odd to me not to merge that into a single if:
> 
> if { [target_info exists gdb_protocol]
>      && [target_info gdb_protocol] == "remote" } {
>    continue
> }
> 
> 
>>  if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
>> diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.exp b/gdb/testsuite/gdb.threads/fork-plus-threads.exp
>> index 2b34b6c..d5a915b 100644
>> --- a/gdb/testsuite/gdb.threads/fork-plus-threads.exp
>> +++ b/gdb/testsuite/gdb.threads/fork-plus-threads.exp
>> @@ -20,6 +20,14 @@
>>  #
>>  # See https://sourceware.org/bugzilla/show_bug.cgi?id=18600
>>  
>> +# In remote mode, we cannot continue debugging after all
>> +# inferiors have terminated, and this test requires that.
>> +if { [target_info exists gdb_protocol] } then {
>> +    if { [target_info gdb_protocol] == "remote" } then {
>> +	continue
>> +    }
>> +}
> 
> Likewise.

I made both of the changes suggested above.

> 
> In any case, this is OK.
> 
> Thanks,
> Pedro Alves
> 
This is now pushed.  The updated patch is attached.

From: Don Breazeal <donb@codesourcery.com>
Subject: [pushed][PATCH v3 1/3] Target remote mode fork and exec tests

This is the version of the patch that was pushed.  This version is
identical to v2 except for changing:

if { [target_info exists gdb_protocol] } then {
    if { [target_info gdb_protocol] == "remote" } then {
	continue
    }
}

to

if { [target_info exists gdb_protocol]
     && [target_info gdb_protocol] == "remote" } {
   continue
}

in gdb.base/foll-exec-mode.exp and gdb.threads/fork-plus-threads.exp.

Here is the commit message:

This patch updates tests for fork and exec events in target remote mode.
In the majority of cases this was a simple matter of removing some code
that disabled the test for target remote.  In a few cases the test needed
to be disabled; in those cases the gdb_protocol was checked instead of
using the [is_remote target] etc.

In a couple of cases we needed to use clean_restart, since target remote
doesn't support the run command, and in one case we had to modify an expect
expression to allow for a "multiprocess-style" ptid.

Tested with the patch that implemented target remote mode fork and exec
event support.

gdb/testsuite/ChangeLog:

	* gdb.base/execl-update-breakpoints.exp (main): Enable for target
	remote.
	* gdb.base/foll-exec-mode.exp (main): Disable for target remote.
	* gdb.base/foll-exec.exp (main): Enable for target remote.
	* gdb.base/foll-fork.exp (main): Likewise.
	* gdb.base/foll-vfork.exp (main): Likewise.
	* gdb.base/multi-forks.exp (main): Likewise, and use clean_restart.
	(proc continue_to_exit_bp_loc): Use clean_restart.
	* gdb.base/pie-execl.exp (main): Disable for target remote.
	* gdb.base/watch-vfork.exp (main): Enable for target remote.
	* gdb.mi/mi-nsthrexec.exp (main): Likewise.
	* gdb.threads/execl.exp (main): Likewise.
	* gdb.threads/fork-child-threads.exp (main): Likewise.
	* gdb.threads/fork-plus-threads.exp (main): Disable for target
	remote.
	* gdb.threads/fork-thread-pending.exp (main): Enable for target
	remote.
	* gdb.threads/linux-dp.exp (check_philosopher_stack): Allow
	pid.tid style ptids, instead of just tid.
	* gdb.threads/thread-execl.exp (main): Enable for target remote.
	* gdb.threads/watchpoint-fork.exp (main): Likewise.
	* gdb.trace/report.exp (use_collected_data): Allow pid.tid style
	ptids, instead of just tid.
---
 gdb/testsuite/ChangeLog                            | 26
++++++++++++++++++++++
 .../gdb.base/execl-update-breakpoints.exp          |  6 -----
 gdb/testsuite/gdb.base/foll-exec-mode.exp          |  7 ++++--
 gdb/testsuite/gdb.base/foll-exec.exp               |  4 ----
 gdb/testsuite/gdb.base/foll-fork.exp               |  4 ----
 gdb/testsuite/gdb.base/foll-vfork.exp              |  4 ----
 gdb/testsuite/gdb.base/multi-forks.exp             |  6 ++---
 gdb/testsuite/gdb.base/pie-execl.exp               | 10 +++++----
 gdb/testsuite/gdb.base/watch-vfork.exp             |  5 -----
 gdb/testsuite/gdb.mi/mi-nsthrexec.exp              |  5 -----
 gdb/testsuite/gdb.threads/execl.exp                |  4 ----
 gdb/testsuite/gdb.threads/fork-child-threads.exp   |  4 ----
 gdb/testsuite/gdb.threads/fork-plus-threads.exp    |  7 ++++++
 gdb/testsuite/gdb.threads/fork-thread-pending.exp  |  6 -----
 gdb/testsuite/gdb.threads/linux-dp.exp             |  4 ++--
 gdb/testsuite/gdb.threads/thread-execl.exp         |  5 -----
 gdb/testsuite/gdb.threads/watchpoint-fork.exp      |  5 -----
 gdb/testsuite/gdb.trace/report.exp                 |  2 +-
 18 files changed, 49 insertions(+), 65 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index df8c768..f8e7084 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,29 @@
+2015-12-11  Don Breazeal  <donb@codesourcery.com>
+
+	* gdb.base/execl-update-breakpoints.exp (main): Enable for target
+	remote.
+	* gdb.base/foll-exec-mode.exp (main): Disable for target remote.
+	* gdb.base/foll-exec.exp (main): Enable for target remote.
+	* gdb.base/foll-fork.exp (main): Likewise.
+	* gdb.base/foll-vfork.exp (main): Likewise.
+	* gdb.base/multi-forks.exp (main): Likewise, and use clean_restart.
+	(proc continue_to_exit_bp_loc): Use clean_restart.
+	* gdb.base/pie-execl.exp (main): Disable for target remote.
+	* gdb.base/watch-vfork.exp (main): Enable for target remote.
+	* gdb.mi/mi-nsthrexec.exp (main): Likewise.
+	* gdb.threads/execl.exp (main): Likewise.
+	* gdb.threads/fork-child-threads.exp (main): Likewise.
+	* gdb.threads/fork-plus-threads.exp (main): Disable for target
+	remote.
+	* gdb.threads/fork-thread-pending.exp (main): Enable for target
+	remote.
+	* gdb.threads/linux-dp.exp (check_philosopher_stack): Allow
+	pid.tid style ptids, instead of just tid.
+	* gdb.threads/thread-execl.exp (main): Enable for target remote.
+	* gdb.threads/watchpoint-fork.exp (main): Likewise.
+	* gdb.trace/report.exp (use_collected_data): Allow pid.tid style
+	ptids, instead of just tid.
+
 2015-12-11  Andrew Burgess  <andrew.burgess@embecosm.com>

 	* gdb.base/list.exp (test_list_forward): Add end of file error
diff --git a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
index a980791..20d9101 100644
--- a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
+++ b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
@@ -16,12 +16,6 @@
 # Test that when following an exec, we don't try to insert breakpoints
 # in the new image at the addresses the symbols had before the exec.

-# Remote protocol does not support follow-exec notifications.
-
-if [is_remote target] {
-    continue
-}
-
 standard_testfile

 # Build two copies of the program, each linked at a different address.
diff --git a/gdb/testsuite/gdb.base/foll-exec-mode.exp
b/gdb/testsuite/gdb.base/foll-exec-mode.exp
index ee193e2..8a0a3a9 100644
--- a/gdb/testsuite/gdb.base/foll-exec-mode.exp
+++ b/gdb/testsuite/gdb.base/foll-exec-mode.exp
@@ -26,8 +26,11 @@
 # be a breakpoint in order to stop after the exec, even if we use
 # a single-step command to execute past the exec.

-if { [is_remote target] || ![isnative] } then {
-     continue
+# Remote mode doesn't support the 'run' command, which is
+# required for follow-exec-mode testing.
+if { [target_info exists gdb_protocol]
+     && [target_info gdb_protocol] == "remote" } {
+    continue
 }

 # Until "catch exec" is implemented on other targets...
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp
b/gdb/testsuite/gdb.base/foll-exec.exp
index 0a6347c..a36f212 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -16,10 +16,6 @@
 # This is a test of gdb's ability to follow a process through a
 # Unix exec() system call.

-if { [is_remote target] || ![isnative] } then {
-    continue
-}
-
 # Until "catch exec" is implemented on other targets...
 #
 if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp
b/gdb/testsuite/gdb.base/foll-fork.exp
index 5993973..51e6a7a 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -13,10 +13,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

-if { [is_remote target] || ![isnative] } then {
-    continue
-}
-
 # Until "set follow-fork-mode" and "catch fork" are implemented on
 # other targets...
 #
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp
b/gdb/testsuite/gdb.base/foll-vfork.exp
index 82922d8..0659509 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -18,10 +18,6 @@
 # either execs or exits --- since those events take somewhat different
 # code paths in GDB, both variants are exercised.

-if { [is_remote target] || ![isnative] } then {
-    continue
-}
-
 # Until "set follow-fork-mode" and "catch vfork" are implemented on
 # other targets...
 #
diff --git a/gdb/testsuite/gdb.base/multi-forks.exp
b/gdb/testsuite/gdb.base/multi-forks.exp
index 2b0b81d..cb1464d 100644
--- a/gdb/testsuite/gdb.base/multi-forks.exp
+++ b/gdb/testsuite/gdb.base/multi-forks.exp
@@ -13,10 +13,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

-if { [is_remote target] || ![isnative] } then {
-    continue
-}
-
 # Until "set follow-fork-mode" and "catch fork" are implemented on
 # other targets...
 #
@@ -111,6 +107,7 @@ proc continue_to_exit_bp_loc {} {
 # First set gdb to follow the child.
 # The result should be that each of the 4 forks returns zero.

+clean_restart ${binfile}
 runto_main
 gdb_test_no_output "set follow-fork child"
 continue_to_exit_bp_loc
@@ -120,6 +117,7 @@ gdb_test "print pids" "\\$.* = \\{0, 0, 0, 0\\}.*"
"follow child, print pids"
 # Now set gdb to follow the parent.
 # Result should be that none of the 4 forks returns zero.

+clean_restart ${binfile}
 runto_main
 gdb_test_no_output "set follow-fork parent" ""
 continue_to_exit_bp_loc
diff --git a/gdb/testsuite/gdb.base/pie-execl.exp
b/gdb/testsuite/gdb.base/pie-execl.exp
index 51edc82..f75c4dc 100644
--- a/gdb/testsuite/gdb.base/pie-execl.exp
+++ b/gdb/testsuite/gdb.base/pie-execl.exp
@@ -23,10 +23,12 @@ if ![istarget *-linux*] {
     continue
 }

-# Remote protocol does not support follow-exec notifications.
-
-if [is_remote target] {
-    continue
+# In remote mode we cannot use the 'set args' command, and this
+# test requires it.
+if { [target_info exists gdb_protocol] } then {
+    if { [target_info gdb_protocol] == "remote" } then {
+	continue
+    }
 }

 standard_testfile .c
diff --git a/gdb/testsuite/gdb.base/watch-vfork.exp
b/gdb/testsuite/gdb.base/watch-vfork.exp
index 9b43ac6..67ff1c2 100644
--- a/gdb/testsuite/gdb.base/watch-vfork.exp
+++ b/gdb/testsuite/gdb.base/watch-vfork.exp
@@ -15,11 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

-# There's no support for vfork events in the remote protocol.
-if { [is_remote target] } {
-    return 0
-}
-
 standard_testfile .c

 if { [build_executable ${testfile}.exp ${testfile} $srcfile {debug}] } {
diff --git a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
index 9ba7739..d55a156 100644
--- a/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsthrexec.exp
@@ -18,11 +18,6 @@
 # the main thread doesn't just silently stop at the first internal
 # breakpoint (usually the _dl_debug_state breakpoint).

-# No exec event support in the remote protocol.
-if { [is_remote target] } then {
-    continue
-}
-
 if { ![support_displaced_stepping] } {
     unsupported "displaced stepping"
     return -1
diff --git a/gdb/testsuite/gdb.threads/execl.exp
b/gdb/testsuite/gdb.threads/execl.exp
index b86b612..92e3e81 100644
--- a/gdb/testsuite/gdb.threads/execl.exp
+++ b/gdb/testsuite/gdb.threads/execl.exp
@@ -15,10 +15,6 @@

 # Test handling of threads across an execl.

-if { [is_remote target] } then {
-    continue
-}
-
 # Original image, loads a thread library.
 standard_testfile

diff --git a/gdb/testsuite/gdb.threads/fork-child-threads.exp
b/gdb/testsuite/gdb.threads/fork-child-threads.exp
index 75e60e1..7c52753 100644
--- a/gdb/testsuite/gdb.threads/fork-child-threads.exp
+++ b/gdb/testsuite/gdb.threads/fork-child-threads.exp
@@ -18,10 +18,6 @@ if { ! [istarget "*-*-linux*"] } {
     return 0
 }

-if { [is_remote target] || ![isnative] } then {
-    return 0
-}
-
 standard_testfile

 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}"
executable {debug}] != "" } {
diff --git a/gdb/testsuite/gdb.threads/fork-plus-threads.exp
b/gdb/testsuite/gdb.threads/fork-plus-threads.exp
index 2b34b6c..fe88a51 100644
--- a/gdb/testsuite/gdb.threads/fork-plus-threads.exp
+++ b/gdb/testsuite/gdb.threads/fork-plus-threads.exp
@@ -20,6 +20,13 @@
 #
 # See https://sourceware.org/bugzilla/show_bug.cgi?id=18600

+# In remote mode, we cannot continue debugging after all
+# inferiors have terminated, and this test requires that.
+if { [target_info exists gdb_protocol]
+     && [target_info gdb_protocol] == "remote" } {
+    continue
+}
+
 standard_testfile

 proc do_test { detach_on_fork } {
diff --git a/gdb/testsuite/gdb.threads/fork-thread-pending.exp
b/gdb/testsuite/gdb.threads/fork-thread-pending.exp
index d229232..ad8adad 100644
--- a/gdb/testsuite/gdb.threads/fork-thread-pending.exp
+++ b/gdb/testsuite/gdb.threads/fork-thread-pending.exp
@@ -13,12 +13,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

-# There's no support for `set follow-fork-mode' in the remote
-# protocol.
-if { [is_remote target] } {
-    return 0
-}
-
 # Only GNU/Linux is known to support `set follow-fork-mode child'.
 #
 if { ! [istarget "*-*-linux*"] } {
diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp
b/gdb/testsuite/gdb.threads/linux-dp.exp
index a089cac..49ff1f7 100644
--- a/gdb/testsuite/gdb.threads/linux-dp.exp
+++ b/gdb/testsuite/gdb.threads/linux-dp.exp
@@ -64,7 +64,7 @@ for {set i 0} {$i < 5} {incr i} {
 	-re "^ *Id.*Frame *\[\r\n\]+" {
 	    exp_continue
 	}
-	-re "^. +(\[0-9\]+ *Thread \[-0-9a-fx\]+) \[^\n\]*\n" {
+	-re "^. +(\[0-9\]+ *Thread \[-0-9a-fx.\]+) \[^\n\]*\n" {
 	    verbose -log "found thread $expect_out(1,string)" 2
 	    lappend threads_before $expect_out(1,string)
 	    exp_continue
@@ -126,7 +126,7 @@ for {set i 0} {$i < 5} {incr i} {
 	-re "^ *Id.*Frame *\[\r\n\]+" {
 	    exp_continue
 	}
-	-re "^. +(\[0-9\]+ *Thread \[-0-9a-fx\]+) \[^\n\]*\n" {
+	-re "^. +(\[0-9\]+ *Thread \[-0-9a-fx.\]+) \[^\n\]*\n" {
 	    set name $expect_out(1,string)
 	    for {set j 0} {$j != [llength $threads_before] } {incr j} {
 		if {$name == [lindex $threads_before $j]} {
diff --git a/gdb/testsuite/gdb.threads/thread-execl.exp
b/gdb/testsuite/gdb.threads/thread-execl.exp
index a598ad0..8df6a15 100644
--- a/gdb/testsuite/gdb.threads/thread-execl.exp
+++ b/gdb/testsuite/gdb.threads/thread-execl.exp
@@ -16,11 +16,6 @@
 # Test that GDB doesn't get stuck when stepping over an exec call done
 # by a thread other than the main thread.

-# There's no support for exec events in the remote protocol.
-if { [is_remote target] } {
-    return 0
-}
-
 standard_testfile

 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp
b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
index a4557f8..2fd1517 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork.exp
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
@@ -17,11 +17,6 @@

 set testfile watchpoint-fork

-if [is_remote target] {
-    kfail "remote/13584" "gdbserver does not support debugging across fork"
-    return
-}
-
 proc test {type symbol} {
     with_test_prefix "$type" {
 	global testfile subdir srcdir gdb_prompt
diff --git a/gdb/testsuite/gdb.trace/report.exp
b/gdb/testsuite/gdb.trace/report.exp
index 53ea943..28bf715 100644
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -386,7 +386,7 @@ proc use_collected_data { data_source } {

 	# There is always a thread of an inferior, either a live one or
 	# a faked one.
-	gdb_test "info threads" "\\* ${decimal}    (process|Thread)
${decimal}\[ \t\].*"
+	gdb_test "info threads" "\\* ${decimal}    (process|Thread)
\[0-9\.\]+\[ \t\].*"
 	gdb_test "info inferiors" "\\* 1    process ${decimal} \[
\t\]+${binfile}.*"
     }
 }
-- 
1.8.1.1

  reply	other threads:[~2015-12-14 19:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 23:56 [PATCH 0/3] Target remote mode fork and exec support Don Breazeal
2015-11-06 23:57 ` [PATCH 3/3] Target remote mode fork and exec docs Don Breazeal
2015-11-07  8:18   ` Eli Zaretskii
2015-11-12  1:00     ` Don Breazeal
2015-11-12 16:48       ` Eli Zaretskii
2015-11-13  1:13         ` Don Breazeal
2015-11-13  8:16           ` Eli Zaretskii
2015-11-12  1:00     ` Don Breazeal
2015-11-06 23:57 ` [PATCH 1/3] Target remote mode fork and exec events Don Breazeal
2015-11-20 13:04   ` Pedro Alves
2015-11-20 16:50     ` Don Breazeal
2015-12-07 22:14     ` [PATCH v2 0/3] Target remote mode fork and exec support Don Breazeal
2015-12-07 22:14       ` [PATCH v2 1/3] Target remote mode fork and exec tests Don Breazeal
2015-12-08 12:58         ` Pedro Alves
2015-12-14 19:29           ` Don Breazeal [this message]
2015-12-07 22:14       ` [PATCH v2 2/3] Target remote mode fork and exec events Don Breazeal
2015-12-08 12:55         ` Pedro Alves
2015-12-14 19:29           ` Don Breazeal
2015-12-15 10:52             ` Pedro Alves
2015-12-07 22:15       ` [PATCH v2 3/3] Target remote mode fork and exec docs Don Breazeal
2015-12-08 13:07         ` Pedro Alves
2015-12-14 19:30           ` [pushed] " Don Breazeal
2015-12-08 13:11       ` [PATCH v2 0/3] Target remote mode fork and exec support Pedro Alves
2015-11-06 23:57 ` [PATCH 2/3] Target remote mode fork and exec tests Don Breazeal

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=566F189A.6000808@codesourcery.com \
    --to=donb@codesourcery.com \
    --cc=Don_Breazeal@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).