aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2023-12-01 11:27:37 -0500
committerSimon Marchi <simon.marchi@efficios.com>2023-12-14 16:04:50 +0000
commitf5d420bbceeb1d5065c3d91dd7c6c1e43f855ca1 (patch)
tree57fb177a2cef893f453ba339f83032a42925b43c /gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S
parentfa7513798064246f0481385d2f5918c66dddaa8e (diff)
downloadgdb-f5d420bbceeb1d5065c3d91dd7c6c1e43f855ca1.zip
gdb-f5d420bbceeb1d5065c3d91dd7c6c1e43f855ca1.tar.gz
gdb-f5d420bbceeb1d5065c3d91dd7c6c1e43f855ca1.tar.bz2
gdb/testsuite: add tests for unwinding of pseudo registers
This patch adds tests to exercise the previous patches' changes. All three tests: - aarch64-pseudo-unwind - amd64-pseudo-unwind - arm-pseudo-unwind follow the same pattern, just with different registers. The other test, arm-pseudo-unwind-legacy, tests the special case where the unwind information contains an entry for a register considered a pseudo-register by GDB. Change-Id: Ic29ac040c5eb087b4a0d79f9d02f65b7979df30f Reviewed-By: John Baldwin <jhb@FreeBSD.org> Reviewed-by: Luis Machado <luis.machado@arm.com> Approved-By: Luis Machado <luis.machado@arm.com> (aarch64/arm) Tested-By: Luis Machado <luis.machado@arm.com> (aarch64/arm)
Diffstat (limited to 'gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S')
-rw-r--r--gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S66
1 files changed, 66 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S
new file mode 100644
index 0000000..c306b82
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind-asm.S
@@ -0,0 +1,66 @@
+/* Copyright 2018-2023 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ 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/>. */
+
+.section .note.GNU-stack,"",%progbits
+
+.text
+.global callee
+callee:
+ /* Standard prologue. */
+.cfi_startproc
+ push %rbp
+.cfi_def_cfa rbp, 16
+ mov %rsp, %rbp
+
+ /* Save caller's rbx value on the stack. */
+.cfi_offset rbx, -24
+ push %rbx
+
+ /* Put our own rbx value. */
+ mov $0x2021222324252627, %rbx
+break_here_asm:
+
+ /* Restore caller's rbx value. */
+ pop %rbx
+
+ /* Standard epilogue. */
+ pop %rbp
+ ret
+.cfi_endproc
+
+
+.global caller
+caller:
+.cfi_startproc
+ /* Standard prologue. */
+ push %rbp
+.cfi_def_cfa_offset 16
+ mov %rsp, %rbp
+
+ /* Put our own rbx value. */
+ mov $0x1011121314151617, %rbx
+
+ /* Call callee. */
+ call callee
+
+ /* Store our rbx value in rax to return it. */
+ mov %rbx, %rax
+
+ /* Standard epilogue. */
+ pop %rbp
+ ret
+.cfi_endproc