This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
stop ""-overloaded Regex recursing
[perl5.git] / mydtrace.h
CommitLineData
5ac1e9b2
AA
1/* mydtrace.h
2 *
2eee27d7 3 * Copyright (C) 2008, 2010, 2011 by Larry Wall and others
5ac1e9b2
AA
4 *
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
7 *
8 * Provides macros that wrap the various DTrace probes we use. We add
9 * an extra level of wrapping to encapsulate the _ENABLED tests.
10 */
11
12#if defined(USE_DTRACE) && defined(PERL_CORE)
13
14# include "perldtrace.h"
15
ee3ace03
TC
16# if defined(STAP_PROBE_ADDR) && !defined(DEBUGGING)
17
18/* SystemTap 1.2 uses a construct that chokes on passing a char array
19 * as a char *, in this case hek_key in struct hek. Workaround it
20 * with a temporary.
21 */
22
23# define ENTRY_PROBE(func, file, line, stash) \
24 if (PERL_SUB_ENTRY_ENABLED()) { \
25 const char *tmp_func = func; \
26 PERL_SUB_ENTRY(tmp_func, file, line, stash); \
27 }
28
29# define RETURN_PROBE(func, file, line, stash) \
30 if (PERL_SUB_RETURN_ENABLED()) { \
31 const char *tmp_func = func; \
32 PERL_SUB_RETURN(tmp_func, file, line, stash); \
33 }
34
fe83c362
SM
35# define OP_ENTRY_PROBE(name) \
36 if (PERL_OP_ENTRY_ENABLED()) { \
37 const char *tmp_name = name; \
38 PERL_OP_ENTRY(tmp_name, file, line, stash); \
39 }
40
32aeab29
SM
41# define LOADING_FILE_PROBE(name) \
42 if (PERL_LOADING_FILE_ENABLED()) { \
43 const char *tmp_name = name; \
44 PERL_LOADING_FILE(tmp_name); \
45 }
46
47# define LOADED_FILE_PROBE(name) \
48 if (PERL_LOADED_FILE_ENABLED()) { \
49 const char *tmp_name = name; \
50 PERL_LOADED_FILE(tmp_name); \
51 }
52
ee3ace03
TC
53# else
54
55# define ENTRY_PROBE(func, file, line, stash) \
3e2413e5
DL
56 if (PERL_SUB_ENTRY_ENABLED()) { \
57 PERL_SUB_ENTRY(func, file, line, stash); \
5ac1e9b2
AA
58 }
59
ee3ace03 60# define RETURN_PROBE(func, file, line, stash) \
3e2413e5
DL
61 if (PERL_SUB_RETURN_ENABLED()) { \
62 PERL_SUB_RETURN(func, file, line, stash); \
5ac1e9b2
AA
63 }
64
fe83c362
SM
65# define OP_ENTRY_PROBE(name) \
66 if (PERL_OP_ENTRY_ENABLED()) { \
67 PERL_OP_ENTRY(name); \
68 }
69
32aeab29
SM
70# define LOADING_FILE_PROBE(name) \
71 if (PERL_LOADING_FILE_ENABLED()) { \
72 PERL_LOADING_FILE(name); \
73 }
74
75# define LOADED_FILE_PROBE(name) \
76 if (PERL_LOADED_FILE_ENABLED()) { \
77 PERL_LOADED_FILE(name); \
78 }
79
ee3ace03
TC
80# endif
81
cb3f8189
SM
82# define PHASE_CHANGE_PROBE(new_phase, old_phase) \
83 if (PERL_PHASE_CHANGE_ENABLED()) { \
84 PERL_PHASE_CHANGE(new_phase, old_phase); \
85 }
86
5ac1e9b2
AA
87#else
88
89/* NOPs */
3e2413e5
DL
90# define ENTRY_PROBE(func, file, line, stash)
91# define RETURN_PROBE(func, file, line, stash)
cb3f8189 92# define PHASE_CHANGE_PROBE(new_phase, old_phase)
fe83c362 93# define OP_ENTRY_PROBE(name)
32aeab29
SM
94# define LOADING_FILE_PROBE(name)
95# define LOADED_FILE_PROBE(name)
5ac1e9b2
AA
96
97#endif
98
99/*
100 * Local variables:
101 * c-indentation-style: bsd
102 * c-basic-offset: 4
14d04a33 103 * indent-tabs-mode: nil
5ac1e9b2
AA
104 * End:
105 *
14d04a33 106 * ex: set ts=8 sts=4 sw=4 et:
5ac1e9b2 107 */