From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QShxIV89g2p8RC0AWB0awg (envelope-from ) for ; Mon, 17 Aug 2026 12:57:03 -0400 Received: by simark.ca (Postfix, from userid 112) id 860F91E09B; Mon, 17 Aug 2026 12:57:03 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E9B041E09B for ; Mon, 17 Aug 2026 12:57:02 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CEBE64BAE7DA for ; Mon, 17 Aug 2026 16:57:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CEBE64BAE7DA Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by sourceware.org (Postfix) with ESMTP id CB1184BAE7E4 for ; Mon, 17 Aug 2026 16:53:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CB1184BAE7E4 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orcam.me.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CB1184BAE7E4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:4190:8020::34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786985627; cv=none; b=Rgi+I5JLSb/dJx6QJyCrQXOgQzJyLN9Qsqu/MPMFyb2b5y0kD8Kp9EltqjBQsK+cPpFabwefoGGQom7aTzI+xdm/Jpzdp+pXjwfOXSwJ/cJwxSV7eKBWcg8rDJBaAoOQjputopQX5od+f1FaG9zn1e2flcs9GKEsGfrlqInv5BI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786985627; c=relaxed/simple; bh=aiJlzefBPF4cx5x0Ujo5peMIJq5sGGtBhZRy8feRT1A=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=Y1kaKWm+FmoPTUcjud2JsYv4VHNS+9msOiU7rd9ixwIVrNT+s/c3hgSpFeUDUE2tUQwx+xu/dY8DxPgCRrKizAbXigw94Uq5mCH7t1JEX7+/PjRHEsEs3a+Ubv07JW5cIPON5byKs29lND1u9MfuF8KFEhmbKSQIWgyfWrPgodw= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB1184BAE7E4 Received: by angie.orcam.me.uk (Postfix, from userid 500) id 57E199200B3; Mon, 17 Aug 2026 18:53:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 51CF992009B; Mon, 17 Aug 2026 17:53:46 +0100 (BST) Date: Mon, 17 Aug 2026 17:53:46 +0100 (BST) From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org cc: Jovan Dmitrovic , Djordje Todorovic , Milica Matic , "Maciej W. Rozycki" Subject: [PATCH v2 06/12] MIPS/testsuite: Verify MIPS DSP ASE branch stepping In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "Maciej W. Rozycki" Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org From: Maciej W. Rozycki Verify that breakpoints are correctly placed via `mips32_next_pc' while single-stepping through MIPS DSP ASE branches. No 64-bit support here. Approved-By: Maciej W. Rozycki --- New change in v2. --- gdb/testsuite/gdb.arch/mips-allow.exp.tcl | 19 +++++++ gdb/testsuite/gdb.arch/mips-dsp-branch.c | 69 +++++++++++++++++++++++++++++ gdb/testsuite/gdb.arch/mips-dsp-branch.exp | 30 ++++++++++++ 3 files changed, 118 insertions(+) gdb-mips-dsp-next-pc-test.diff Index: binutils-gdb/gdb/testsuite/gdb.arch/mips-allow.exp.tcl =================================================================== --- binutils-gdb.orig/gdb/testsuite/gdb.arch/mips-allow.exp.tcl +++ binutils-gdb/gdb/testsuite/gdb.arch/mips-allow.exp.tcl @@ -84,3 +84,22 @@ proc allow_mips2_branch_tests {} { {-Wa,-fatal-warnings -mno-mips16 -mno-micromips -minterlink-compressed}] } + +# Check for MIPS DSP ASE instruction support. These instructions may +# be absent, such as with pre-MIPSr2 compilations or non-DSP hardware. +proc allow_mips_dsp_ase_tests {} { + return [allow_target_tests "allow_mips_dsp_ase_tests" \ + "MIPS DSP instruction support" "Illegal instruction" \ + { + int main() { + asm volatile ( + ".set push\n\t" + ".set noreorder\n\t" + ".set nomacro\n\t" + "rddsp $0, 0\n\t" + ".set pop\n"); + return 0; + } + } \ + {-Wa,-fatal-warnings -mno-mips16 -minterlink-compressed -mdsp}] +} Index: binutils-gdb/gdb/testsuite/gdb.arch/mips-dsp-branch.c =================================================================== --- /dev/null +++ binutils-gdb/gdb/testsuite/gdb.arch/mips-dsp-branch.c @@ -0,0 +1,69 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright (C) 2026 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be usefu, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Test single-stepping through MIPS DSP branch instructions. */ + +int +test_mips_dsp_branch (void) +{ + /* Make 'err' available to the debugger to track the number of single + steps executed. Use `volatile' to prevent the variable from being + optimized away. */ + volatile int err = -1; + + int thr_one = 31; + int thr_two = 32; + int thr_thr = 33; + + asm volatile ( + ".macro b_test op\n\t" + "\\op 0f\n\t" + " nop\n\t" + "nop\n" + "0:\n\t" + ".endm\n\t" + + ".set push\n\t" + ".set noreorder\n\t" + ".globl step_start\n\t" + ".type step_start, @function\n" + "step_start:\n\t" /* Units: steps. */ + "nop\n\t" /* NOP: 1s */ + "wrdsp %[thr_one], 1\n\t" /* WRDSP: 1s */ + "b_test bposge32\n\t" /* Not taken: 2s */ + "wrdsp %[thr_two], 1\n\t" /* WRDSP: 1s */ + "b_test bposge32\n\t" /* Taken: 1s */ + "wrdsp %[thr_thr], 1\n\t" /* WRDSP: 1s */ + "b_test bposge32\n\t" /* Taken: 1s */ + "nop\n\t" /* NOP: 1s */ + ".globl step_stop\n\t" /* Total: 9s */ + ".type step_stop, @function\n" + "step_stop:\n\t" + ".set pop\n" + : + : [thr_one] "r" (thr_one), [thr_two] "r" (thr_two), + [thr_thr] "r" (thr_thr) + : "$dsp_po"); + + return err; +} + +int +main (void) +{ + return test_mips_dsp_branch (); +} Index: binutils-gdb/gdb/testsuite/gdb.arch/mips-dsp-branch.exp =================================================================== --- /dev/null +++ binutils-gdb/gdb/testsuite/gdb.arch/mips-dsp-branch.exp @@ -0,0 +1,30 @@ +# Copyright (C) 2026 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test single-stepping through MIPS DSP branch instructions. + +require {istarget "mips*-*-*"} + +source $srcdir/$subdir/mips-allow.exp.tcl + +require allow_mips_dsp_ase_tests + +standard_testfile + +set steps 9 +foreach flag {-mno-mips16 -minterlink-compressed -mdsp} { + lappend compile_flags "additional_flags=$flag" +} +source $srcdir/$subdir/mips-stepi.exp.tcl