Project

General

Profile

Actions

Bug #1151

closed

Problem adding custom trace point to application.

Added by Casey Gregoire about 6 years ago. Updated about 6 years ago.

Status:
Invalid
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
01/29/2018
Due date:
% Done:

0%

Estimated time:

Description

When i tried to add a custom tracepoint i received the following error:
In file included from [...]include/lttng/ust-tracepoint-event.h:325,
from [...]/include/lttng/tracepoint-event.h:58,
from /[...]/base/utilities/common/include/uli_lttng_tracing.h:64,
from /[...]/base/utilities/common/src/uli_lttng_tracing.cpp:19:
[...]/include/uli_lttng_tracing.h:41: error: expected primary-expression before '.' token
/[...]/base/utilities/common/include/uli_lttng_tracing.h:41: error: expected primary-expression before '.' token
/[...]/base/utilities/common/include/uli_lttng_tracing.h:41: error: expected primary-expression before '{' token
/[...]/base/utilities/common/include/uli_lttng_tracing.h:41: error: expected `}' before '{' token
/[...]/base/utilities/common/include/uli_lttng_tracing.h:41: error: expected `}' before '{' token
/[...]/base/utilities/common/include/uli_lttng_tracing.h:41: error: expected ',' or ';' before '{' token

I added a custom trace point header:

#undef TRACEPOINT_PROVIDER
#define TRACEPOINT_PROVIDER test_tracepoint_provider

#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "uli_lttng_tracing.h"

#if !defined(_ULI_LTTNG_TRACING_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define _ULI_LTTNG_TRACING_H

#include <lttng/tracepoint.h>

/* * Use TRACEPOINT_EVENT(), TRACEPOINT_EVENT_CLASS(), * TRACEPOINT_EVENT_INSTANCE(), and TRACEPOINT_LOGLEVEL() here.
*/

/* Tracepoint definition /
TRACEPOINT_EVENT(
TRACEPOINT_PROVIDER,
generic_message,
TP_ARGS(
const char
, message
),
TP_FIELDS(
ctf_string(trace_message, message)
)
);

/* Log level assignment */
TRACEPOINT_LOGLEVEL(harris_tracepoint_provider, generic_message, TRACE_DEBUG_UNIT);

// Call this trace point by using
// tracepoint(harris_tracepoint_provider, generic_message, const char* message);

//More on how to use this is here: http://lttng.org/docs/v2.10/#doc-tracepoint-provider

#endif /* _ULI_LTTNG_TRACING_H */

#include <lttng/tracepoint-event.h>

AND MY CPP file looks like this:

#define TRACEPOINT_CREATE_PROBES

#include "uli_lttng_tracing.h"

Actions #1

Updated by Mathieu Desnoyers about 6 years ago

Based on lttng-ust(3), using a c++ compiler for lttng-ust probe providers is not supported:

Note
Although an application instrumented with LTTng-UST tracepoints can
be compiled with a C++ compiler, tracepoint probes should be
compiled with a C compiler.
Actions #2

Updated by Mathieu Desnoyers about 6 years ago

  • Status changed from New to Invalid
Actions

Also available in: Atom PDF