From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 30BD23858D37 for ; Tue, 2 Jan 2024 14:08:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 30BD23858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 30BD23858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704204497; cv=none; b=B+gv0AFMKsalRgMFQX2HIByoOupm1Y03z7Fr0wEiDboJ08/hdzMPJfzW6d0+El5qIRJFTUYgQYEDHwbj5aO49/lJMEJNA99QRKz8XGdMODXEGX2YFuIPXDxzncKprjh06SdaIok16v0e2UUWESx8Sjh9k/gHtiKna05PIM70/6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704204497; c=relaxed/simple; bh=f2W7+mtlwwwhi2wXsQ4Ig+TgLC28933cOWhY+01Pn5Y=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YbGVDnlYzLo6diFLZ6eo/moFsQoYE8T7sO5tGwTR8PXLtZm80bGa/13+764Oay+I41KvG1/y0+DF6XCZt7ObFqtTw17hatI2WqNtz0RrgQOvX4rfVY7UrtWaT2QAxXwwR3IUuHwnxeVOf3n5A/IbYK5O7Y8tZ0bhOO5oyNWcYnE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704204489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bSISJFWPJ0s3lHvHQ82AQdtUaGEJpKg6AGgF/JRgbQc=; b=KEYAjpDgd9cGfATIUWySGXbKRkHDMj4qYuLmvZRGnekJqPj4OS6GpJ2tRfoOIlPawfisbn wVehGOpSAyR2431f00cMxW6+CLHhsTuougmpNYjS/7WBsv2tp2LMRqABYELWBDjASVF/kH /kHybnE+PdKvKQI0o33bSrUQgLwo0X8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-PPBiL-UBOS6E79K-pAJ8pQ-1; Tue, 02 Jan 2024 09:08:08 -0500 X-MC-Unique: PPBiL-UBOS6E79K-pAJ8pQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 923BC85CBA6; Tue, 2 Jan 2024 14:08:07 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F1990492BFA; Tue, 2 Jan 2024 14:08:06 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: schwab@suse.de, Guinevere Larsen Subject: [PATCH v2] gdb/testsuite: relax filename restriction in some gdb.btrace tests Date: Tue, 2 Jan 2024 15:08:04 +0100 Message-ID: <20240102140804.771121-1-blarsen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: The test gdb.btrace/tailcall.exp has multiple tests that include the filename in the output. When testing with gcc, only a relative path is printed, but when using clang, the full file path is printed instead. This makes most of those tests fail, with the exception of "record goto 4" which allows for more characters before the file name. The test gdb.btrace/recod_goto.exp suffers with the same issue This commit allows for text before the filename. However, instead of how the aforementioned "record goto 4", it uses a regexp that doesn't allow for newlines, just in case some off output happens. --- gdb/testsuite/gdb.btrace/record_goto.exp | 27 ++++++++++------- gdb/testsuite/gdb.btrace/tailcall.exp | 37 ++++++++++++++---------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp index 1817ac07f51..6a7b2dfd0e8 100644 --- a/gdb/testsuite/gdb.btrace/record_goto.exp +++ b/gdb/testsuite/gdb.btrace/record_goto.exp @@ -51,6 +51,11 @@ if ![runto_main] { return -1 } +# When GDB prints the file for a stop location, it may print the full path +# depending on what information the compiler added. This regexp allows for +# that path to be present, but does not require it. +set optional_filepath {[^\n]*} + # we want a small context sizes to simplify the test gdb_test_no_output "set record instruction-history-size 3" gdb_test_no_output "set record function-call-history-size 3" @@ -80,7 +85,7 @@ gdb_test "record function-call-history /ci 1, +20" [multi_line \ ] # let's see if we can go back in history -gdb_test "record goto 19" ".*fun4 \\(\\) at record_goto.c:43.*" +gdb_test "record goto 19" ".*fun4 \\(\\) at ${optional_filepath}record_goto.c:43.*" # the function call history should start at the new location gdb_test "record function-call-history /ci" [multi_line \ @@ -97,19 +102,19 @@ gdb_test "record instruction-history" [multi_line \ ] "instruction-history from 19 forwards" # let's go to another place in the history -gdb_test "record goto 27" ".*fun3 \\(\\) at record_goto.c:35.*" +gdb_test "record goto 27" ".*fun3 \\(\\) at ${optional_filepath}record_goto.c:35.*" # check the back trace at that location gdb_test "backtrace" [multi_line \ - "#0.*fun3.*at record_goto.c:35.*" \ - "#1.*fun4.*at record_goto.c:43.*" \ - "#2.*main.*at record_goto.c:49.*" \ + "#0.*fun3.*at ${optional_filepath}record_goto.c:35.*" \ + "#1.*fun4.*at ${optional_filepath}record_goto.c:43.*" \ + "#2.*main.*at ${optional_filepath}record_goto.c:49.*" \ "Backtrace stopped: not enough registers or memory available to unwind further" \ ] # walk the backtrace -gdb_test "up" ".*fun4.*at record_goto.c:43.*" "up to fun4" -gdb_test "up" ".*main.*at record_goto.c:49.*" "up to main" +gdb_test "up" ".*fun4.*at ${optional_filepath}record_goto.c:43.*" "up to fun4" +gdb_test "up" ".*main.*at ${optional_filepath}record_goto.c:49.*" "up to main" # the function call history should start at the new location gdb_test "record function-call-history /ci -" [multi_line \ @@ -126,7 +131,7 @@ gdb_test "record instruction-history -" [multi_line \ ] "instruction-history from 27 backwards" # test that we can go to the begin of the trace -gdb_test "record goto begin" ".*main \\(\\) at record_goto.c:49.*" +gdb_test "record goto begin" ".*main \\(\\) at ${optional_filepath}record_goto.c:49.*" # check that we're filling up the context correctly gdb_test "record function-call-history /ci -" [multi_line \ @@ -143,7 +148,7 @@ gdb_test "record instruction-history -" [multi_line \ ] "instruction-history from begin backwards" # we should get the exact same history from the first instruction -gdb_test "record goto 2" ".*fun4 \\(\\) at record_goto.c:40.*" +gdb_test "record goto 2" ".*fun4 \\(\\) at ${optional_filepath}record_goto.c:40.*" # check that we're filling up the context correctly gdb_test "record function-call-history /ci -" [multi_line \ @@ -160,7 +165,7 @@ gdb_test "record instruction-history -" [multi_line \ ] "instruction-history from 2 backwards" # check that we can go to the end of the trace -gdb_test "record goto end" ".*main \\(\\) at record_goto.c:50.*" +gdb_test "record goto end" ".*main \\(\\) at ${optional_filepath}record_goto.c:50.*" # check that we're filling up the context correctly gdb_test "record function-call-history /ci" [multi_line \ @@ -177,7 +182,7 @@ gdb_test "record instruction-history" [multi_line \ ] "instruction-history from end forwards" # we should get the exact same history from the second to last instruction -gdb_test "record goto 39" ".*fun4 \\(\\) at record_goto.c:44.*" +gdb_test "record goto 39" ".*fun4 \\(\\) at ${optional_filepath}record_goto.c:44.*" # check that we're filling up the context correctly gdb_test "record function-call-history /ci" [multi_line \ diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp index 7fbcd40c077..757538dd5e4 100644 --- a/gdb/testsuite/gdb.btrace/tailcall.exp +++ b/gdb/testsuite/gdb.btrace/tailcall.exp @@ -49,6 +49,11 @@ if ![runto_main] { return -1 } +# When GDB prints the file for a stop location, it may print the full path +# depending on what information the compiler added. This regexp allows for +# that path to be present, but does not require it. +set optional_filepath {[^\n]*} + # we want to see the full trace for this test gdb_test_no_output "set record function-call-history-size 0" @@ -73,39 +78,39 @@ gdb_test "record function-call-history /c 1" [multi_line \ ] "indented" # go into bar -gdb_test "record goto 4" ".*bar \\(\\) at .*tailcall.c:24\r\n.*" +gdb_test "record goto 4" ".*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*" # check the backtrace gdb_test "backtrace" [multi_line \ - "#0.*bar \\(\\) at tailcall.c:24" \ - "#1.*foo \\(\\) at tailcall.c:29" \ - "#2.*main \\(\\) at tailcall.c:37" \ + "#0.*bar \\(\\) at ${optional_filepath}tailcall.c:24" \ + "#1.*foo \\(\\) at ${optional_filepath}tailcall.c:29" \ + "#2.*main \\(\\) at ${optional_filepath}tailcall.c:37" \ "Backtrace stopped: not enough registers or memory available to unwind further" \ ] # walk the backtrace -gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "up to foo" -gdb_test "up" "#2\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" "up to main" -gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "down to foo" +gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" "up to foo" +gdb_test "up" "#2\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" "up to main" +gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" "down to foo" # test stepping into and out of tailcalls. -gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \ +gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \ "finish.1" -gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" \ +gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*" \ "reverse-step.1" -gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" \ +gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" \ "reverse-finish.1" -gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" \ +gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" \ "reverse-step.2" gdb_test "next" "\[^\r\n\]*38.*" \ "next.1" -gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" \ +gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" \ "reverse-next.1" -gdb_test "step" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" \ +gdb_test "step" "\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" \ "step.1" -gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \ +gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \ "finish.2" -gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" \ +gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*" \ "reverse-step.3" -gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \ +gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \ "finish.3" -- 2.43.0