Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Don Breazeal <donb@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 3/5] Extended-remote support for exec event tests
Date: Thu, 13 Aug 2015 15:22:00 -0000	[thread overview]
Message-ID: <55CCB622.8070306@redhat.com> (raw)
In-Reply-To: <1438298360-29594-4-git-send-email-donb@codesourcery.com>

On 07/31/2015 12:19 AM, Don Breazeal wrote:

> This patch updates several exec-related tests and some of the 
> library functions in order to get them running with extended-remote.
> There were three changes that were required, as follows:
> 
> In gdb.base/foll-exec.exp, the proc 'zap_session' is used repeatedly
> to reset the state of the debugger before the next test.  Part of
> that procedure is to 'set exec-file'.  For remote targets, it is
> necessary to also 'set remote exec-file' to achieve the same
> effect (and execute the correct binary file in the subsequent test).

This assumes local gdbserver testing.  This is something that
should be done in the target board.  Look for exec-file in
gdb/testsuite/boards/native-extended-gdbserver.exp.
Maybe we should just clean_restart instead ?

> 
> In gdb.base/pie-execl.exp, there is an expect statement with an
> expression that is used to match output from both gdb and the
> program under debug.  For the remote target, this had to be 
> split into two expressions, using $inferior_spawn_id to match
> the output from the program.
> 
> Because I had encountered problems with extended-remote exec events
> in non-stop mode in my manual testing, I added non-stop testing to
> the non-ldr-exc-[1234].exp tests.  In order to set non-stop mode
> for remote targets, it is necessary to 'set non-stop on' after gdb
> has started, but before it connects to gdbserver.  The non-ldr-...
> tests call 'clean_restart' in between tests, and it eventually calls
> 'gdb_start' which starts gdb and gdbserver and connects them.  By
> adding a stop mode argument to clean_restart and gdb_start (in
> both lib/gdb.exp and boards/native-extended-gdbserver.exp), it was
> possible to set non-stop mode for remote targets.  Since the
> arguments have a default value "all-stop", and only have an effect
> when "non-stop" is passed, these changes do not affect any existing
> test behavior.

I don't think we can do this, because gdb_start is an overridable
function (see comment above it).  You can instead append
set non-stop on to GDBFLAGS.  E.g.,:

save_vars { GDBFLAGS } {
    append GDBFLAGS " -ex \"set non-stop $nonstop\""
    clean_restart
}

> diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
> index 69e5cc6..147e7f3 100644
> --- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
> +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
> @@ -28,11 +28,11 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
>      return -1
>  }
>  
> -proc do_test { lock_sched } {
> -    with_test_prefix "lock-sched$lock_sched" {
> +proc do_test { lock_sched stop_mode } {
> +    with_test_prefix "lock-sched$lock_sched,$stop_mode" {
>  	global executable
>  
> -	clean_restart ${executable}
> +	clean_restart ${executable} $stop_mode
>  
>  	if ![runto_main] {
>  	    return -1
> @@ -48,11 +48,17 @@ proc do_test { lock_sched } {
>  	    gdb_test_no_output "set scheduler-locking on"
>  	}
>  
> +	if { $stop_mode == "non-stop" } {
> +	    gdb_test "thread 2" "Switching.*"
> +	}
> +
>  	gdb_test "continue" \
>  	    ".*is executing new program.*Breakpoint 1, main.* at .*" \
>  	    "continue over exec"
>      }
>  }
>  
> -do_test 0
> -do_test 1
> +do_test 0 "all-stop"
> +do_test 1 "all-stop"
> +do_test 0 "non-stop"
> +do_test 1 "non-stop"

Please use foreach.  E.g.,

foreach nonstop {"on" "off"} {
  foreach schedlock {"on" "off"} {
     do_test ...
  }
}

Note that schedlock on has no effect in non-stop mode.
Maybe if !lock_sched && nonstop, we could issue "continue -a"
instead of continue.

> diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
> index 9386153..748ff11 100644
> --- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
> +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
> @@ -29,18 +29,26 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
>      return -1
>  }
>  
> -proc do_test { lock_sched } {
> -    with_test_prefix "lock-sched$lock_sched" {
> +proc do_test { lock_sched stop_mode } {
> +    with_test_prefix "lock-sched$lock_sched,$stop_mode" {
>  	global executable
>  
> -	clean_restart ${executable}
> +	clean_restart ${executable} $stop_mode
>  
>  	if ![runto_main] {
>  	    return -1
>  	}
>  
>  	gdb_breakpoint [gdb_get_line_number "break-here"]
> -	gdb_continue_to_breakpoint "break-here" ".* break-here .*"
> +	gdb_test_multiple "continue" "continue to breakpoint" {
> +	    -re ".*Breakpoint.*break-here.*" {

This doesn't expect the prompt, which is going to be
racy -- the following gdb_test may fail if this test manages
to leave the prompt in the expect buffer.  What motivated this change?

Thanks,
Pedro Alves


  reply	other threads:[~2015-08-13 15:22 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 21:49 [PATCH 0/5] Extended-remote follow exec Don Breazeal
2015-07-15 21:50 ` [PATCH 1/5] Extended-remote exec events Don Breazeal
2015-07-16 14:01   ` Yao Qi
2015-07-16 15:52     ` Don Breazeal
2015-07-16 16:35       ` Yao Qi
2015-07-16 17:06         ` Don Breazeal
2015-07-17 11:55           ` Yao Qi
2015-07-15 21:50 ` [PATCH 2/5] Extended-remote exec catchpoints Don Breazeal
2015-08-13 15:00   ` Pedro Alves
2015-07-15 21:50 ` [PATCH 3/5] Extended-remote support for exec event tests Don Breazeal
2015-07-15 21:51 ` [PATCH 4/5] Eliminate spurious warnings from remote exec Don Breazeal
2015-07-15 21:51 ` [PATCH 5/5] Extended-remote exec event docs Don Breazeal
2015-07-16  2:39   ` Eli Zaretskii
2015-07-30 23:19 ` [PATCH v2 0/5] Extended-remote exec events Don Breazeal
2015-07-30 23:19   ` [PATCH v2 1/5] Extended-remote follow exec Don Breazeal
2015-08-13 14:50     ` Pedro Alves
2015-07-30 23:19   ` [PATCH v2 2/5] Extended-remote exec catchpoints Don Breazeal
2015-07-30 23:20   ` [PATCH v2 4/5] Eliminate spurious warnings from remote exec Don Breazeal
2015-08-13 15:38     ` Pedro Alves
2015-07-30 23:20   ` [PATCH v2 5/5] Extended-remote exec event docs Don Breazeal
2015-07-31  6:36     ` Eli Zaretskii
2015-07-31 17:06       ` Don Breazeal
2015-08-13 15:43     ` Pedro Alves
2015-07-30 23:20   ` [PATCH v2 3/5] Extended-remote support for exec event tests Don Breazeal
2015-08-13 15:22     ` Pedro Alves [this message]
2015-09-09 23:05   ` [PATCH v3 0/4] Extended-remote exec events Don Breazeal
2015-09-09 23:06     ` [PATCH v3 2/4] Extended-remote exec catchpoints Don Breazeal
2015-09-09 23:06     ` [PATCH v3 4/4] Extended-remote exec event docs Don Breazeal
2015-09-10 15:23       ` Eli Zaretskii
2015-09-09 23:06     ` [PATCH v3 1/4] Extended-remote follow exec Don Breazeal
     [not found]       ` <55F17AFA.5080102@redhat.com>
2015-09-10 22:56         ` Don Breazeal
2015-09-10 23:00           ` Don Breazeal
2015-09-11  8:34           ` Pedro Alves
2015-09-11 18:38             ` [pushed][PATCH " Don Breazeal
2015-09-11 18:38               ` [pushed][PATCH v3 3/4] Extended-remote exec test Don Breazeal
2015-09-15 15:45                 ` Pedro Alves
2015-09-15 15:53                   ` Don Breazeal
2015-09-15 15:58                     ` Pedro Alves
2015-09-15 16:00                       ` Breazeal, Don
2015-09-15 16:28                         ` Pedro Alves
2015-09-11 18:38               ` [pushed][PATCH v3 2/4] Extended-remote exec catchpoints Don Breazeal
2015-09-11 18:39               ` [pushed][PATCH v3 4/4] Extended-remote exec event docs Don Breazeal
2015-09-15  8:56               ` [pushed][PATCH v3 1/4] Extended-remote follow exec Yao Qi
2015-09-15 16:12                 ` Don Breazeal
2015-09-15 16:31                   ` Yao Qi
2015-09-30 16:20               ` Pedro Alves
2015-09-30 16:22                 ` Breazeal, Don
2016-12-08 11:54               ` Thomas Schwinge
2017-02-17 16:45                 ` Pedro Alves
2019-02-14 16:42                   ` Thomas Schwinge
2019-02-14 17:26                     ` Tom Tromey
2019-02-14 23:11                       ` Tom Tromey
2015-09-09 23:06     ` [PATCH v3 3/4] Extended-remote support for exec event tests Don Breazeal
2015-09-10 13:26       ` Pedro Alves

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=55CCB622.8070306@redhat.com \
    --to=palves@redhat.com \
    --cc=donb@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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