]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Target remote mode fork and exec test updates
authorDon Breazeal <donb@codesourcery.com>
Mon, 14 Dec 2015 19:18:05 +0000 (11:18 -0800)
committerDon Breazeal <donb@codesourcery.com>
Mon, 14 Dec 2015 19:18:05 +0000 (11:18 -0800)
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.

18 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/execl-update-breakpoints.exp
gdb/testsuite/gdb.base/foll-exec-mode.exp
gdb/testsuite/gdb.base/foll-exec.exp
gdb/testsuite/gdb.base/foll-fork.exp
gdb/testsuite/gdb.base/foll-vfork.exp
gdb/testsuite/gdb.base/multi-forks.exp
gdb/testsuite/gdb.base/pie-execl.exp
gdb/testsuite/gdb.base/watch-vfork.exp
gdb/testsuite/gdb.mi/mi-nsthrexec.exp
gdb/testsuite/gdb.threads/execl.exp
gdb/testsuite/gdb.threads/fork-child-threads.exp
gdb/testsuite/gdb.threads/fork-plus-threads.exp
gdb/testsuite/gdb.threads/fork-thread-pending.exp
gdb/testsuite/gdb.threads/linux-dp.exp
gdb/testsuite/gdb.threads/thread-execl.exp
gdb/testsuite/gdb.threads/watchpoint-fork.exp
gdb/testsuite/gdb.trace/report.exp

index df8c76833ad01a8969b9d7a1cbd54999ff29197b..f8e7084f66d05feb904a36bb7f2fe7c1eb9dd3c6 100644 (file)
@@ -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
index a9807914018c0a2c1a02eda7d43a36ed96280dc0..20d910116b6de705578824c32d3f333d9ed23a33 100644 (file)
 # 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.
index ee193e22661b72cc80f6662c0cfd525cbd8b6a18..8a0a3a9323ba7ba4c133b05432afc9b6f5d48b60 100644 (file)
 # 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...
index 0a6347c82fd2b0e2d0f0533f27abc7ad514dbc30..a36f212e81f188491fe7676e220f93bbd6bda358 100644 (file)
 # 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 {
index 59939731ec2fc9970a53573379532837808d29d7..51e6a7a2dc57377f39b7844b37bf31634df0a2fe 100644 (file)
 # 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...
 #
index 82922d82a95059399e6a3aaed2f332c34668ea64..0659509776f7b2c6463aca35b329badccf481bab 100644 (file)
 # 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...
 #
index 2b0b81d50a7660e6bdeff3d5318fa35e0a425855..cb1464d8990591d6ae188ed300f115e33a95469d 100644 (file)
 # 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
index 51edc821df24a79aaabef08e55650c35ef681bc0..f75c4dc3efb03deb424d13bf09b2a68c627ed748 100644 (file)
@@ -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
index 9b43ac6d301655bb7871d4b6275e21ef37e400e4..67ff1c2382366475690b52bec02d08a40ecffce8 100644 (file)
 # 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}] } {
index 9ba77394da1e7507063c5583a2734e5d8c4b92e8..d55a156ddf53e6feaec2d48c4cf03c38de421185 100644 (file)
 # 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
index b86b61281dfe19e17494a534fd2da28e4f12e450..92e3e819a3b5a532de8440ea3e263c72f3102692 100644 (file)
 
 # Test handling of threads across an execl.
 
-if { [is_remote target] } then {
-    continue
-}
-
 # Original image, loads a thread library.
 standard_testfile
 
index 75e60e1a9a253ad8d9d48302ebcf96ff130f452d..7c527537d88d4cf21d3098145915b3327bc7d42f 100644 (file)
@@ -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}] != "" } {
index 2b34b6c38867f72939b40874702d7981a08f0f26..fe88a5187e8fff6977a6757f24a925acffb0570c 100644 (file)
 #
 # 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 } {
index d229232415082ef9d89506fad8e86d6f469882b4..ad8adad7f0471aaac2442f525314c7941f71840b 100644 (file)
 # 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*"] } {
index a089cac4e6f69854a69bd81f127a3de038e0091d..49ff1f755c002485f2a236925cdf9a5ffc21a23e 100644 (file)
@@ -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]} {
index a598ad07ec528770bccf588506eecee39eda79b2..8df6a153f18c15ca0d6ea99e31caaae13e28022c 100644 (file)
 # 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}" \
index a4557f80a2a9af957ea40f92b22a63fe042a29d2..2fd15172555d8137688edd62d0e6860308d6b881 100644 (file)
 
 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
index 53ea943421ba043451f0aa8156e5567b55dbdad6..28bf715b8d79a23944f258672c38954946dadbfa 100644 (file)
@@ -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}.*"
     }
 }