From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98731 invoked by alias); 12 Oct 2018 16:49:41 -0000 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 Received: (qmail 98698 invoked by uid 89); 12 Oct 2018 16:49:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Fri, 12 Oct 2018 16:49:39 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA83F3003076; Fri, 12 Oct 2018 16:49:37 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29D815ED21; Fri, 12 Oct 2018 16:49:36 +0000 (UTC) Subject: Re: [PATCH v2] Release the GIL while running a gdb command or expression To: Tom Tromey , gdb-patches@sourceware.org References: <20181010202233.17985-1-tom@tromey.com> From: Pedro Alves Message-ID: Date: Fri, 12 Oct 2018 16:49:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181010202233.17985-1-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-10/txt/msg00293.txt.bz2 On 10/10/2018 09:22 PM, Tom Tromey wrote: > index 0000000000..92d103a963 > --- /dev/null > +++ b/gdb/testsuite/gdb.python/py-gil-mthread.c > @@ -0,0 +1,30 @@ > +/* This testcase is part of GDB, the GNU debugger. > + > + Copyright 2018 Free Software Foundation, Inc. Fedora's local version has copyright 2014, so this should be 2014-2018. > +#include > +#include > + > +int > +main (void) > +{ > + int i; > + for (i = 0; i < 10; i++) > + { > + sleep (1); /* break-here */ > + printf ("Sleeping %d\n", i); > + } > +} > diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.exp b/gdb/testsuite/gdb.python/py-gil-mthread.exp > new file mode 100644 > index 0000000000..6a65346a8d Please add a describing comment mentioning what the testcase is about. The testcase isn't > + > +standard_testfile .c .py > +set executable $testfile > + > +if { [prepare_for_testing $testfile.exp $executable $srcfile] } { > + return -1 > +} > + > +# Skip all tests if Python scripting is not enabled. > +if { [skip_python_tests] } { continue } > + > +if ![runto_main] { > + return -1 > +} > + The test relies on stdio, so there should be a gdb_skip_stdio_test or gdb,noinferiorio check here somewhere. > +gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"] temporary > +gdb_continue_to_breakpoint "break-here" ".* break-here .*" > + > +set test "response" > +set timeout 60 Do we need to change the timeout? Should this use with_timeout_factor? > +set sleeping_last -1 > +set hello_last 0 > +set minimal 5 > +gdb_test_multiple "python exec (open ('$srcdir/$subdir/$srcfile2').read ())" $test { I don't think this would work with remote host testing. AFAIC, python tests usually "gdb_remote_download host" the python script. > + -re "Error: unable to start thread\r\n" { > + fail $test > + } > + -re "Sleeping (\[0-9\]+)\r\n" { This is inferior output, so should be expected on $inferior_spawn_id. Maybe you can tweak the test to not need this, like run to a breakpoint. No idea whether that makes sense. Please double check the testcase works against --target_board=native-gdbserver/native-extended-gdbserver. Thanks, Pedro Alves > + set n $expect_out(1, string) > + if { $sleeping_last + 1 != $n } { > + fail $test > + } else { > + set sleeping_last $n > + if { $sleeping_last >= $minimal && $hello_last >= $minimal } { > + pass $test > + } else { > + exp_continue > + } > + } > + } > + -re "Hello \\( (\[0-9\]+) \\)\r\n" { > + set n $expect_out(1,string) > + if { $hello_last + 1 != $n } { > + fail $test > + } else { > + set hello_last $n > + if { $sleeping_last >= $minimal && $hello_last >= $minimal } { > + pass $test > + } else { > + exp_continue > + } > + } > + } > +}