3 * Copyright (C) 2008, 2010, 2011 by Larry Wall and others
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.
8 * Provides macros that wrap the various DTrace probes we use. We add
9 * an extra level of wrapping to encapsulate the _ENABLED tests.
12 #if defined(USE_DTRACE) && defined(PERL_CORE)
14 # include "perldtrace.h"
16 # if defined(STAP_PROBE_ADDR) && !defined(DEBUGGING)
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
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); \
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); \
35 # define LOADING_FILE_PROBE(name) \
36 if (PERL_LOADING_FILE_ENABLED()) { \
37 const char *tmp_name = name; \
38 PERL_LOADING_FILE(tmp_name); \
41 # define LOADED_FILE_PROBE(name) \
42 if (PERL_LOADED_FILE_ENABLED()) { \
43 const char *tmp_name = name; \
44 PERL_LOADED_FILE(tmp_name); \
49 # define ENTRY_PROBE(func, file, line, stash) \
50 if (PERL_SUB_ENTRY_ENABLED()) { \
51 PERL_SUB_ENTRY(func, file, line, stash); \
54 # define RETURN_PROBE(func, file, line, stash) \
55 if (PERL_SUB_RETURN_ENABLED()) { \
56 PERL_SUB_RETURN(func, file, line, stash); \
59 # define LOADING_FILE_PROBE(name) \
60 if (PERL_LOADING_FILE_ENABLED()) { \
61 PERL_LOADING_FILE(name); \
64 # define LOADED_FILE_PROBE(name) \
65 if (PERL_LOADED_FILE_ENABLED()) { \
66 PERL_LOADED_FILE(name); \
71 # define OP_ENTRY_PROBE(name) \
72 if (PERL_OP_ENTRY_ENABLED()) { \
73 PERL_OP_ENTRY(name); \
76 # define PHASE_CHANGE_PROBE(new_phase, old_phase) \
77 if (PERL_PHASE_CHANGE_ENABLED()) { \
78 PERL_PHASE_CHANGE(new_phase, old_phase); \
84 # define ENTRY_PROBE(func, file, line, stash)
85 # define RETURN_PROBE(func, file, line, stash)
86 # define PHASE_CHANGE_PROBE(new_phase, old_phase)
87 # define OP_ENTRY_PROBE(name)
88 # define LOADING_FILE_PROBE(name)
89 # define LOADED_FILE_PROBE(name)
94 * ex: set ts=8 sts=4 sw=4 et: