From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id B33623858D3C for ; Mon, 23 Jan 2023 22:03:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B33623858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x12b.google.com with SMTP id g16so809519ilr.1 for ; Mon, 23 Jan 2023 14:03:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fvDwv/L64+9Fet0VA0L6mznIr6ouZn/IvAuIs+23c4c=; b=epxYcBj/viEcuKuERyamDtjnVKzgnKK/VAHqsKqn01DyZMcXa6Oh5G/voGxjaPb6LS zPq0cNUr1cYWoLVuVi0TZPEDGcDN7zIhiSOQRFI5WEdvjLDm108BpkNoTaZzUIQhWAb2 M4KJx1JrPT+knjtU2jNSHTWFr4Q5XPf6CzfmUmKn9TeBjvCmt9kuFCAfahAfqVBpAZSg 5+Yx6T2/Y9ywFxlGe9fMukZVrlzMEkMux310Q//tuKQ5UTedDni9f/xf7IU14dq0J39f SD2xyMfhn+82jXKt9o8rWstUlU4JXHROgCCgTbU6p6ipBospsrCyr1Cy1du5ijo2LZfi V6Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fvDwv/L64+9Fet0VA0L6mznIr6ouZn/IvAuIs+23c4c=; b=KvT5zWjlj49AkkCAdsev3YKfO75Oe43S0/YMX05KMD6I45dDIBJk6NCVBmU+dXgrrz POlcKKBObo/X2eIjNQSmE1+KPKDe4HMBVpK0/lW/LWRRtu3bQFlpfRTsZ3uat3NatRRu wm8CFgT830wmQ1slIoyxRvbtcL9xz51ooCh0mlecaCA34zN9uVdqqDwbqLY7soEuP5Ns XOQb4ha/4gvzqvkMu7JFWsYn3iREmPRS4GwMrBbXL/8rMU8vM5NmiKfxPgpj1LPYMcvr NCt3YWd+GN1w+lFaNLhtXLZn31qb+/lVBloYHqk1sK+mPt+hViMAOHls1gFGT8fZOAAW tgDw== X-Gm-Message-State: AFqh2kouVwl/KLq/ld9G7wirHL0HzAHL/kWRmrQhvk9+lOIEjsyg0b6t lbpXRy/uCdzE2FMFk3aEf2aGiNv9uqACxR+i X-Google-Smtp-Source: AMrXdXukCGvhu+n2gftv48POJGjWQvuI3PFV3zCicCOduVjr+f0Pn0rlmgqjc9Eo1ourA0SaH/QaDw== X-Received: by 2002:a05:6e02:1a05:b0:30c:8ca:2f58 with SMTP id s5-20020a056e021a0500b0030c08ca2f58mr22922338ild.22.1674511391923; Mon, 23 Jan 2023 14:03:11 -0800 (PST) Received: from localhost.localdomain (97-122-76-186.hlrn.qwest.net. [97.122.76.186]) by smtp.gmail.com with ESMTPSA id s2-20020a92cc02000000b0030c661606eesm137490ilp.63.2023.01.23.14.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 14:03:11 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/2] Avoid FAILs in gdb.compile Date: Mon, 23 Jan 2023 15:02:57 -0700 Message-Id: <20230123220257.3773828-3-tromey@adacore.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230123220257.3773828-1-tromey@adacore.com> References: <20230123220257.3773828-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Many gdb.compile C++ tests fail for me on Fedora 36. I think these are largely bugs in the plugin, though I didn't investigate too deeply. Once one failure is seen, this often cascades and sometimes there are many timeouts. For example, this can happen: (gdb) compile code var = a->get_var () warning: Could not find symbol "_ZZ9_gdb_exprP10__gdb_regsE1a" for compiled module "/tmp/gdbobj-0xdI6U/out2.o". 1 symbols were missing, cannot continue. I think this is probably a plugin bug because, IIRC, in theory these symbols should be exempt from a lookup via gdb. This patch arranges to catch any catastrophic failure and then simply exit the entire .exp file. --- gdb/testsuite/gdb.compile/compile-cplus.exp | 4 +- gdb/testsuite/lib/compile-support.exp | 59 ++++++++++++++++++--- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp index 0b7cb59727a..1b926844f06 100644 --- a/gdb/testsuite/gdb.compile/compile-cplus.exp +++ b/gdb/testsuite/gdb.compile/compile-cplus.exp @@ -113,7 +113,7 @@ gdb_test "compile code *(volatile int *) 0 = 0;" \ "The program being debugged was signaled while in a function called from GDB\\.\r\nGDB remains in the frame where the signal was received\\.\r\n.*" \ "compile code segfault first" gdb_test "bt" \ - "\r\n#0 \[^\r\n\]* in _gdb_expr \[^\r\n\]*\r\n#1 \r\n.*" + "\r\n#0 \[^\r\n\]*_gdb_expr \[^\r\n\]*\r\n#1 .*" set test "p/x \$pc" set infcall_pc 0 @@ -242,7 +242,9 @@ gdb_test "print globalvar" " = 20" "print unresolved value" gdb_test_no_output "compile code globalshadow += 1;" gdb_test "print globalshadow" " = 101" +setup_kfail {no bug filed} *-*-* gdb_test_no_output "compile code extern int globalshadow; globalshadow += 5;" +setup_kfail {fails due to previous test} *-*-* gdb_test "print 'compile-cplus.c'::globalshadow" " = 15" gdb_test "print globalshadow" " = 101" "print globalshadow second time" gdb_test_no_output "compile code staticshadow += 2;" diff --git a/gdb/testsuite/lib/compile-support.exp b/gdb/testsuite/lib/compile-support.exp index 64fda8c58a2..a8cf52f1f00 100644 --- a/gdb/testsuite/lib/compile-support.exp +++ b/gdb/testsuite/lib/compile-support.exp @@ -41,6 +41,10 @@ proc _do_check_compile {expr} { # See PR compile/29541. set result "confused by glibc debuginfo" } + -re "$::decimal symbols were missing, cannot continue" { + # This appears to be a bug in the compiler plugin. + set result "apparent compiler plugin bug" + } -re "\r\n$gdb_prompt $" { } } @@ -189,17 +193,55 @@ namespace eval ::CompileExpression { set value $l } + set ok 1 if {!$nocode} { - do_test_ code $exp $result $explicit $name \ - [list $compile $value $print] + if {![do_test_ code $exp $result $explicit $name \ + [list $compile $value $print]]} { + set ok 0 + } + } + if {$ok && !$noprint} { + if {![do_test_ print $exp $result $explicit $name \ + [list $compile $value $print]]} { + set ok 0 + } } - if {!$noprint} { - do_test_ print $exp $result $explicit $name \ - [list $compile $value $print] + if {!$ok} { + return -code return 0 } } + # Invoke a 'compile' command of some form. COMMAND is the + # command, RESULT is the expected output, and NAME is the test + # name. Issues a pass or fail. Returns 1 on success, 0 if there + # is a failure that should result in the entire remaining .exp + # being stopped; in this case an 'unsupported' is issued. + + proc compile_command_ {command result name} { + global gdb_prompt + set this_result 1 + gdb_test_multiple $command $name { + -re "WARNING .* there are active plugins, do not report this" { + # Note that the regexp above does not check for the + # prompt. This avoids a gratuitous timeout. + unsupported "GCC compiler plugin crashed" + set this_result 0 + } + -re "$::decimal symbols were missing, cannot continue" { + # This appears to be a bug in the compiler plugin. + unsupported "GCC compiler plugin bug" + set this_result 0 + } + -re -wrap "$result" { + pass $name + } + } + return $this_result + } + # Run a compile test for CMD ("print" or "code"). + # Return 1 on success, 0 if there is some kind of catastrophic + # error. proc do_test_ {cmd exp result is_explicit tst fail_list} { variable varName_ @@ -221,7 +263,7 @@ namespace eval ::CompileExpression { if {[string match $cmd "print"]} { if {!$is_explicit} { eval setup_failures_ $fail_print - gdb_test "compile print $exp" $result $tst + return [compile_command_ "compile print $exp" $result $tst] } } else { if {$is_explicit} { @@ -230,10 +272,13 @@ namespace eval ::CompileExpression { set command "compile code $varName_ = $exp" } eval setup_failures_ $fail_compile - gdb_test_no_output $command $tst + if {![compile_command_ $command "" $tst]} { + return 0 + } eval setup_failures_ $fail_value gdb_test "p $varName_" "= $result" "result of $tst" } + return 1 } # A convenience proc used to set up xfail and kfail tests. -- 2.38.1