Commit | Line | Data |
---|---|---|
430e004e MK |
1 | /* This testcase is part of GDB, the GNU debugger. |
2 | ||
61baf725 | 3 | Copyright 2011-2017 Free Software Foundation, Inc. |
430e004e MK |
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 | #if (defined __x86_64__ || defined __i386__) | |
29 | ||
30 | static void | |
31 | x86_trace_dummy () | |
32 | { | |
33 | int x = 0; | |
34 | int y = x + 4; | |
35 | } | |
36 | ||
37 | #define FAST_TRACEPOINT_LABEL(name) \ | |
38 | asm (" .global " SYMBOL(name) "\n" \ | |
39 | SYMBOL(name) ":\n" \ | |
40 | " call " SYMBOL(x86_trace_dummy) "\n" \ | |
41 | ) | |
42 | ||
b04fd3be | 43 | #elif (defined __aarch64__) || (defined __powerpc__) |
430e004e MK |
44 | |
45 | #define FAST_TRACEPOINT_LABEL(name) \ | |
46 | asm (" .global " SYMBOL(name) "\n" \ | |
47 | SYMBOL(name) ":\n" \ | |
48 | " nop\n" \ | |
49 | ) | |
50 | ||
a4105d04 MK |
51 | #elif (defined __s390__) |
52 | ||
53 | #define FAST_TRACEPOINT_LABEL(name) \ | |
54 | asm (" .global " SYMBOL(name) "\n" \ | |
55 | SYMBOL(name) ":\n" \ | |
56 | " mvc 0(8, %r15), 0(%r15)\n" \ | |
57 | ) | |
58 | ||
430e004e MK |
59 | #else |
60 | ||
61 | #error "unsupported architecture for trace tests" | |
62 | ||
63 | #endif |