From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10436 invoked by alias); 27 Oct 2011 10:17:29 -0000 Received: (qmail 10426 invoked by uid 22791); 27 Oct 2011 10:17:28 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 10:17:08 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9RAH3lP022753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 27 Oct 2011 06:17:03 -0400 Received: from host1.jankratochvil.net (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9RAH1Qs032455 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Oct 2011 06:17:03 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p9RAH0pW021826; Thu, 27 Oct 2011 12:17:00 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p9RAH0Rj021825; Thu, 27 Oct 2011 12:17:00 +0200 Date: Thu, 27 Oct 2011 10:31:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org, Kevin Pouget , Tom Tromey Subject: [patch] Forbid "run" etc. for use_gdb_stub targets [Re: [patch] gdb.python/py-events.exp: Disable multi-inferior for gdbserver] Message-ID: <20111027101700.GA21805@host1.jankratochvil.net> References: <20111009181654.GA4629@host1.jankratochvil.net> <201110261448.58804.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201110261448.58804.pedro@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-10/txt/msg00722.txt.bz2 On Wed, 26 Oct 2011 15:48:58 +0200, Pedro Alves wrote: > "run" doesn't work with "target remote" either. If that is succeeding, > it's because it's actually running the default native target, Thanks for catching it. I have seen these false runs already before, therefore I find it unmanageable to always catch it at least myself. Maybe some more testfiles could be fixed instead of skipped below, I fixed one, still I find that as a possible different patch. I am not sure what is the correct way to handle gdbserver_start_extended. gdb.server/ext-*.exp run gdbserver even in the default native run. They either should not run in the default native or they should not run in the non-extended gdbserver mode. Currently they run in both modes the same way. AFAIK there is currently no way to run the whole testsuite in extended gdbserver mode. (There were some attempts for it on the archer list IIRC.) No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu and with gdbsever. Thanks, Jan gdb/testsuite/ 2011-10-27 Jan Kratochvil * gdb.base/async-shell.exp: Skip the testfile for is_remote target. * gdb.base/attach-pie-misread.exp: Skip the testfile for use_gdb_stub. * gdb.base/break-interp.exp: Likewise. * gdb.base/default.exp (attach, run "r" abbreviation, run): Skip these testcases for use_gdb_stub. * gdb.dwarf2/dw2-restore.exp: Fix the run for use_gdb_stub. (continue): New testcase. * gdb.python/py-events.exp: Skip the testfile for is_remote target. * gdb.threads/attach-into-signal.exp: Likewise. * gdb.threads/attach-stopped.exp: Likewise. * gdb.threads/attachstop-mt.exp: Likewise. * lib/gdb.exp (gdb_test_multiple): Forbid run, start or attach for use_gdb_stub without gdbserver_start_extended. * lib/gdbserver-support.exp (gdbserver_start_extended): Set global gdbserver_protocol and gdbserver_gdbport. --- a/gdb/testsuite/gdb.base/async-shell.exp +++ b/gdb/testsuite/gdb.base/async-shell.exp @@ -20,6 +20,10 @@ if { ![support_displaced_stepping] } { return -1 } +if [is_remote target] { + return -1 +} + if { [prepare_for_testing ${testfile}.exp ${testfile}] } { return -1 } --- a/gdb/testsuite/gdb.base/attach-pie-misread.exp +++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp @@ -14,7 +14,8 @@ # along with this program. If not, see . # This test only works on GNU/Linux. -if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} { +if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub] + || ![istarget *-linux*] || [skip_shlib_tests]} { continue } --- a/gdb/testsuite/gdb.base/break-interp.exp +++ b/gdb/testsuite/gdb.base/break-interp.exp @@ -14,7 +14,8 @@ # along with this program. If not, see . # This test only works on GNU/Linux. -if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} { +if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub] + || ![istarget *-linux*] || [skip_shlib_tests]} { continue } --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -39,23 +39,23 @@ gdb_test "append value" "Missing filename\." gdb_test "append binary memory" "Missing filename\." gdb_test "append binary value" "Missing filename\." -setup_xfail "mips-idt-*" -gdb_test_multiple "attach" "attach" { - -re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\ - { pass "attach" } - -re "You can't do that when your target is `None'.*$gdb_prompt $"\ - { pass "attach" } - -re "You can't do that without a process to debug.*$gdb_prompt $"\ - { pass "attach" } - -re "Don't know how to attach. Try \"help target\"..*$gdb_prompt $"\ - { pass "attach" } - -re "Kill it. .y or n." { - send_gdb "y\n" - exp_continue +if ![target_info exists use_gdb_stub] { + setup_xfail "mips-idt-*" + gdb_test_multiple "attach" "attach" { + -re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\ + { pass "attach" } + -re "You can't do that when your target is `None'.*$gdb_prompt $"\ + { pass "attach" } + -re "You can't do that without a process to debug.*$gdb_prompt $"\ + { pass "attach" } + -re "Don't know how to attach. Try \"help target\"..*$gdb_prompt $"\ + { pass "attach" } + -re "Kill it. .y or n." { + send_gdb "y\n" + exp_continue + } } -} -if ![target_info exists use_gdb_stub] { gdb_test "break" "No default breakpoint address now." "break" foreach i "b br bre brea" { gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation" @@ -420,7 +420,9 @@ gdb_test "ptype" "The history is empty." "ptype" gdb_test "pwd" "Working directory .*" "pwd" #test run "r" abbreviation -if [istarget "*-*-vxworks*"] then { +if [target_info exists use_gdb_stub] { + # Only extended-remote supports "run". +} elseif [istarget "*-*-vxworks*"] then { gdb_test "set args" ".*" "" gdb_test "r" "Starting program: .* @@ -446,7 +448,9 @@ You must specify a function name to run, and arguments if any"\ } #test run -if [istarget "*-*-vxworks*"] then { +if [target_info exists use_gdb_stub] { + # Only extended-remote supports "run". +} elseif [istarget "*-*-vxworks*"] then { gdb_test "set args" ".*" "" gdb_test "run" "Starting program: .* --- a/gdb/testsuite/gdb.dwarf2/dw2-restore.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-restore.exp @@ -33,5 +33,8 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -gdb_test "run" ".*" -gdb_test "where" ".*$hex in foo ().+$hex in _start ().*" +if ![runto foo] { + return 0 +} +gdb_test "continue" "$hex in foo \\(\\)" +gdb_test "where" "#0 +$hex in foo \\(\\)\r\n#1 +$hex in _start \\(\\)" --- a/gdb/testsuite/gdb.python/py-events.exp +++ b/gdb/testsuite/gdb.python/py-events.exp @@ -13,6 +13,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +if [target_info exists use_gdb_stub] { + return 0 +} + if $tracelevel then { strace $tracelevel } --- a/gdb/testsuite/gdb.threads/attach-into-signal.exp +++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp @@ -17,7 +17,8 @@ # This file was created by Jan Kratochvil . # This test only works on Linux -if { ![isnative] || [is_remote host] || ![istarget *-linux*] } { +if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub] + || ![istarget *-linux*] } { continue } --- a/gdb/testsuite/gdb.threads/attach-stopped.exp +++ b/gdb/testsuite/gdb.threads/attach-stopped.exp @@ -18,7 +18,8 @@ # This file was updated by Jan Kratochvil . # This test only works on Linux -if { ![isnative] || [is_remote host] || ![istarget *-linux*] } { +if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub] + || ![istarget *-linux*] } { continue } --- a/gdb/testsuite/gdb.threads/attachstop-mt.exp +++ b/gdb/testsuite/gdb.threads/attachstop-mt.exp @@ -17,7 +17,8 @@ # and Jan Kratochvil . # This test only works on Linux -if { ![isnative] || [is_remote host] || ![istarget *-linux*] } { +if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub] + || ![istarget *-linux*] } { continue } --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -601,6 +601,18 @@ proc gdb_test_multiple { command message user_code } { error "Invalid newline in \"$message\" test" } + if {[regexp -nocase {^\s*(r|run|star|start|at|att|atta|attac|attach)\M} \ + $command] + && [target_info exists use_gdb_stub]} { + global gdbserver_protocol + + # gdbserver_start_extended runs as a part of non-extended configuration. + if {![info exists gdbserver_protocol] + || ![string match "extended-*" $gdbserver_protocol]} { + error "gdbserver does not support $command without extended-remote" + } + } + # TCL/EXPECT WART ALERT # Expect does something very strange when it receives a single braced # argument. It splits it along word separators and performs substitutions. --- a/gdb/testsuite/lib/gdbserver-support.exp +++ b/gdb/testsuite/lib/gdbserver-support.exp @@ -337,6 +337,9 @@ proc gdbserver_reconnect { } { # Start and connect to a gdbserver in extended mode. proc gdbserver_start_extended { } { + global gdbserver_protocol + global gdbserver_gdbport + set res [gdbserver_start "--multi" ""] set gdbserver_protocol "extended-[lindex $res 0]" set gdbserver_gdbport [lindex $res 1]