| 1 | /* mydtrace.h |
| 2 | * |
| 3 | * Copyright (C) 2008, 2010, 2011 by Larry Wall and others |
| 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 | |
| 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 | |
| 35 | # else |
| 36 | |
| 37 | # define ENTRY_PROBE(func, file, line, stash) \ |
| 38 | if (PERL_SUB_ENTRY_ENABLED()) { \ |
| 39 | PERL_SUB_ENTRY(func, file, line, stash); \ |
| 40 | } |
| 41 | |
| 42 | # define RETURN_PROBE(func, file, line, stash) \ |
| 43 | if (PERL_SUB_RETURN_ENABLED()) { \ |
| 44 | PERL_SUB_RETURN(func, file, line, stash); \ |
| 45 | } |
| 46 | |
| 47 | # endif |
| 48 | |
| 49 | # define PHASE_CHANGE_PROBE(new_phase, old_phase) \ |
| 50 | if (PERL_PHASE_CHANGE_ENABLED()) { \ |
| 51 | PERL_PHASE_CHANGE(new_phase, old_phase); \ |
| 52 | } |
| 53 | |
| 54 | #else |
| 55 | |
| 56 | /* NOPs */ |
| 57 | # define ENTRY_PROBE(func, file, line, stash) |
| 58 | # define RETURN_PROBE(func, file, line, stash) |
| 59 | # define PHASE_CHANGE_PROBE(new_phase, old_phase) |
| 60 | |
| 61 | #endif |
| 62 | |
| 63 | /* |
| 64 | * Local variables: |
| 65 | * c-indentation-style: bsd |
| 66 | * c-basic-offset: 4 |
| 67 | * indent-tabs-mode: nil |
| 68 | * End: |
| 69 | * |
| 70 | * ex: set ts=8 sts=4 sw=4 et: |
| 71 | */ |