1 /* This testcase is part of GDB, the GNU debugger. 2 3 Copyright 2011-2021 Free Software Foundation, Inc. 4 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. 9 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. 14 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/>. */ 17 18 #ifdef SYMBOL_PREFIX 19 #define SYMBOL(str) SYMBOL_PREFIX #str 20 #else 21 #define SYMBOL(str) #str 22 #endif 23 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. */ 27 28 /* Please keep gdb_trace_common_supports_arch in lib/trace-support.exp 29 in sync when adding new targets to this file. */ 30 31 #if (defined __x86_64__ || defined __i386__) 32 33 static void __attribute__ ((used)) x86_trace_dummy()34x86_trace_dummy () 35 { 36 int x = 0; 37 int y = x + 4; 38 } 39 40 #define FAST_TRACEPOINT_LABEL(name) \ 41 asm (" .global " SYMBOL(name) "\n" \ 42 SYMBOL(name) ":\n" \ 43 " call " SYMBOL(x86_trace_dummy) "\n" \ 44 ) 45 46 #elif (defined __aarch64__) || (defined __powerpc__) 47 48 #define FAST_TRACEPOINT_LABEL(name) \ 49 asm (" .global " SYMBOL(name) "\n" \ 50 SYMBOL(name) ":\n" \ 51 " nop\n" \ 52 ) 53 54 #elif (defined __s390__) 55 56 #define FAST_TRACEPOINT_LABEL(name) \ 57 asm (" .global " SYMBOL(name) "\n" \ 58 SYMBOL(name) ":\n" \ 59 " mvc 0(8, %r15), 0(%r15)\n" \ 60 ) 61 62 #else 63 64 #error "unsupported architecture for trace tests" 65 66 #endif 67