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 DBA79385840F for ; Thu, 17 Mar 2022 14:01:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DBA79385840F 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 AQAAf9DxbxMePzNiJPYKAA--.8489S3; Thu, 17 Mar 2022 22:01:03 +0800 (CST) From: Tiezhu Yang To: gdb-patches@sourceware.org Cc: Simon Marchi , Pedro Alves Subject: [PATCH v3 1/4] gdb: testsuite: remove attach test from can_spawn_for_attach Date: Thu, 17 Mar 2022 22:00:58 +0800 Message-Id: <1647525661-8607-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1647525661-8607-1-git-send-email-yangtiezhu@loongson.cn> References: <1647525661-8607-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9DxbxMePzNiJPYKAA--.8489S3 X-Coremail-Antispam: 1UD129KBjvJXoWxZryUZFWrWF1UCrW3Ar45GFg_yoW5uFWDpa naqr92kFyrXryagaykAw40q3W0yry0va45C34xJr1fZF4UCry8Kry3K34FvF93JrWv939x ZanFvr43CFWjyFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUB0b7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI 8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_Jrv_JF4l8cAvFVAK0II2c7xJM28CjxkF 64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcV CY1x0267AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIE c7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I 8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCF s4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY02Avz4vE14v_Xryl42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1Y6r17MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUg_b1UUUUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-12.2 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: Thu, 17 Mar 2022 14:01:13 -0000 As Pedro Alves said, caching procs should not issue pass/fail [1], this commit removes attach test from can_spawn_for_attach, at the same time, use "verbose -log" instead of "unsupported" to get a trace about why a test run doesn't support spawning for attach. [1] https://sourceware.org/pipermail/gdb-patches/2022-March/186311.html Signed-off-by: Tiezhu Yang --- gdb/testsuite/lib/gdb.exp | 52 ++++++++--------------------------------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 08726f7..89dcd0a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5090,12 +5090,12 @@ proc gdb_exit { } { # Return true if we can spawn a program on the target and attach to # it. -gdb_caching_proc can_spawn_for_attach { +proc can_spawn_for_attach { } { # We use exp_pid to get the inferior's pid, assuming that gives # back the pid of the program. On remote boards, that would give # us instead the PID of e.g., the ssh client, etc. if [is_remote target] then { - unsupported "skip attach tests (target is remote)" + verbose -log "can't spawn for attach (target is remote)" return 0 } @@ -5103,50 +5103,10 @@ gdb_caching_proc can_spawn_for_attach { # stub-like, where GDB finds the program already started on # initial connection. if {[target_info exists use_gdb_stub]} { - unsupported "skip attach tests (target is stub)" + verbose -log "can't spawn for attach (target is stub)" return 0 } - set me "can_spawn_for_attach" - set src { int main (void) { sleep (600); return 0; } } - if {![gdb_simple_compile $me $src executable]} { - return 0 - } - - set test_spawn_id [spawn_wait_for_attach $obj] - set test_pid [spawn_id_get_pid $test_spawn_id] - - gdb_start - file delete $obj - gdb_test_multiple "attach $test_pid" "can spawn for attach" { - -re -wrap "Attaching to process $test_pid\r\n.*No executable file now.*" { - pass $gdb_test_name - kill_wait_spawned_process $test_spawn_id - return 1 - } - -re -wrap "Attaching to 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 - return 0 - } - -re -wrap "Attaching to process $test_pid\r\n.*XML support was disabled at compile time.*" { - pass $gdb_test_name - 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 - } - } - - kill_wait_spawned_process $test_spawn_id - # Assume yes. return 1 } @@ -5196,6 +5156,12 @@ proc spawn_id_get_pid { spawn_id } { proc spawn_wait_for_attach { executable_list } { set spawn_id_list {} + if ![can_spawn_for_attach] { + # The caller should have checked can_spawn_for_attach itself + # before getting here. + error "can't spawn for attach with this target/board" + } + foreach {executable} $executable_list { # Note we use Expect's spawn, not Tcl's exec, because with # spawn we control when to wait for/reap the process. That -- 2.1.0