From: Guinevere Larsen <blarsen@redhat.com>
To: gdb-patches@sourceware.org, Guinevere Larsen <blarsen@redhat.com>
Subject: [PING][PATCH v2] gdb/testsuite: relax filename restriction in some gdb.btrace tests
Date: Wed, 17 Jan 2024 10:10:33 +0100 [thread overview]
Message-ID: <d17653de-99f0-43c3-9ed1-8aceae575ed6@redhat.com> (raw)
In-Reply-To: <20240102140804.771121-1-blarsen@redhat.com>
Ping!
On 02/01/2024 15:08, Guinevere Larsen wrote:
> The test gdb.btrace/tailcall.exp has multiple tests that include the
> filename in the output. When testing with gcc, only a relative path is
> printed, but when using clang, the full file path is printed instead.
> This makes most of those tests fail, with the exception of "record goto
> 4" which allows for more characters before the file name. The test
> gdb.btrace/recod_goto.exp suffers with the same issue
>
> This commit allows for text before the filename. However, instead of how
> the aforementioned "record goto 4", it uses a regexp that doesn't allow
> for newlines, just in case some off output happens.
> ---
> gdb/testsuite/gdb.btrace/record_goto.exp | 27 ++++++++++-------
> gdb/testsuite/gdb.btrace/tailcall.exp | 37 ++++++++++++++----------
> 2 files changed, 37 insertions(+), 27 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp
> index 1817ac07f51..6a7b2dfd0e8 100644
> --- a/gdb/testsuite/gdb.btrace/record_goto.exp
> +++ b/gdb/testsuite/gdb.btrace/record_goto.exp
> @@ -51,6 +51,11 @@ if ![runto_main] {
> return -1
> }
>
> +# When GDB prints the file for a stop location, it may print the full path
> +# depending on what information the compiler added. This regexp allows for
> +# that path to be present, but does not require it.
> +set optional_filepath {[^\n]*}
> +
> # we want a small context sizes to simplify the test
> gdb_test_no_output "set record instruction-history-size 3"
> gdb_test_no_output "set record function-call-history-size 3"
> @@ -80,7 +85,7 @@ gdb_test "record function-call-history /ci 1, +20" [multi_line \
> ]
>
> # let's see if we can go back in history
> -gdb_test "record goto 19" ".*fun4 \\(\\) at record_goto.c:43.*"
> +gdb_test "record goto 19" ".*fun4 \\(\\) at ${optional_filepath}record_goto.c:43.*"
>
> # the function call history should start at the new location
> gdb_test "record function-call-history /ci" [multi_line \
> @@ -97,19 +102,19 @@ gdb_test "record instruction-history" [multi_line \
> ] "instruction-history from 19 forwards"
>
> # let's go to another place in the history
> -gdb_test "record goto 27" ".*fun3 \\(\\) at record_goto.c:35.*"
> +gdb_test "record goto 27" ".*fun3 \\(\\) at ${optional_filepath}record_goto.c:35.*"
>
> # check the back trace at that location
> gdb_test "backtrace" [multi_line \
> - "#0.*fun3.*at record_goto.c:35.*" \
> - "#1.*fun4.*at record_goto.c:43.*" \
> - "#2.*main.*at record_goto.c:49.*" \
> + "#0.*fun3.*at ${optional_filepath}record_goto.c:35.*" \
> + "#1.*fun4.*at ${optional_filepath}record_goto.c:43.*" \
> + "#2.*main.*at ${optional_filepath}record_goto.c:49.*" \
> "Backtrace stopped: not enough registers or memory available to unwind further" \
> ]
>
> # walk the backtrace
> -gdb_test "up" ".*fun4.*at record_goto.c:43.*" "up to fun4"
> -gdb_test "up" ".*main.*at record_goto.c:49.*" "up to main"
> +gdb_test "up" ".*fun4.*at ${optional_filepath}record_goto.c:43.*" "up to fun4"
> +gdb_test "up" ".*main.*at ${optional_filepath}record_goto.c:49.*" "up to main"
>
> # the function call history should start at the new location
> gdb_test "record function-call-history /ci -" [multi_line \
> @@ -126,7 +131,7 @@ gdb_test "record instruction-history -" [multi_line \
> ] "instruction-history from 27 backwards"
>
> # test that we can go to the begin of the trace
> -gdb_test "record goto begin" ".*main \\(\\) at record_goto.c:49.*"
> +gdb_test "record goto begin" ".*main \\(\\) at ${optional_filepath}record_goto.c:49.*"
>
> # check that we're filling up the context correctly
> gdb_test "record function-call-history /ci -" [multi_line \
> @@ -143,7 +148,7 @@ gdb_test "record instruction-history -" [multi_line \
> ] "instruction-history from begin backwards"
>
> # we should get the exact same history from the first instruction
> -gdb_test "record goto 2" ".*fun4 \\(\\) at record_goto.c:40.*"
> +gdb_test "record goto 2" ".*fun4 \\(\\) at ${optional_filepath}record_goto.c:40.*"
>
> # check that we're filling up the context correctly
> gdb_test "record function-call-history /ci -" [multi_line \
> @@ -160,7 +165,7 @@ gdb_test "record instruction-history -" [multi_line \
> ] "instruction-history from 2 backwards"
>
> # check that we can go to the end of the trace
> -gdb_test "record goto end" ".*main \\(\\) at record_goto.c:50.*"
> +gdb_test "record goto end" ".*main \\(\\) at ${optional_filepath}record_goto.c:50.*"
>
> # check that we're filling up the context correctly
> gdb_test "record function-call-history /ci" [multi_line \
> @@ -177,7 +182,7 @@ gdb_test "record instruction-history" [multi_line \
> ] "instruction-history from end forwards"
>
> # we should get the exact same history from the second to last instruction
> -gdb_test "record goto 39" ".*fun4 \\(\\) at record_goto.c:44.*"
> +gdb_test "record goto 39" ".*fun4 \\(\\) at ${optional_filepath}record_goto.c:44.*"
>
> # check that we're filling up the context correctly
> gdb_test "record function-call-history /ci" [multi_line \
> diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp
> index 7fbcd40c077..757538dd5e4 100644
> --- a/gdb/testsuite/gdb.btrace/tailcall.exp
> +++ b/gdb/testsuite/gdb.btrace/tailcall.exp
> @@ -49,6 +49,11 @@ if ![runto_main] {
> return -1
> }
>
> +# When GDB prints the file for a stop location, it may print the full path
> +# depending on what information the compiler added. This regexp allows for
> +# that path to be present, but does not require it.
> +set optional_filepath {[^\n]*}
> +
> # we want to see the full trace for this test
> gdb_test_no_output "set record function-call-history-size 0"
>
> @@ -73,39 +78,39 @@ gdb_test "record function-call-history /c 1" [multi_line \
> ] "indented"
>
> # go into bar
> -gdb_test "record goto 4" ".*bar \\(\\) at .*tailcall.c:24\r\n.*"
> +gdb_test "record goto 4" ".*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*"
>
> # check the backtrace
> gdb_test "backtrace" [multi_line \
> - "#0.*bar \\(\\) at tailcall.c:24" \
> - "#1.*foo \\(\\) at tailcall.c:29" \
> - "#2.*main \\(\\) at tailcall.c:37" \
> + "#0.*bar \\(\\) at ${optional_filepath}tailcall.c:24" \
> + "#1.*foo \\(\\) at ${optional_filepath}tailcall.c:29" \
> + "#2.*main \\(\\) at ${optional_filepath}tailcall.c:37" \
> "Backtrace stopped: not enough registers or memory available to unwind further" \
> ]
>
> # walk the backtrace
> -gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "up to foo"
> -gdb_test "up" "#2\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" "up to main"
> -gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "down to foo"
> +gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" "up to foo"
> +gdb_test "up" "#2\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" "up to main"
> +gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" "down to foo"
>
> # test stepping into and out of tailcalls.
> -gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
> +gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \
> "finish.1"
> -gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" \
> +gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*" \
> "reverse-step.1"
> -gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" \
> +gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" \
> "reverse-finish.1"
> -gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" \
> +gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" \
> "reverse-step.2"
> gdb_test "next" "\[^\r\n\]*38.*" \
> "next.1"
> -gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" \
> +gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" \
> "reverse-next.1"
> -gdb_test "step" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" \
> +gdb_test "step" "\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" \
> "step.1"
> -gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
> +gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \
> "finish.2"
> -gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" \
> +gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*" \
> "reverse-step.3"
> -gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
> +gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \
> "finish.3"
--
Cheers,
Guinevere Larsen
She/Her/Hers
next prev parent reply other threads:[~2024-01-17 9:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 14:08 [PATCH " Guinevere Larsen
2024-01-17 9:10 ` Guinevere Larsen [this message]
2024-01-19 17:15 ` 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=d17653de-99f0-43c3-9ed1-8aceae575ed6@redhat.com \
--to=blarsen@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).