diff --git a/gdb/testsuite/gdb.arch/aarch64-sve-vg-sigunwind.c b/gdb/testsuite/gdb.arch/aarch64-sve-vg-sigunwind.c
new file mode 100644
index 000000000000..f2403ae448d1
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-sve-vg-sigunwind.c
@@ -0,0 +1,87 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2025 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 <http://www.gnu.org/licenses/>.  */
+
+/* Exercise unwinding AArch64's Scalable Vector Extension VG register.   */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>	/* For SVE_VL_MAX.  */
+#include <sys/prctl.h>
+#include <sys/ptrace.h>
+#include <unistd.h>
+
+static int max_vl = 0;
+
+/* Set new value for the SVE vector length.
+   Return the value that was set.  */
+
+static int
+set_vl (int vl)
+{
+  int rc;
+
+  rc = prctl (PR_SVE_SET_VL, vl, 0, 0, 0);
+  if (rc < 0)
+    {
+      perror ("FAILED to PR_SVE_SET_VL");
+      exit (EXIT_FAILURE);
+    }
+
+  return rc & PR_SVE_VL_LEN_MASK;
+}
+
+static void
+sighandler (int)
+{
+  int current_vl;
+
+  /* Decrease vector length by 16 bytes.  */
+  printf ("sighandler: setting to %d\n", max_vl - 16);
+  current_vl = set_vl (max_vl - 16);
+  printf ("sighandler: current_vl = %d\n", current_vl); /* Break here.  */
+}
+
+int
+main (int argc, char *argv[])
+{
+  /* Set vector length to the maximum size allowed.  */
+  max_vl = set_vl (SVE_VL_MAX);
+
+  printf ("main: max_vl = %d\n", max_vl);
+
+  /* If maximum VL is less than 32 bytes we can't decrease it in the signal
+     handler.  */
+  if (max_vl < 32)
+    return 1;
+
+  unsigned char buf[256];
+
+  /* Use an SVE register to make the kernel start saving the SVE bank.  */
+  asm volatile ("mov z0.b, #255\n\t"
+		"str z0, %0"
+		:
+		: "m" (buf)
+		: "z0", "memory");
+
+  struct sigaction sigact;
+  sigact.sa_handler = sighandler;
+  sigaction (SIGUSR1, &sigact, NULL);
+
+  kill (getpid (), SIGUSR1);
+
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/aarch64-sve-vg-sigunwind.exp b/gdb/testsuite/gdb.arch/aarch64-sve-vg-sigunwind.exp
new file mode 100644
index 000000000000..7fea93ffbd58
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/aarch64-sve-vg-sigunwind.exp
@@ -0,0 +1,55 @@
+# Copyright 2025 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 <http://www.gnu.org/licenses/>.
+
+# Exercise unwinding AArch64's Scalable Vector Extension VG register.
+
+require allow_aarch64_sve_tests
+
+standard_testfile
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+	  [list debug additional_flags=-march=armv9-a]] } {
+    return
+}
+
+# We want SIGUSR1 to be delivered normally.
+gdb_test "handle SIGUSR1 nostop" \
+    [multi_line {Signal        Stop	Print	Pass to program	Description} \
+		{SIGUSR1       No	Yes	Yes		User defined signal 1}] \
+    "don't stop for SIGUSR1"
+
+set linespec ${srcfile}:[gdb_get_line_number "Break here."]
+
+if ![runto ${linespec}] {
+    return
+}
+
+set max_vl [get_valueof "" "max_vl" 0]
+set max_vg [expr $max_vl/8]
+
+# If maximum VL is less than 256 bits we can't decrease it in the signal
+# handler and the test can't work.
+if { $max_vl < 32 } {
+    untested "Maximum vector length is too small."
+    return
+}
+
+set reduced_vg [expr "$max_vg - 2"]
+gdb_test "print \$vg" ". = ${reduced_vg}" "vg was reduced"
+
+gdb_test "frame function main" \
+    [multi_line "#$decimal  $hex in main \[^\r\n\]+" \
+		"$decimal\[ \t\]+kill \\(getpid \\(\\), SIGUSR1\\);"]
+
+gdb_test "print \$vg" ". = $max_vg" "vg was correctly unwound"
