From d4fc7b25e81ca043e9db9a369f31ac31404e7a86 Mon Sep 17 00:00:00 2001 From: "Zachary P. Landau" Date: Sun, 15 Mar 2020 11:01:36 -0700 Subject: [PATCH] basic support for usdt probes --- config/CMakeLists.txt | 1 + config/config.h.in | 1 + src/nvim/log.h | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 6c9e06d59d..8a70d864c4 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -32,6 +32,7 @@ endif() check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H) check_include_files(termios.h HAVE_TERMIOS_H) check_include_files(sys/uio.h HAVE_SYS_UIO_H) +check_include_files(sys/sdt.h HAVE_SYS_SDT_H) # Functions check_function_exists(fseeko HAVE_FSEEKO) diff --git a/config/config.h.in b/config/config.h.in index 5e60e6279f..95e2c872a3 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -33,6 +33,7 @@ #cmakedefine HAVE_STRCASECMP #cmakedefine HAVE_STRINGS_H #cmakedefine HAVE_STRNCASECMP +#cmakedefine HAVE_SYS_SDT_H #cmakedefine HAVE_SYS_UTSNAME_H #cmakedefine HAVE_SYS_WAIT_H #cmakedefine HAVE_TERMIOS_H diff --git a/src/nvim/log.h b/src/nvim/log.h index d92b4629ed..f2e74df031 100644 --- a/src/nvim/log.h +++ b/src/nvim/log.h @@ -7,6 +7,16 @@ #include "auto/config.h" #include "nvim/macros.h" +// USDT probes. Example invokation: +// NVIM_PROBE(nvim_foo_bar, 1, string.data); +#if defined(HAVE_SYS_SDT_H) +#include // NOLINT +#define NVIM_PROBE(name, n, ...) STAP_PROBE##n(neovim, name, __VA_ARGS__) +#else +#define NVIM_PROBE(name, n, ...) +#endif + + #define DEBUG_LOG_LEVEL 0 #define INFO_LOG_LEVEL 1 #define WARN_LOG_LEVEL 2