From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 74BE13858D39 for ; Fri, 4 Mar 2022 10:15:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 74BE13858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxWs2_5iFi5KsCAA--.13085S3; Fri, 04 Mar 2022 18:15:27 +0800 (CST) From: Tiezhu Yang 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 Message-Id: <1646388927-28165-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1646388927-28165-1-git-send-email-yangtiezhu@loongson.cn> References: <1646388927-28165-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9AxWs2_5iFi5KsCAA--.13085S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Aw45JFyrWr17uF1rCryDKFg_yoW5Jrykp3 W2qryvkr18WF1ava9xZ3y8A34Fyr92kry5W34xJr4Svrs8GFWUWry3K34akrZxJrsYv343 ZwnIvrW3Gr1UtFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Cb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI 8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kE wVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x 0267AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7Cj xVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrV C2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE 7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY02Avz4vE14v_Gw1l42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1Y6r17MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAv wI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14 v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07bo0PhUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2022 10:15:33 -0000 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 --- 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