From: Simon Marchi <simark@simark.ca>
To: Kevin Buettner <kevinb@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Test case for Bug 28308
Date: Fri, 5 Nov 2021 12:21:23 -0400 [thread overview]
Message-ID: <63bccc55-dcd0-4a3e-77d8-77ea4bd1971d@simark.ca> (raw)
In-Reply-To: <20211002010054.1546736-3-kevinb@redhat.com>
On 2021-10-01 9:00 p.m., Kevin Buettner via Gdb-patches wrote:
> +# Make sure that there's no running gdb. It's not clear to me
> +# that this is necessary, but a search shows that all other uses of
> +# gdb_spawn first do a gdb_exit.
> +gdb_exit
I'm not sure why that would be necessary here, as there is nothing above
your gdb_exit that spawns GDB. If you had used prepare_for_testing
instead of build_executable, then that would have started GDB, and your
gdb_exit would have been necessary (although I would have told you,
don't use prepare_for_testing if you are to exit GDB right after, use
build_executable :)). So if things work without this gdb_exit (which I
expect), let's just remove it.
> +# Create context in which the global, GDBFLAGS, will be restored at
> +# the end of the block. All commands run within the block are
> +# actually run in the outer context. (This is why 'res' is available
> +# outside of the save_vars block.)
> +save_vars { GDBFLAGS } {
> + # Set flags with which to start GDB.
> + append GDBFLAGS " -ex \"set height unlimited\""
> + append GDBFLAGS " -x \"$x_file\""
> + append GDBFLAGS " --args \"$binfile\""
> +
> + # Start GDB with above flags.
> + set res [gdb_spawn]
> +}
> +
> +set test "Load and run script with -x"
Non-capital "l".
> +if { $res != 0} {
> + fail $test
> + return -1
> +}
> +
> +# The script loaded via -x contains a run command; while running, GDB
> +# is expected to print three messages from dprintf breakpoints along
> +# with three interspersed messages from an ordinary breakpoint (which
> +# was set up with a continue command). Set up pattern D to match
> +# output from hitting the dprintf breakpoint and B for the ordinary
> +# breakpoint. Then set PAT to contain the entire pattern of expected
> +# output from the interspersed dprintf and ordinary breakpoints along
> +# with some (additional) expected output from the dprintf breakpoints,
> +# i.e. 0, 1, and 2.
> +set d "dprintf in increment.., vi="
> +set b "Breakpoint ., inc_vi"
> +set pat "${d}0.*?$b.*?${d}1.*?$b.*?${d}2.*?$b.*?"
> +
> +proc do_test {cmd test} {
> + gdb_test_multiple $cmd $test {
> + -re "$::pat$::inferior_exited_re normally.*$::gdb_prompt $" {
> + pass $test
> + }
> + -re "Don't know how to run.*$::gdb_prompt $" {
> + unsupported $test
> + }
Given you used target_can_use_run_cmd at the top, when would this
unsupported path be taken?
> + }
> +}
> +
> +# Check output from running script with -x
> +do_test "" $test
> +
> +# Restart GDB and 'source' the script; this will (still) run the program
> +# due to the 'run' command in the script.
> +clean_restart $binfile
> +do_test "source $x_file" "Load and run script using source command"
Non-capital "l".
> +
> +# This should leave us at the gdb prompt; Run program again using
> +# already established breakpoints, i.e. those loaded from the
> +# script. Prior to fixing PR 28308, this was the only test that
> +# would pass.
> +do_test "run" "Run again"
Non-capital "r".
Simon
next prev parent reply other threads:[~2021-11-05 16:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-02 1:00 [PATCH 0/2] Fix PR 28308 - dprintf breakpoints not working when run from script Kevin Buettner via Gdb-patches
2021-10-02 1:00 ` [PATCH 1/2] " Kevin Buettner via Gdb-patches
2021-11-05 16:05 ` Simon Marchi
2021-11-10 3:34 ` Kevin Buettner via Gdb-patches
2021-11-16 20:18 ` Tom Tromey
2021-11-18 18:34 ` Kevin Buettner via Gdb-patches
2021-10-02 1:00 ` [PATCH 2/2] Test case for Bug 28308 Kevin Buettner via Gdb-patches
2021-11-05 16:21 ` Simon Marchi [this message]
2021-11-10 1:44 ` Kevin Buettner via Gdb-patches
2021-11-18 22:46 ` Kevin Buettner via Gdb-patches
2021-10-19 9:30 ` [PATCH 0/2] Fix PR 28308 - dprintf breakpoints not working when run from script Kevin Buettner via Gdb-patches
2021-11-02 19:09 ` Kevin Buettner via Gdb-patches
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=63bccc55-dcd0-4a3e-77d8-77ea4bd1971d@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.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