From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by sourceware.org (Postfix) with ESMTPS id 463F03858D3C for ; Mon, 2 May 2022 14:32:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 463F03858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f53.google.com with SMTP id t6so19837608wra.4 for ; Mon, 02 May 2022 07:32:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Pt/M6EpVaVDmp9vcN8iu5WJPXf32ceBl0u9miY2pICA=; b=M5w01gH6iItX+LHv+s5PF/Xf0AJhIMoSiqJGDAbw+FmhBgWWqVbqN+RkFIKvx5EdQp 6yCDt6GoxQc0ZfcbEUoCkSkIgMPtt9DWBjBJNVsNkwSBBalDwiTkbqnQS/ZYRNHwhfku WExpRaoK0FVA/fHRYa4gwxBHXPTnYstzapyv5BuHm2ikR5n7t9RsfCJ6uat05nw2PuJy 8Nrh5kw86/oozBPOC9xVZ3MtpPOfgZ+8l+LoG/gUoraMG2IEyu2IjCpOwVOb7TSa3Ts4 S5x6q8fBl7psrIPq9/U0j9wt6ZAv+FiUTjT+SPdXF961Uu8ZUgBhuonHlASt58DGvLfS V3Yw== X-Gm-Message-State: AOAM5317PC/pQcMMKW+tM8hmSiYwBUetzqkbPIyiupMG9Kcbyt1bhGs9 GKOHZCc3Ba6bQpMq9pUBVL4= X-Google-Smtp-Source: ABdhPJyxuXLRG8d9hnVGGWQ/J5uluMoenX2kub4Niz8PUZgPpAN95ysUhHGH4UWtynq71fDy3mVvjg== X-Received: by 2002:a05:6000:1ac8:b0:20c:6ed8:403 with SMTP id i8-20020a0560001ac800b0020c6ed80403mr1554835wry.247.1651501924208; Mon, 02 May 2022 07:32:04 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id e13-20020adfa44d000000b0020c5253d8c0sm7234572wra.12.2022.05.02.07.32.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 07:32:03 -0700 (PDT) Message-ID: <28b5ef68-951f-00db-ae0f-9acdbf12f382@palves.net> Date: Mon, 2 May 2022 15:32:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH] PowerPC: bp-permanent.exp, kill-after-signal fix Content-Language: en-US To: Carl Love , gdb-patches@sourceware.org Cc: Ulrich Weigand , Rogerio Alves References: From: Pedro Alves In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, 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: Mon, 02 May 2022 14:32:07 -0000 On 2022-04-29 02:06, Carl Love via Gdb-patches wrote: > GDB maintainers: > > The gdb.base/bp-permanent.exp and the gdb.base/kill-after-signal tests > fail on Power 10 The tests pass without the patch on Power 9 and > Intel. As stated in the commit log below, the tests have been run on > Power 10 Linux version 5.14.0-70.9.1.el9_0.ppc64le and on a Power 9 > 5.4.0-96-generic kernels. I have examined the code for the > __kernel_start_sigtramp_rt64 function on both systems and the file is > identical. As far as I can tell, the failure is hardware specific. > > The following patch fixes the issue on Power 10 without introducing any > regression failures on Power 9 or Intel. > > Please let me know if the patch is acceptable for mainline gdb. > Thanks. > > Carl Love > > ---------------------------------------------------------------------- > PowerPC: bp-permanent.exp, kill-after-signal fix > > The break point after the stepi on Intel is the entry point of the user > signal handler function test_signal_handler. The code at the break point > looks like: > > 0x : endbr64 > > On Power 10, the address where gdb stops after the stepi is in the kernel. > The code at the breakpoint looks like: > > 0x <__kernel_start_sigtramp_rt64>: bctrl > > Power 10 requires one more stepi to reach the user signal handler. > > The tests run fine on Power 9. The tests have been run on multiple Power 10 > systems. The tests were done with newer and older Linux kernels and gcc > compiler versions from the Power 9 system. The tests fail identically on > the two Power 10 systems but pass on the Power 9 system. > > The two tests were run on the following PowerPC configurations: > > Power 9, Ubuntu 20.04 LE, linux 5.4.0-96-generic, > gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 > > gdb.base/bp-permanent.exp 186 passes, no failures > gdb.base/kill-after-signal.exp 4 passes, no failures > > Power 10, RHEL 9, Linux 5.14.0-70.9.1.el9_0.ppc64le, > gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) > gdb.base/bp-permanent.exp 182 passes, 4 failures > gdb.base/kill-after-signal.exp 3 passes, 1 failure > > Power 10, SLE 15 SP3 , Linux 5.3.18-150300.59.63-default, > gcc (SUSE Linux) 7.5.0 > gdb.base/bp-permanent.exp 182 passes, 4 failures > gdb.base/kill-after-signal.exp 3 passes, 1 failure > > The following patch fixes the tests on Power 10. The patch does not > introduce regessions on Power 9 or Intel systems. > --- > gdb/testsuite/gdb.base/bp-permanent.exp | 8 ++++++++ > gdb/testsuite/gdb.base/kill-after-signal.exp | 15 ++++++++++++++- > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.base/bp-permanent.exp b/gdb/testsuite/gdb.base/bp-permanent.exp > index 8be46e96238..f3f47e675ff 100644 > --- a/gdb/testsuite/gdb.base/bp-permanent.exp > +++ b/gdb/testsuite/gdb.base/bp-permanent.exp > @@ -258,8 +258,16 @@ proc test {always_inserted sw_watchpoint} { > set test "single-step to handler" > gdb_test_multiple "stepi" $test { > -re "Program received signal SIGTRAP.*$gdb_prompt $" { > + # Intel needs one stepi to get to the signal handler. A bit odd to single out "Intel" here, when what this is is really "architectures other than PowerPC". But given Ulrich explained this isn't really about the hardware, but instead the kernel version, I think these comments should be updated to match reality better. > fail $test > } > + -re ".*signal handler called.*" { This is missing expecting the prompt, with either $gdb_prompt, or "-re -wrap". > + # PowerPC needs one more stepi to reach the user > + # signal handler. > + gdb_test "p \$pc" ".*__kernel_start_sigtramp_rt64.*" \ > + "In kernel" lowercase "In". > + gdb_test "stepi" "$decimal.*\{" $test If this got us to the user handler, why isn't it expecting the same exact regexp as the -re below? > + } > -re "handler .*$gdb_prompt $" { > pass $test > } > diff --git a/gdb/testsuite/gdb.base/kill-after-signal.exp b/gdb/testsuite/gdb.base/kill-after-signal.exp > index 09f5cbc39a6..fc1f82bc70a 100644 > --- a/gdb/testsuite/gdb.base/kill-after-signal.exp > +++ b/gdb/testsuite/gdb.base/kill-after-signal.exp > @@ -36,7 +36,20 @@ if ![runto_main] { > } > > gdb_test "continue" "Program received signal SIGUSR1, .*" > -gdb_test "stepi" "\r\nhandler .*" > + > +set test "handler" > +gdb_test_multiple "stepi" $test { > + -re "\r\nhandler .*" { > + # Intel requires one stepi to get to the signal handler. > + pass $test > + } > + -re ".*signal handler called.*" { > + # PowerPC needs one more stepi to reach the user signal handler. > + gdb_test "p \$pc" ".*__kernel_start_sigtramp_rt64.*" "In kernel" > + gdb_test "stepi" "$decimal.*\{" $test > + } > +} Same comments apply here. > + > gdb_test_multiple "kill" "kill" { > -re "Kill the program being debugged\\? \\(y or n\\) $" { > gdb_test "y" "\\\[Inferior $decimal \\(.*\\) killed\\\]" "kill"