1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2012-2023 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 #include "attributes.h"
22 #define _SDT_HAS_SEMAPHORES
23 __extension__
unsigned short test_user_semaphore
__attribute__ ((unused
)) __attribute__ ((section (".probes")));
24 #define TEST test_user_semaphore
26 __extension__
unsigned short test_two_semaphore
__attribute__ ((unused
)) __attribute__ ((section (".probes")));
27 #define TEST2 test_two_semaphore
29 __extension__
unsigned short test_m4_semaphore
__attribute__ ((unused
)) __attribute__ ((section (".probes")));
31 __extension__
unsigned short test_pstr_semaphore
__attribute__ ((unused
)) __attribute__ ((section (".probes")));
33 __extension__
unsigned short test_ps_semaphore
__attribute__ ((unused
)) __attribute__ ((section (".probes")));
35 __extension__
unsigned short test_xmmreg_semaphore
__attribute__ ((unused
)) __attribute__ ((section (".probes")));
38 int relocation_marker
__attribute__ ((unused
));
47 /* We only support SystemTap and only the v3 form. */
48 #if _SDT_NOTE_TYPE != 3
49 #error "not using SystemTap v3 probes"
56 const char *(*ps
) (int);
62 /* m1 and m2 are equivalent, but because of some compiler
63 optimizations we have to make each of them unique. This is why
64 we have this dummy variable here. */
65 volatile int dummy
= 0;
68 STAP_PROBE1 (test
, two
, dummy
);
75 STAP_PROBE (test
, two
);
82 STAP_PROBE1 (test
, user
, x
);
89 const char *a
= "This is a test message.";
90 const char *b
= "This is another test message.";
92 STAP_PROBE3 (test
, ps
, a
, b
, val
);
94 return val
== 0 ? a
: b
;
98 static const char * __attribute__((noinline
))
101 volatile register int val_in_reg
asm ("xmm0") = val
;
103 STAP_PROBE1 (test
, xmmreg
, val_in_reg
);
105 return val
== 0 ? "xxx" : "yyy";
108 static const char * __attribute__((noinline
)) ATTRIBUTE_NOCLONE
109 use_xmm_reg (int val
)
113 #endif /* __SSE2__ */
116 m4 (const struct funcs
*fs
, int v
)
118 STAP_PROBE3 (test
, m4
, fs
->val
, fs
->ps (v
), v
);
136 use_xmm_reg (0x1234);
138 return 0; /* last break here */