From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tiezhu Yang <yangtiezhu@loongson.cn>, gdb-patches@sourceware.org
Cc: Pedro Alves <pedro@palves.net>
Subject: Re: [PATCH v2 4/4] gdb: testsuite: use gdb_attach to fix jit-elf.exp
Date: Thu, 17 Mar 2022 08:02:00 -0400 [thread overview]
Message-ID: <0596ed71-58be-6694-d2d4-aac666b555e4@polymtl.ca> (raw)
In-Reply-To: <1647492213-21824-5-git-send-email-yangtiezhu@loongson.cn>
On 2022-03-17 00:43, Tiezhu Yang wrote:
> If /proc/sys/kernel/yama/ptrace_scope is 1, when execute the following
> command without superuser:
>
> make check-gdb TESTS="gdb.base/jit-elf.exp"
>
> we can see the following messages in gdb/testsuite/gdb.log:
>
> (gdb) attach 1650108
> Attaching to program: /home/yangtiezhu/build/gdb/testsuite/outputs/gdb.base/jit-elf/jit-elf-main, process 1650108
> ptrace: Operation not permitted.
> (gdb) FAIL: gdb.base/jit-elf.exp: attach: one_jit_test-2: break here 1: attach
>
> use gdb_attach to fix the above issue.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> gdb/testsuite/gdb.base/jit-elf.exp | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.base/jit-elf.exp b/gdb/testsuite/gdb.base/jit-elf.exp
> index 8a4c5b7..61ddb2a 100644
> --- a/gdb/testsuite/gdb.base/jit-elf.exp
> +++ b/gdb/testsuite/gdb.base/jit-elf.exp
> @@ -57,11 +57,10 @@ proc clean_reattach {} {
>
> clean_restart ${main_binfile}
>
> - set test "attach"
> - gdb_test_multiple "attach $testpid" "$test" {
> - -re "Attaching to program.*.*main.*at .*$main_srcfile:.*$gdb_prompt $" {
> - pass "$test"
> - }
> + if {![gdb_attach $testpid {
> + "pattern" "main.*at .*$::main_srcfile:.*"
> + }]} {
> + return
> }
I suggest writing it like this, it will be more readable:
set attach_opts {
"pattern" "main.*at .*$::main_srcfile:.*"
}
if { ![gdb_attach $testpid $attach_opts] } {
return
}
I still get some failures when I run with ptrace_scope=1, meaning we are
missing something. I think that the clean_reattach proc should return a
value to indicate whether it worked, and the callers should return early
as well on failure, all the way up to the top-level of the test.
Simon
prev parent reply other threads:[~2022-03-17 12:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-17 4:43 [PATCH v2 0/4] gdb: add gdb_attach to fix failed testcases Tiezhu Yang
2022-03-17 4:43 ` [PATCH v2 1/4] gdb: testsuite: remove attach test from can_spawn_for_attach Tiezhu Yang
2022-03-17 11:50 ` Simon Marchi
2022-03-17 4:43 ` [PATCH v2 2/4] gdb: testsuite: add new gdb_attach to check "attach" command Tiezhu Yang
2022-03-17 11:51 ` Simon Marchi
2022-03-17 12:02 ` Simon Marchi
2022-03-17 12:29 ` Tiezhu Yang
2022-03-17 4:43 ` [PATCH v2 3/4] gdb: testsuite: use gdb_attach to fix attach-pie-noexec.exp Tiezhu Yang
2022-03-17 11:56 ` Simon Marchi
2022-03-17 4:43 ` [PATCH v2 4/4] gdb: testsuite: use gdb_attach to fix jit-elf.exp Tiezhu Yang
2022-03-17 12:02 ` Simon Marchi [this message]
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=0596ed71-58be-6694-d2d4-aac666b555e4@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--cc=yangtiezhu@loongson.cn \
/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).