Tests: Introduce gen-ust-events-constructor test application
[lttng-tools.git] / tests / utils / testapp / gen-ust-events-constructor / main.cpp
CommitLineData
a4cc1b1f
MD
1/*
2 * Copyright (C) 2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#include "obj.h"
8#include "tp-a.h"
9#include "tp-so.h"
10#include "tp.h"
11
12/* Use tracepoints defined and provided by shared libraries. */
13void test_constructor_so(void) __attribute__((constructor));
14void test_constructor_so(void)
15{
16 tracepoint(tp_so, constructor_c_provider_shared_library);
17}
18
19void test_destructor_so(void) __attribute__((destructor));
20void test_destructor_so(void)
21{
22 tracepoint(tp_so, destructor_c_provider_shared_library);
23}
24
25Objso g_objso_shared_library("global - shared library define and provider");
26
27/* Use tracepoints defined and provided by static archive. */
28void test_constructor_a(void) __attribute__((constructor));
29void test_constructor_a(void)
30{
31 tracepoint(tp_a, constructor_c_provider_static_archive);
32}
33
34void test_destructor_a(void) __attribute__((destructor));
35void test_destructor_a(void)
36{
37 tracepoint(tp_a, destructor_c_provider_static_archive);
38}
39
40Obja g_obja_static_archive("global - static archive define and provider");
41
42int main(void)
43{
44 Obj l_obj("main() local");
45 Objso l_objso("main() local - shared library define and provider");
46 Obja l_obja("main() local - static archive define and provider");
47
48 tracepoint(tp, main);
49 return 0;
50}
This page took 0.025772 seconds and 4 git commands to generate.