Automatic date update in version.in
[binutils-gdb.git] / gdb / testsuite / gdb.trace / trace-common.h
blob47471d301800251f042078163c53e57a43f92879
1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2011-2024 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 #ifdef SYMBOL_PREFIX
19 #define SYMBOL(str) SYMBOL_PREFIX #str
20 #else
21 #define SYMBOL(str) #str
22 #endif
24 /* FAST_TRACEPOINT_LABEL expands to an assembly instruction large enough to fit
25 a fast tracepoint jump. The parameter is the label where we'll set
26 tracepoints and breakpoints. */
28 /* Please keep gdb_trace_common_supports_arch in lib/trace-support.exp
29 in sync when adding new targets to this file. */
31 #if (defined __x86_64__ || defined __i386__)
33 static void __attribute__ ((used))
34 x86_trace_dummy ()
36 int x = 0;
37 int y = x + 4;
40 #define FAST_TRACEPOINT_LABEL(name) \
41 asm (" .global " SYMBOL(name) "\n" \
42 SYMBOL(name) ":\n" \
43 " call " SYMBOL(x86_trace_dummy) "\n" \
46 #elif (defined __aarch64__) || (defined __powerpc__)
48 #define FAST_TRACEPOINT_LABEL(name) \
49 asm (" .global " SYMBOL(name) "\n" \
50 SYMBOL(name) ":\n" \
51 " nop\n" \
54 #elif (defined __s390__)
56 #define FAST_TRACEPOINT_LABEL(name) \
57 asm (" .global " SYMBOL(name) "\n" \
58 SYMBOL(name) ":\n" \
59 " mvc 0(8, %r15), 0(%r15)\n" \
62 #else
64 #error "unsupported architecture for trace tests"
66 #endif