public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/2] gdb: testsuite: fix failed testcases in gdb.base/jit-elf.exp
Date: Fri,  4 Mar 2022 18:15:27 +0800	[thread overview]
Message-ID: <1646388927-28165-2-git-send-email-yangtiezhu@loongson.cn> (raw)
In-Reply-To: <1646388927-28165-1-git-send-email-yangtiezhu@loongson.cn>

If /proc/sys/kernel/yama/ptrace_scope is 0 or you are root user,
When execute the following command:

  make check-gdb TESTS="gdb.base/jit-elf.exp"

we can see the following messages in gdb/testsuite/gdb.log:

  attach 3431435
  ...
  Unable to read JIT descriptor from remote memory
  0x00007fafc9384334 in ?? ()
  (gdb) FAIL: gdb.base/jit-elf.exp: can spawn for attach

or

  attach 1155345
  ...
  Unsupported JIT protocol version 0 in descriptor (expected 1)
  0x00007f01d130337a in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6
  (gdb) FAIL: gdb.base/jit-elf.exp: can spawn for attach

handle the cases related with "*JIT*" in can_spawn_for_attach to
fix the above failed testcases.

If /proc/sys/kernel/yama/ptrace_scope is 1 and you are normal user,
When execute the following command:

  make check-gdb TESTS="gdb.base/jit-elf.exp"

we can see the following messages in gdb/testsuite/gdb.log:

  attach 1350549
  A program is being debugged already.  Kill it? (y or n) y
  Attaching to program: /home/yangtiezhu/build/gdb/testsuite/outputs/gdb.base/jit-elf/jit-elf-main, process 1350549
  ptrace: Operation not permitted.
  (gdb) FAIL: gdb.base/jit-elf.exp: can spawn for attach

also handle the above case in can_spawn_for_attach.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 gdb/testsuite/lib/gdb.exp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f21b22c..8db5d1a 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5119,6 +5119,11 @@ gdb_caching_proc can_spawn_for_attach {
           kill_wait_spawned_process $test_spawn_id
           return 0
         }
+        -re -wrap "Attaching to program: .*, process $test_pid\r\n.*ptrace: Operation not permitted\\." {
+          unsupported "$gdb_test_name (Operation not permitted)"
+          kill_wait_spawned_process $test_spawn_id
+          return 0
+        }
         -re -wrap "Attaching to process $test_pid\r\n.*Attaching to process $test_pid failed" {
           unsupported "$gdb_test_name (Attaching to process failed)"
           kill_wait_spawned_process $test_spawn_id
@@ -5128,6 +5133,10 @@ gdb_caching_proc can_spawn_for_attach {
           kill_wait_spawned_process $test_spawn_id
           return 1
         }
+        -re -wrap ".*JIT.*" {
+          kill_wait_spawned_process $test_spawn_id
+          return 1
+        }
         -re "A program is being debugged already.  Kill it. .y or n. " {
           send_gdb "y\n"
           exp_continue
-- 
2.1.0


  reply	other threads:[~2022-03-04 10:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 10:15 [PATCH 1/2] gdb: testsuite: remove pass statement in can_spawn_for_attach Tiezhu Yang
2022-03-04 10:15 ` Tiezhu Yang [this message]
2022-03-14 13:08   ` [PING] [PATCH 2/2] gdb: testsuite: fix failed testcases in gdb.base/jit-elf.exp Tiezhu Yang
2022-03-14 13:07 ` [PING] [PATCH 1/2] gdb: testsuite: remove pass statement in can_spawn_for_attach Tiezhu Yang
2022-03-16  1:21 ` Simon Marchi
2022-03-16  6:15   ` Tiezhu Yang

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=1646388927-28165-2-git-send-email-yangtiezhu@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --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).