Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Release the GIL while running a gdb command or expression
Date: Fri, 12 Oct 2018 16:49:00 -0000	[thread overview]
Message-ID: <a4b47f66-610a-7c54-d525-be5983e5ea74@redhat.com> (raw)
In-Reply-To: <20181010202233.17985-1-tom@tromey.com>

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 <stdio.h>
> +#include <unistd.h>
> +
> +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
> +	    }
> +	}
> +    }
> +}


  parent reply	other threads:[~2018-10-12 16:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 20:23 Tom Tromey
2018-10-12 14:52 ` Phil Muldoon
2018-10-12 16:49 ` Pedro Alves [this message]
2018-10-12 16:51   ` Pedro Alves
2018-10-16 12:48   ` Tom Tromey
2018-10-16 14:50     ` Pedro Alves
2018-10-12 16:56 ` Pedro Alves
2018-10-16 13:05   ` Tom Tromey
2018-10-16 14:51     ` Pedro Alves
2018-10-16 21:39       ` Tom Tromey
2018-10-16 21:45         ` Tom Tromey
2018-10-24 18:08           ` Pedro Alves
2018-10-25 12:46             ` Phil Muldoon
2018-11-04 15:54             ` Tom Tromey
2019-01-29 13:02               ` Tom Tromey

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=a4b47f66-610a-7c54-d525-be5983e5ea74@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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