public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Subject: Re: [PATCH 12/12] Testcase for detaching while stepping over breakpoint
Date: Wed, 13 Jan 2021 02:05:31 -0500	[thread overview]
Message-ID: <f32dac2e-707e-7a59-fc39-851f7d3d3251@polymtl.ca> (raw)
In-Reply-To: <20210113011543.2047449-13-pedro@palves.net>

On 2021-01-12 8:15 p.m., Pedro Alves wrote:
> +# The test proper.  See description above.
> +proc test {condition_eval target_non_stop non_stop displaced} {
> +    global binfile srcfile
> +    global gdb_prompt
> +    global decimal
> +    global bp_lineno
> +    global GDBFLAGS
> +
> +    # Number of threads started by the program.
> +    set n_threads 10
> +
> +    save_vars { GDBFLAGS } {
> +	append GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\""
> +	append GDBFLAGS " -ex \"set non-stop $non_stop\""
> +	append GDBFLAGS " -ex \"set displaced $displaced\""
> +	append GDBFLAGS " -ex \"set schedule-multiple on\""
> +	clean_restart $binfile
> +    }
> +
> +    set test_spawn_id [spawn_wait_for_attach $binfile]
> +    set testpid [spawn_id_get_pid $test_spawn_id]
> +
> +    set any "\[^\r\n\]*"
> +
> +    gdb_test "add-inferior" "Added inferior 2.*"
> +    gdb_test "inferior 2" "Switching to .*"
> +
> +    gdb_load $binfile
> +    if ![runto setup_done] then {
> +	fail "can't run to setup_done"
> +	kill_wait_spawned_process $test_spawn_id
> +	return
> +    }
> +
> +    gdb_test_no_output "set breakpoint condition-evaluation $condition_eval"
> +
> +    # Get the PID of the test process.
> +    set pid_inf2 ""
> +    gdb_test_multiple "p mypid" "get pid of inferior 2" {
> +	-re " = ($decimal)\r\n$gdb_prompt $" {
> +	    set pid_inf2 $expect_out(1,string)
> +	    pass $gdb_test_name
> +	}
> +    }
> +
> +    set attempts 3
> +    for {set attempt 1} { $attempt <= $attempts } { incr attempt } {
> +	with_test_prefix "iter $attempt" {
> +	    gdb_test "inferior 1" "Switching to .*"
> +
> +	    set attached 0
> +	    set eperm 0
> +	    set test "attach"
> +	    gdb_test_multiple "attach $testpid" $test {
> +		-re "new threads in iteration" {
> +		    # Seen when "set debug libthread_db" is on.
> +		    exp_continue
> +		}
> +		-re "is a zombie - the process has already terminated.*$gdb_prompt " {
> +		    fail $gdb_test_name
> +		}
> +		-re "Unable to attach: .*$gdb_prompt " {
> +		    fail $gdb_test_name
> +		}
> +		-re "Attaching to program.*process $testpid.*$gdb_prompt " {
> +		    pass $test
> +		    set attached 1
> +		}
> +	    }
> +
> +	    if {!$attached} {
> +		kill_wait_spawned_process $test_spawn_id
> +		return
> +	    }
> +
> +	    if {$non_stop} {
> +		# In non-stop, we will see one stop per thread after
> +		# the prompt.
> +		set stops 0
> +		set tid_re "$::decimal\.$::decimal"
> +		set test "seen all stops"
> +		for {set thread 1} { $thread <= $n_threads } { incr thread } {
> +		    if {[gdb_test_multiple "" $test {
> +			-re "Thread ${tid_re} ${any} stopped" {
> +			    incr stops
> +			}
> +		    }] != 0} {
> +			break
> +		    }
> +		}
> +
> +		# This we haven't seen all stops, then the

This sentence misses something, like in the other test.

I am running it in a loop here and it's passing so far :).  Really, congrats
and thanks for this series, that looked like some hardcore debugging.

Simon

  reply	other threads:[~2021-01-13  7:05 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13  1:15 [PATCH 00/12] Fix detach + displaced-step regression + N bugs more Pedro Alves
2021-01-13  1:15 ` [PATCH 01/12] Fix attaching in non-stop mode Pedro Alves
2021-01-13  3:11   ` Simon Marchi
2021-02-03  1:21     ` Pedro Alves
2021-01-13  1:15 ` [PATCH 02/12] Fix "target extended-remote" + "maint set target-non-stop" + "attach" Pedro Alves
2021-01-13  5:01   ` Simon Marchi
2021-01-13  1:15 ` [PATCH 03/12] Testcase for attaching in non-stop mode Pedro Alves
2021-01-13  5:09   ` Simon Marchi
2021-02-03  1:23     ` Pedro Alves
2021-01-13  1:15 ` [PATCH 04/12] Fix a couple vStopped pending ack bugs Pedro Alves
2021-01-13  5:29   ` Simon Marchi
2021-02-03  1:25     ` Pedro Alves
2021-01-13  1:15 ` [PATCH 05/12] gdbserver: spurious SIGTRAP w/ detach while step-over in progress Pedro Alves
2021-01-13  6:00   ` Simon Marchi
2021-02-03  1:26     ` Pedro Alves
2021-01-13  1:15 ` [PATCH 06/12] Factor out after-stop event handling code from stop_all_threads Pedro Alves
2021-01-13  6:06   ` Simon Marchi
2021-02-03  1:26     ` Pedro Alves
2021-01-13  1:15 ` [PATCH 07/12] prepare_for_detach: don't release scoped_restore at the end Pedro Alves
2021-01-13  6:08   ` Simon Marchi
2021-02-03  1:27     ` Pedro Alves
2021-01-13  1:15 ` [PATCH 08/12] prepare_for_detach and ongoing displaced stepping Pedro Alves
2021-01-13  6:23   ` Simon Marchi
2021-01-13  1:15 ` [PATCH 09/12] detach and breakpoint removal Pedro Alves
2021-01-13  6:32   ` Simon Marchi
2021-02-03  1:28     ` Pedro Alves
2021-01-13  1:15 ` [PATCH 10/12] detach with in-line step over in progress Pedro Alves
2021-01-13  6:39   ` Simon Marchi
2021-01-13  1:15 ` [PATCH 11/12] detach in all-stop with threads running Pedro Alves
2021-01-13  6:55   ` Simon Marchi
2021-02-03  1:31     ` Pedro Alves
2021-07-12 15:36   ` Jonah Graham
2021-07-12 19:36     ` Pedro Alves
2021-01-13  1:15 ` [PATCH 12/12] Testcase for detaching while stepping over breakpoint Pedro Alves
2021-01-13  7:05   ` Simon Marchi [this message]
2021-02-03  1:33     ` 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=f32dac2e-707e-7a59-fc39-851f7d3d3251@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).