From patchwork Fri Sep 12 07:34:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 2780 Received: (qmail 23327 invoked by alias); 12 Sep 2014 07:34:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 23317 invoked by uid 89); 12 Sep 2014 07:34:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPAM_SUBJECT1, SPF_HELO_PASS, SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 12 Sep 2014 07:34:14 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8C7Y79w031900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 12 Sep 2014 03:34:07 -0400 Received: from host2.jankratochvil.net (ovpn-116-53.ams2.redhat.com [10.36.116.53]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8C7Y3Ns024422 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Fri, 12 Sep 2014 03:34:05 -0400 Date: Fri, 12 Sep 2014 09:34:02 +0200 From: Jan Kratochvil To: Pedro Alves Cc: Doug Evans , Mark Wielaard , gdb-patches@sourceware.org Subject: [testsuite patch] runaway attach processes [Re: Regression: GDB stopped on run with attached process (PR 17347)] Message-ID: <20140912073402.GA4134@host2.jankratochvil.net> References: <21434.52532.737427.778289@ruffy.mtv.corp.google.com> <53BC0D0B.7040001@redhat.com> <21437.28600.751354.629884@ruffy.mtv.corp.google.com> <53BD7749.5000800@redhat.com> <20140903075858.GA23492@host2.jankratochvil.net> <540775D7.7040003@redhat.com> <20140907192818.GA17035@host2.jankratochvil.net> <540DD8CF.5050200@redhat.com> <20140909182518.GA3320@host2.jankratochvil.net> <54119729.5050206@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <54119729.5050206@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Thu, 11 Sep 2014 14:35:53 +0200, Pedro Alves wrote: > Thanks, pushed to both master and 7.8. I have started seeing occasional runaway 'attach' processes these days. I cannot be certain it is really caused by this patch, for example grep 'FAIL.*cmdline attach run' does not show anything in my logs. But as I remember this 'attach' runaway process always happened in GDB (but I do not remember it in the past months) I think it would be most safe to just solve it forever by [attached]. Jan gdb/testsuite/ 2014-09-12 Jan Kratochvil * gdb.base/attach.c: Include unistd.h. (main): Call alarm. Add label postloop. * gdb.base/attach.exp (do_attach_tests): Use gdb_get_line_number, gdb_breakpoint, gdb_continue_to_breakpoint. (test_command_line_attach_run): Kill ${testpid} in one exit path. diff --git a/gdb/testsuite/gdb.base/attach.c b/gdb/testsuite/gdb.base/attach.c index 0041b47..91b180c 100644 --- a/gdb/testsuite/gdb.base/attach.c +++ b/gdb/testsuite/gdb.base/attach.c @@ -5,6 +5,7 @@ exit unless/until gdb sets the variable to non-zero.) */ #include +#include int should_exit = 0; @@ -12,9 +13,11 @@ int main () { int local_i = 0; + alarm (60); + while (! should_exit) { local_i++; } - return 0; + return 0; /* postloop */ } diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index 6340496..5fb5c53 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -256,11 +256,8 @@ proc do_attach_tests {} { # Verify that the modification really happened. - gdb_test "tbreak 19" "Temporary breakpoint .*at.*$srcfile, line 19.*" \ - "after attach2, set tbreak postloop" - - gdb_test "continue" "main.*at.*$srcfile:19.*" \ - "after attach2, reach tbreak postloop" + gdb_breakpoint [gdb_get_line_number "postloop"] temporary + gdb_continue_to_breakpoint "postloop" ".* postloop .*" # Allow the test process to exit, to cleanup after ourselves. @@ -418,6 +415,7 @@ proc test_command_line_attach_run {} { "-iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""] if { $res != 0} { fail $test + remote_exec build "kill -9 ${testpid}" return $res } gdb_test_multiple "" $test {