From: Mathieu Desnoyers Date: Fri, 17 Feb 2023 14:57:03 +0000 (-0500) Subject: Tests: Introduce gen-ust-events-constructor test application X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a4cc1b1ff4fc661a3980bbe2ceba789acf05dfce;p=lttng-tools.git Tests: Introduce gen-ust-events-constructor test application This test application tests C/C++ constructor/destructor instrumentation coverage. * How to use: lttng create lttng enable-event -u 'tp*' lttng start ./gen-ust-events-constructor lttng stop lttng view * Before UST fixes: [11:57:09.949917277] (+?.?????????) compudjdev tp_so:constructor_c_provider_shared_library: { cpu_id = 6 }, { } [11:57:09.949962573] (+0.000045296) compudjdev tp_so:constructor_cplusplus_provider_shared_library: { cpu_id = 6 }, { msg = "global - shared library define and provider" } [11:57:09.952145202] (+0.002182629) compudjdev tp:constructor_cplusplus: { cpu_id = 6 }, { msg = "global - same unit after provider" } [11:57:09.952146517] (+0.000001315) compudjdev tp:constructor_c_across_units_after_provider: { cpu_id = 6 }, { } [11:57:09.952146887] (+0.000000370) compudjdev tp:constructor_cplusplus: { cpu_id = 6 }, { msg = "global - across units after provider" } [11:57:09.952634622] (+0.000487735) compudjdev tp:constructor_cplusplus: { cpu_id = 6 }, { msg = "main() local" } [11:57:09.952635522] (+0.000000900) compudjdev tp_so:constructor_cplusplus_provider_shared_library: { cpu_id = 6 }, { msg = "main() local - shared library define and provider" } [11:57:09.952636176] (+0.000000654) compudjdev tp_a:constructor_cplusplus_provider_static_archive: { cpu_id = 6 }, { msg = "main() local - static archive define and provider" } [11:57:09.952636906] (+0.000000730) compudjdev tp:main: { cpu_id = 6 }, { } [11:57:09.952637469] (+0.000000563) compudjdev tp_a:destructor_cplusplus_provider_static_archive: { cpu_id = 6 }, { msg = "main() local - static archive define and provider" } [11:57:09.952638106] (+0.000000637) compudjdev tp_so:destructor_cplusplus_provider_shared_library: { cpu_id = 6 }, { msg = "main() local - shared library define and provider" } [11:57:09.952638516] (+0.000000410) compudjdev tp:destructor_cplusplus: { cpu_id = 6 }, { msg = "main() local" } [11:57:09.952681576] (+0.000043060) compudjdev tp:destructor_cplusplus: { cpu_id = 6 }, { msg = "global - across units after provider" } [11:57:09.952682066] (+0.000000490) compudjdev tp:destructor_cplusplus: { cpu_id = 6 }, { msg = "global - same unit after provider" } [11:57:09.952729603] (+0.000047537) compudjdev tp_so:destructor_cplusplus_provider_shared_library: { cpu_id = 6 }, { msg = "global - shared library define and provider" } * After UST fixes: [11:49:37.921028048] (+?.?????????) compudjdev tp_so:constructor_c_provider_shared_library: { cpu_id = 22 }, { } [11:49:37.921033701] (+0.000005653) compudjdev tp_a:constructor_c_provider_static_archive: { cpu_id = 22 }, { } [11:49:37.921036278] (+0.000002577) compudjdev tp_so:constructor_cplusplus_provider_shared_library: { cpu_id = 22 }, { msg = "global - shared library define and provider" } [11:49:37.921037961] (+0.000001683) compudjdev tp_a:constructor_cplusplus_provider_static_archive: { cpu_id = 22 }, { msg = "global - static archive define and provider" } [11:49:37.921039431] (+0.000001470) compudjdev tp:constructor_c_across_units_before_define: { cpu_id = 22 }, { } [11:49:37.921040288] (+0.000000857) compudjdev tp:constructor_cplusplus: { cpu_id = 22 }, { msg = "global - across units before define" } [11:49:37.921041208] (+0.000000920) compudjdev tp:constructor_c_same_unit_before_define: { cpu_id = 22 }, { } [11:49:37.921042021] (+0.000000813) compudjdev tp:constructor_c_same_unit_after_define: { cpu_id = 22 }, { } [11:49:37.921042568] (+0.000000547) compudjdev tp:constructor_cplusplus: { cpu_id = 22 }, { msg = "global - same unit before define" } [11:49:37.921043161] (+0.000000593) compudjdev tp:constructor_cplusplus: { cpu_id = 22 }, { msg = "global - same unit after define" } [11:49:37.921044058] (+0.000000897) compudjdev tp:constructor_c_across_units_after_define: { cpu_id = 22 }, { } [11:49:37.921044585] (+0.000000527) compudjdev tp:constructor_cplusplus: { cpu_id = 22 }, { msg = "global - across units after define" } [11:49:37.921045585] (+0.000001000) compudjdev tp:constructor_c_same_unit_before_provider: { cpu_id = 22 }, { } [11:49:37.921046385] (+0.000000800) compudjdev tp:constructor_c_same_unit_after_provider: { cpu_id = 22 }, { } [11:49:37.921046938] (+0.000000553) compudjdev tp:constructor_cplusplus: { cpu_id = 22 }, { msg = "global - same unit before provider" } [11:49:37.921047548] (+0.000000610) compudjdev tp:constructor_cplusplus: { cpu_id = 22 }, { msg = "global - same unit after provider" } [11:49:37.921048428] (+0.000000880) compudjdev tp:constructor_c_across_units_after_provider: { cpu_id = 22 }, { } [11:49:37.921048918] (+0.000000490) compudjdev tp:constructor_cplusplus: { cpu_id = 22 }, { msg = "global - across units after provider" } [11:49:37.921050001] (+0.000001083) compudjdev tp:constructor_cplusplus: { cpu_id = 22 }, { msg = "main() local" } [11:49:37.921050628] (+0.000000627) compudjdev tp_so:constructor_cplusplus_provider_shared_library: { cpu_id = 22 }, { msg = "main() local - shared library define and provider" } [11:49:37.921051368] (+0.000000740) compudjdev tp_a:constructor_cplusplus_provider_static_archive: { cpu_id = 22 }, { msg = "main() local - static archive define and provider" } [11:49:37.921052098] (+0.000000730) compudjdev tp:main: { cpu_id = 22 }, { } [11:49:37.921052758] (+0.000000660) compudjdev tp_a:destructor_cplusplus_provider_static_archive: { cpu_id = 22 }, { msg = "main() local - static archive define and provider" } [11:49:37.921053758] (+0.000001000) compudjdev tp_so:destructor_cplusplus_provider_shared_library: { cpu_id = 22 }, { msg = "main() local - shared library define and provider" } [11:49:37.921054595] (+0.000000837) compudjdev tp:destructor_cplusplus: { cpu_id = 22 }, { msg = "main() local" } [11:49:37.921055698] (+0.000001103) compudjdev tp:destructor_cplusplus: { cpu_id = 22 }, { msg = "global - across units after provider" } [11:49:37.921056455] (+0.000000757) compudjdev tp:destructor_cplusplus: { cpu_id = 22 }, { msg = "global - same unit after provider" } [11:49:37.921057011] (+0.000000556) compudjdev tp:destructor_cplusplus: { cpu_id = 22 }, { msg = "global - same unit before provider" } [11:49:37.921057558] (+0.000000547) compudjdev tp:destructor_cplusplus: { cpu_id = 22 }, { msg = "global - across units after define" } [11:49:37.921058188] (+0.000000630) compudjdev tp:destructor_cplusplus: { cpu_id = 22 }, { msg = "global - same unit after define" } [11:49:37.921058658] (+0.000000470) compudjdev tp:destructor_cplusplus: { cpu_id = 22 }, { msg = "global - same unit before define" } [11:49:37.921059168] (+0.000000510) compudjdev tp:destructor_cplusplus: { cpu_id = 22 }, { msg = "global - across units before define" } [11:49:37.921059768] (+0.000000600) compudjdev tp_a:destructor_cplusplus_provider_static_archive: { cpu_id = 22 }, { msg = "global - static archive define and provider" } [11:49:37.921060445] (+0.000000677) compudjdev tp_so:destructor_cplusplus_provider_shared_library: { cpu_id = 22 }, { msg = "global - shared library define and provider" } [11:49:37.921067265] (+0.000006820) compudjdev tp:destructor_c_across_units_after_provider: { cpu_id = 22 }, { } [11:49:37.921067901] (+0.000000636) compudjdev tp:destructor_c_same_unit_after_provider: { cpu_id = 22 }, { } [11:49:37.921068515] (+0.000000614) compudjdev tp:destructor_c_same_unit_before_provider: { cpu_id = 22 }, { } [11:49:37.921069128] (+0.000000613) compudjdev tp:destructor_c_across_units_after_define: { cpu_id = 22 }, { } [11:49:37.921069831] (+0.000000703) compudjdev tp:destructor_c_same_unit_after_define: { cpu_id = 22 }, { } [11:49:37.921070445] (+0.000000614) compudjdev tp:destructor_c_same_unit_before_define: { cpu_id = 22 }, { } [11:49:37.921071075] (+0.000000630) compudjdev tp:destructor_c_across_units_before_define: { cpu_id = 22 }, { } [11:49:37.921071721] (+0.000000646) compudjdev tp_a:destructor_c_provider_static_archive: { cpu_id = 22 }, { } [11:49:37.921072605] (+0.000000884) compudjdev tp_so:destructor_c_provider_shared_library: { cpu_id = 22 }, { } Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau Change-Id: I4572c2548acf5e295f70e88137ab12b3b86d17c9 --- diff --git a/.gitignore b/.gitignore index 24c2f03c7..0090ac493 100644 --- a/.gitignore +++ b/.gitignore @@ -100,6 +100,7 @@ compile_commands.json /tests/regression/ust/high-throughput/gen-events /tests/regression/tools/filtering/gen-ust-events /tests/utils/testapp/gen-ust-events/gen-ust-events +/tests/utils/testapp/gen-ust-events-constructor/gen-ust-events-constructor /tests/utils/testapp/gen-ust-events-ns/gen-ust-events-ns /tests/regression/tools/health/health_check /tests/regression/kernel/select_poll_epoll diff --git a/configure.ac b/configure.ac index 87c4e6fcd..9af597923 100644 --- a/configure.ac +++ b/configure.ac @@ -1281,6 +1281,7 @@ AC_CONFIG_FILES([ tests/utils/testapp/gen-kernel-test-events/Makefile tests/utils/testapp/gen-py-events/Makefile tests/utils/testapp/gen-ust-events/Makefile + tests/utils/testapp/gen-ust-events-constructor/Makefile tests/utils/testapp/gen-ust-events-ns/Makefile tests/utils/testapp/gen-syscall-events-callstack/Makefile tests/utils/testapp/gen-ust-nevents/Makefile diff --git a/tests/utils/testapp/Makefile.am b/tests/utils/testapp/Makefile.am index 55a7ba7eb..307059c0e 100644 --- a/tests/utils/testapp/Makefile.am +++ b/tests/utils/testapp/Makefile.am @@ -8,7 +8,8 @@ SUBDIRS = \ gen-ust-nevents-str \ gen-ust-tracef \ userspace-probe-elf-binary \ - userspace-probe-elf-cxx-binary + userspace-probe-elf-cxx-binary \ + gen-ust-events-constructor if TEST_SDT_UPROBE SUBDIRS += userspace-probe-sdt-binary diff --git a/tests/utils/testapp/gen-ust-events-constructor/01-tp-before-define.cpp b/tests/utils/testapp/gen-ust-events-constructor/01-tp-before-define.cpp new file mode 100644 index 000000000..52199240e --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/01-tp-before-define.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#include "obj.h" +#include "tp.h" + +void test_constructor1(void) __attribute__((constructor)); +void test_constructor1(void) +{ + tracepoint(tp, constructor_c_across_units_before_define); +} + +void test_destructor1(void) __attribute__((destructor)); +void test_destructor1(void) +{ + tracepoint(tp, destructor_c_across_units_before_define); +} + +Obj g_obj_across_units_before_define("global - across units before define"); diff --git a/tests/utils/testapp/gen-ust-events-constructor/02-define-tp.cpp b/tests/utils/testapp/gen-ust-events-constructor/02-define-tp.cpp new file mode 100644 index 000000000..9d550fcc8 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/02-define-tp.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#include "obj.h" + +static void fct_constructor2(void); +static void fct_destructor2(void); + +void test_constructor2_same_unit_before(void) __attribute__((constructor)); +void test_constructor2_same_unit_before(void) +{ + fct_constructor2(); +} + +void test_destructor2_same_unit_before(void) __attribute__((destructor)); +void test_destructor2_same_unit_before(void) +{ + fct_destructor2(); +} + +Obj g_obj_same_unit_before_define("global - same unit before define"); + +#define TRACEPOINT_DEFINE +#include "tp.h" + +Obj g_obj_same_unit_after_define("global - same unit after define"); + +static void fct_constructor2(void) +{ + tracepoint(tp, constructor_c_same_unit_before_define); +} + +static void fct_destructor2(void) +{ + tracepoint(tp, destructor_c_same_unit_before_define); +} + +void test_constructor2_same_unit_after(void) __attribute__((constructor)); +void test_constructor2_same_unit_after(void) +{ + tracepoint(tp, constructor_c_same_unit_after_define); +} + +void test_destructor2_same_unit_after(void) __attribute__((destructor)); +void test_destructor2_same_unit_after(void) +{ + tracepoint(tp, destructor_c_same_unit_after_define); +} diff --git a/tests/utils/testapp/gen-ust-events-constructor/03-tp-after-define.cpp b/tests/utils/testapp/gen-ust-events-constructor/03-tp-after-define.cpp new file mode 100644 index 000000000..fba3c262e --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/03-tp-after-define.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#include "obj.h" +#include "tp.h" + +void test_constructor3(void) __attribute__((constructor)); +void test_constructor3(void) +{ + tracepoint(tp, constructor_c_across_units_after_define); +} + +void test_destructor3(void) __attribute__((destructor)); +void test_destructor3(void) +{ + tracepoint(tp, destructor_c_across_units_after_define); +} + +Obj g_obj_across_units_after_define("global - across units after define"); diff --git a/tests/utils/testapp/gen-ust-events-constructor/04-tp-provider.cpp b/tests/utils/testapp/gen-ust-events-constructor/04-tp-provider.cpp new file mode 100644 index 000000000..bebf0d232 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/04-tp-provider.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#include "obj.h" + +static void fct_constructor4(void); +static void fct_destructor4(void); + +void test_constructor4_same_unit_before(void) __attribute__((constructor)); +void test_constructor4_same_unit_before(void) +{ + fct_constructor4(); +} + +void test_destructor4_same_unit_before(void) __attribute__((destructor)); +void test_destructor4_same_unit_before(void) +{ + fct_destructor4(); +} + +Obj g_obj_same_unit_before_provider("global - same unit before provider"); + +#define TRACEPOINT_CREATE_PROBES +#include "tp.h" + +Obj g_obj_same_unit_after_provider("global - same unit after provider"); + +static void fct_constructor4(void) +{ + tracepoint(tp, constructor_c_same_unit_before_provider); +} + +static void fct_destructor4(void) +{ + tracepoint(tp, destructor_c_same_unit_before_provider); +} + +void test_constructor4_same_unit_after(void) __attribute__((constructor)); +void test_constructor4_same_unit_after(void) +{ + tracepoint(tp, constructor_c_same_unit_after_provider); +} + +void test_destructor4_same_unit_after(void) __attribute__((destructor)); +void test_destructor4_same_unit_after(void) +{ + tracepoint(tp, destructor_c_same_unit_after_provider); +} diff --git a/tests/utils/testapp/gen-ust-events-constructor/05-tp-after-provider.cpp b/tests/utils/testapp/gen-ust-events-constructor/05-tp-after-provider.cpp new file mode 100644 index 000000000..17d3a6e24 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/05-tp-after-provider.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#include "obj.h" +#include "tp.h" + +void test_constructor5(void) __attribute__((constructor)); +void test_constructor5(void) +{ + tracepoint(tp, constructor_c_across_units_after_provider); +} + +void test_destructor5(void) __attribute__((destructor)); +void test_destructor5(void) +{ + tracepoint(tp, destructor_c_across_units_after_provider); +} + +Obj g_obj_across_units_after_provider("global - across units after provider"); diff --git a/tests/utils/testapp/gen-ust-events-constructor/Makefile.am b/tests/utils/testapp/gen-ust-events-constructor/Makefile.am new file mode 100644 index 000000000..4e7e1e102 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/Makefile.am @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: GPL-2.0-only + +AM_CPPFLAGS += -I$(top_srcdir)/tests/utils -I$(srcdir) \ + -I$(top_srcdir)/tests/utils/testapp + +if HAVE_LIBLTTNG_UST_CTL +# Disable some warnings flags to accomodate the tracepoint headers +WARN_FLAGS = \ + -Wno-redundant-decls \ + -Wno-missing-field-initializers + +AM_CFLAGS += $(WARN_FLAGS) +AM_CXXFLAGS += $(WARN_FLAGS) + +if NO_SHARED +# Build the shared library as a static archive if shared libraries +# are disabled. +FORCE_SHARED_LIB_OPTIONS = +else +# Force the shared flag on the noinst libraries since they are +# only built static by default +FORCE_SHARED_LIB_OPTIONS = -module -shared -avoid-version \ + -rpath $(abs_builddir) +endif + +noinst_LTLIBRARIES = libtp-so-provider.la libtp-so-define.la \ + libtp-a-provider.la libtp-a-define.la + +# dynamic libraries +libtp_so_provider_la_SOURCES = \ + tp-so-provider.cpp \ + tp-so.h +libtp_so_provider_la_LDFLAGS = \ + $(FORCE_SHARED_LIB_OPTIONS) + +libtp_so_define_la_SOURCES = \ + tp-so-define.cpp \ + tp-so.h +libtp_so_define_la_LDFLAGS = \ + $(FORCE_SHARED_LIB_OPTIONS) + +# static archives +libtp_a_provider_la_SOURCES = \ + tp-a-provider.cpp \ + tp-a.h + +libtp_a_define_la_SOURCES = \ + tp-a-define.cpp \ + tp-a.h + +noinst_PROGRAMS = gen-ust-events-constructor +gen_ust_events_constructor_SOURCES = \ + main.cpp \ + 01-tp-before-define.cpp \ + 02-define-tp.cpp \ + 03-tp-after-define.cpp \ + 04-tp-provider.cpp \ + 05-tp-after-provider.cpp \ + obj.cpp \ + obj.h \ + tp.h +gen_ust_events_constructor_LDADD = $(UST_LIBS) \ + $(builddir)/libtp-so-define.la \ + $(builddir)/libtp-so-provider.la \ + $(builddir)/libtp-a-define.la \ + $(builddir)/libtp-a-provider.la \ + $(top_builddir)/tests/utils/libtestutils.la \ + $(DL_LIBS) +endif diff --git a/tests/utils/testapp/gen-ust-events-constructor/main.cpp b/tests/utils/testapp/gen-ust-events-constructor/main.cpp new file mode 100644 index 000000000..8cb4f7898 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/main.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#include "obj.h" +#include "tp-a.h" +#include "tp-so.h" +#include "tp.h" + +/* Use tracepoints defined and provided by shared libraries. */ +void test_constructor_so(void) __attribute__((constructor)); +void test_constructor_so(void) +{ + tracepoint(tp_so, constructor_c_provider_shared_library); +} + +void test_destructor_so(void) __attribute__((destructor)); +void test_destructor_so(void) +{ + tracepoint(tp_so, destructor_c_provider_shared_library); +} + +Objso g_objso_shared_library("global - shared library define and provider"); + +/* Use tracepoints defined and provided by static archive. */ +void test_constructor_a(void) __attribute__((constructor)); +void test_constructor_a(void) +{ + tracepoint(tp_a, constructor_c_provider_static_archive); +} + +void test_destructor_a(void) __attribute__((destructor)); +void test_destructor_a(void) +{ + tracepoint(tp_a, destructor_c_provider_static_archive); +} + +Obja g_obja_static_archive("global - static archive define and provider"); + +int main(void) +{ + Obj l_obj("main() local"); + Objso l_objso("main() local - shared library define and provider"); + Obja l_obja("main() local - static archive define and provider"); + + tracepoint(tp, main); + return 0; +} diff --git a/tests/utils/testapp/gen-ust-events-constructor/obj.cpp b/tests/utils/testapp/gen-ust-events-constructor/obj.cpp new file mode 100644 index 000000000..948420165 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/obj.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2011 Mathieu Desnoyers + * + * SPDX-License-Identifier: MIT + * + */ + +#include "obj.h" +#include "tp-a.h" +#include "tp-so.h" +#include "tp.h" + +Obj::Obj(const char *_msg) : msg(_msg) +{ + tracepoint(tp, constructor_cplusplus, msg); +} + +Obj::~Obj() +{ + tracepoint(tp, destructor_cplusplus, msg); +} + +Objso::Objso(const char *_msg) : msg(_msg) +{ + tracepoint(tp_so, constructor_cplusplus_provider_shared_library, msg); +} + +Objso::~Objso() +{ + tracepoint(tp_so, destructor_cplusplus_provider_shared_library, msg); +} + +Obja::Obja(const char *_msg) : msg(_msg) +{ + tracepoint(tp_a, constructor_cplusplus_provider_static_archive, msg); +} + +Obja::~Obja() +{ + tracepoint(tp_a, destructor_cplusplus_provider_static_archive, msg); +} diff --git a/tests/utils/testapp/gen-ust-events-constructor/obj.h b/tests/utils/testapp/gen-ust-events-constructor/obj.h new file mode 100644 index 000000000..aea1468c6 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/obj.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2011 Mathieu Desnoyers + * + * SPDX-License-Identifier: MIT + * + */ + +#ifndef _OBJ_H +#define _OBJ_H + +struct Obj { + const char *msg; + Obj(const char *msg); + ~Obj(); +}; + +struct Objso { + const char *msg; + Objso(const char *msg); + ~Objso(); +}; + +struct Obja { + const char *msg; + Obja(const char *msg); + ~Obja(); +}; + +#endif /* _OBJ_H */ diff --git a/tests/utils/testapp/gen-ust-events-constructor/tp-a-define.cpp b/tests/utils/testapp/gen-ust-events-constructor/tp-a-define.cpp new file mode 100644 index 000000000..1d01015f7 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/tp-a-define.cpp @@ -0,0 +1,8 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#define TRACEPOINT_DEFINE +#include "tp-a.h" diff --git a/tests/utils/testapp/gen-ust-events-constructor/tp-a-provider.cpp b/tests/utils/testapp/gen-ust-events-constructor/tp-a-provider.cpp new file mode 100644 index 000000000..75ae70fca --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/tp-a-provider.cpp @@ -0,0 +1,8 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#define TRACEPOINT_CREATE_PROBES +#include "tp-a.h" diff --git a/tests/utils/testapp/gen-ust-events-constructor/tp-a.h b/tests/utils/testapp/gen-ust-events-constructor/tp-a.h new file mode 100644 index 000000000..ab1471393 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/tp-a.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 Mathieu Desnoyers + * + * SPDX-License-Identifier: MIT + * + */ + +#undef TRACEPOINT_PROVIDER +#define TRACEPOINT_PROVIDER tp_a + +#if !defined(_TRACEPOINT_TP_A_H) || defined(TRACEPOINT_HEADER_MULTI_READ) +#define _TRACEPOINT_TP_A_H + +#include + +#include + +TRACEPOINT_EVENT(tp_a, constructor_c_provider_static_archive, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp_a, destructor_c_provider_static_archive, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp_a, + constructor_cplusplus_provider_static_archive, + TP_ARGS(const char *, msg), + TP_FIELDS(ctf_string(msg, msg))) + +TRACEPOINT_EVENT(tp_a, + destructor_cplusplus_provider_static_archive, + TP_ARGS(const char *, msg), + TP_FIELDS(ctf_string(msg, msg))) + +#endif /* _TRACEPOINT_TP_A_H */ + +#undef TRACEPOINT_INCLUDE +#define TRACEPOINT_INCLUDE "./tp-a.h" + +/* This part must be outside ifdef protection */ +#include diff --git a/tests/utils/testapp/gen-ust-events-constructor/tp-so-define.cpp b/tests/utils/testapp/gen-ust-events-constructor/tp-so-define.cpp new file mode 100644 index 000000000..5ff4395bb --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/tp-so-define.cpp @@ -0,0 +1,8 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#define TRACEPOINT_DEFINE +#include "tp-so.h" diff --git a/tests/utils/testapp/gen-ust-events-constructor/tp-so-provider.cpp b/tests/utils/testapp/gen-ust-events-constructor/tp-so-provider.cpp new file mode 100644 index 000000000..d4844ea0a --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/tp-so-provider.cpp @@ -0,0 +1,8 @@ +/* + * Copyright (C) 2023 Mathieu Desnoyers + * + * SPDX-License-Identifier: LGPL-2.1-only + */ + +#define TRACEPOINT_CREATE_PROBES +#include "tp-so.h" diff --git a/tests/utils/testapp/gen-ust-events-constructor/tp-so.h b/tests/utils/testapp/gen-ust-events-constructor/tp-so.h new file mode 100644 index 000000000..0bdc3ed2f --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/tp-so.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 Mathieu Desnoyers + * + * SPDX-License-Identifier: MIT + * + */ + +#undef TRACEPOINT_PROVIDER +#define TRACEPOINT_PROVIDER tp_so + +#if !defined(_TRACEPOINT_TP_SO_H) || defined(TRACEPOINT_HEADER_MULTI_READ) +#define _TRACEPOINT_TP_SO_H + +#include + +#include + +TRACEPOINT_EVENT(tp_so, constructor_c_provider_shared_library, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp_so, destructor_c_provider_shared_library, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp_so, + constructor_cplusplus_provider_shared_library, + TP_ARGS(const char *, msg), + TP_FIELDS(ctf_string(msg, msg))) + +TRACEPOINT_EVENT(tp_so, + destructor_cplusplus_provider_shared_library, + TP_ARGS(const char *, msg), + TP_FIELDS(ctf_string(msg, msg))) + +#endif /* _TRACEPOINT_TP_SO_H */ + +#undef TRACEPOINT_INCLUDE +#define TRACEPOINT_INCLUDE "./tp-so.h" + +/* This part must be outside ifdef protection */ +#include diff --git a/tests/utils/testapp/gen-ust-events-constructor/tp.h b/tests/utils/testapp/gen-ust-events-constructor/tp.h new file mode 100644 index 000000000..934ca7db8 --- /dev/null +++ b/tests/utils/testapp/gen-ust-events-constructor/tp.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011 Mathieu Desnoyers + * + * SPDX-License-Identifier: MIT + * + */ + +#undef TRACEPOINT_PROVIDER +#define TRACEPOINT_PROVIDER tp + +#if !defined(_TRACEPOINT_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ) +#define _TRACEPOINT_TP_H + +#include + +#include + +TRACEPOINT_EVENT(tp, main, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, constructor_c_across_units_before_define, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, destructor_c_across_units_before_define, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, constructor_c_across_units_after_define, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, destructor_c_across_units_after_define, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, constructor_c_across_units_after_provider, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, destructor_c_across_units_after_provider, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, constructor_c_same_unit_before_define, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, destructor_c_same_unit_before_define, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, constructor_c_same_unit_after_define, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, destructor_c_same_unit_after_define, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, constructor_c_same_unit_before_provider, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, destructor_c_same_unit_before_provider, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, constructor_c_same_unit_after_provider, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, destructor_c_same_unit_after_provider, TP_ARGS(), TP_FIELDS()) + +TRACEPOINT_EVENT(tp, + constructor_cplusplus, + TP_ARGS(const char *, msg), + TP_FIELDS(ctf_string(msg, msg))) + +TRACEPOINT_EVENT(tp, + destructor_cplusplus, + TP_ARGS(const char *, msg), + TP_FIELDS(ctf_string(msg, msg))) + +#endif /* _TRACEPOINT_TP_H */ + +#undef TRACEPOINT_INCLUDE +#define TRACEPOINT_INCLUDE "./tp.h" + +/* This part must be outside ifdef protection */ +#include