Blame include/stap-probe.h

Packit 6c4009
/* Macros for defining Systemtap <sys/sdt.h> static probe points.
Packit 6c4009
   Copyright (C) 2012-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _STAP_PROBE_H
Packit 6c4009
#define _STAP_PROBE_H 1
Packit 6c4009
Packit 6c4009
#ifdef USE_STAP_PROBE
Packit 6c4009
Packit 6c4009
# include <sys/sdt.h>
Packit 6c4009
Packit 6c4009
/* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
Packit 6c4009
Packit 6c4009
   Without USE_STAP_PROBE, that does nothing but evaluates all
Packit 6c4009
   its arguments (to prevent bit rot, unlike e.g. assert).
Packit 6c4009
Packit 6c4009
   Systemtap's header defines the macros STAP_PROBE (provider, name) and
Packit 6c4009
   STAP_PROBEn (provider, name, arg1, ..., argn).  For "provider" we paste
Packit 6c4009
   in MODULE_NAME (libc, libpthread, etc.) automagically.
Packit 6c4009
Packit 6c4009
   The format of the arg parameters is discussed here:
Packit 6c4009
Packit 6c4009
   https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
Packit 6c4009
Packit 6c4009
   The precise details of how register names are specified is
Packit 6c4009
   architecture specific and can be found in the gdb and SystemTap
Packit 6c4009
   source code.  */
Packit 6c4009
Packit 6c4009
# define LIBC_PROBE(name, n, ...)	\
Packit 6c4009
  LIBC_PROBE_1 (MODULE_NAME, name, n, ## __VA_ARGS__)
Packit 6c4009
Packit 6c4009
# define LIBC_PROBE_1(lib, name, n, ...) \
Packit 6c4009
  STAP_PROBE##n (lib, name, ## __VA_ARGS__)
Packit 6c4009
Packit 6c4009
# define STAP_PROBE0		STAP_PROBE
Packit 6c4009
Packit 6c4009
# define LIBC_PROBE_ASM(name, template) \
Packit 6c4009
  STAP_PROBE_ASM (MODULE_NAME, name, template)
Packit 6c4009
Packit 6c4009
# define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
Packit 6c4009
Packit 6c4009
#else  /* Not USE_STAP_PROBE.  */
Packit 6c4009
Packit 6c4009
# ifndef __ASSEMBLER__
Packit 6c4009
/* Evaluate all the arguments and verify that N matches their number.  */
Packit 6c4009
#  define LIBC_PROBE(name, n, ...) STAP_PROBE##n (__VA_ARGS__)
Packit 6c4009
Packit 6c4009
#  define STAP_PROBE0()
Packit 6c4009
#  define STAP_PROBE1(a1)
Packit 6c4009
#  define STAP_PROBE2(a1, a2)
Packit 6c4009
#  define STAP_PROBE3(a1, a2, a3)
Packit 6c4009
#  define STAP_PROBE4(a1, a2, a3, a4)
Packit 6c4009
Packit 6c4009
# else
Packit 6c4009
#  define LIBC_PROBE(name, n, ...)		/* Nothing.  */
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# define LIBC_PROBE_ASM(name, template)		/* Nothing.  */
Packit 6c4009
# define LIBC_PROBE_ASM_OPERANDS(n, ...)	/* Nothing.  */
Packit 6c4009
Packit 6c4009
#endif	/* USE_STAP_PROBE.  */
Packit 6c4009
Packit 6c4009
#endif	/* stap-probe.h */