aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-03-26 09:42:10 +0000
committerAndrew Burgess <aburgess@redhat.com>2023-04-11 10:11:14 +0100
commit6abf2eeffa3771cf5dbd30fef79c9b7a8c39b973 (patch)
treef3a1c20d336a98620670e9d71bda771e6d77ecf1 /gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c
parent44019209faf3db952a6a04aaeeaa779a8ff7e661 (diff)
downloadgdb-6abf2eeffa3771cf5dbd30fef79c9b7a8c39b973.zip
gdb-6abf2eeffa3771cf5dbd30fef79c9b7a8c39b973.tar.gz
gdb-6abf2eeffa3771cf5dbd30fef79c9b7a8c39b973.tar.bz2
gdb/riscv: Support c.li in prologue unwinder
I was seeing some failures in gdb.threads/omp-par-scope.exp when run on a riscv64 target. It turns out the cause of the problem is that I didn't have debug information installed for libgomp.so, which this test makes use of. The test requires GDB to backtrace through a libgomp function, and the riscv prologue unwinder was failing to unwind this particular stack frame. The reason for the failure to unwind was that the function prologue includes a c.li (compressed load immediate) instruction, and the riscv prologue scanning unwinder doesn't know what to do with this instruction, though the unwinder does understand c.lui (compressed load unsigned immediate). This commit adds support for c.li. After this GDB is able to unwind through libgomp, and I no longer see any unexpected failures in gdb.threads/omp-par-scope.exp. I've also included a new test in gdb.arch/ which specifically checks for our c.li support.
Diffstat (limited to 'gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c')
-rw-r--r--gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c
new file mode 100644
index 0000000..d3a0cb3
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-c_li.c
@@ -0,0 +1,29 @@
+/* Copyright 2023 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/>. */
+
+/* See riscv64-unwind-prologue-with-c_li-asm.s. */
+extern int foo (void);
+
+int
+bar (void)
+{
+ return 0;
+}
+
+int
+main (void)
+{
+ return foo ();
+}