[lttng-dev] notrace missing in lttng-ust
Woegerer, Paul
Paul_Woegerer at mentor.com
Wed Jul 18 08:51:43 EDT 2012
On 07/18/2012 01:42 PM, Mathieu Desnoyers wrote:
> e.g. here:
>
> static lttng_ust_notrace
> void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx,
> struct channel *chan, void *priv,
> size_t data_size, int largest_align,
> int cpu, struct lttng_ust_shm_handle *handle)
> {
> ... body of function ...
> }
For ringbuffer-config.h that will work but if you try the same in
tracepoint.h:258 with:
static lttng_ust_notrace void __attribute__((constructor))
__tracepoints__init(void)
you get:
Making all in hello.cxx
make[3]: Entering directory
`/home/pwoegere/MGC/SA/lttng-ust/tests/hello.cxx'
CXX hello.o
In file included from ust_tests_hello.h:21:0,
from hello.cpp:33:
../../include/lttng/tracepoint.h:258:60: error: can’t set
‘no_instrument_function’ attribute after definition
or if you try it in the macro definitons at tracepoint.h:141
you get:
Making all in hello.cxx
make[3]: Entering directory
`/home/pwoegere/MGC/SA/lttng-ust/tests/hello.cxx'
CXX hello.o
In file included from hello.cpp:33:0:
ust_tests_hello.h:43:1: error: can’t set ‘no_instrument_function’
attribute after definition
ust_tests_hello.h:43:1: error: can’t set ‘no_instrument_function’
attribute after definition
ust_tests_hello.h:43:1: error: can’t set ‘no_instrument_function’
attribute after definition
ust_tests_hello.h:48:1: error: can’t set ‘no_instrument_function’
attribute after definition
ust_tests_hello.h:48:1: error: can’t set ‘no_instrument_function’
attribute after definition
ust_tests_hello.h:48:1: error: can’t set ‘no_instrument_function’
attribute after definition
Anyway I send you a patch that uses the attribute on the definitions
wherever possible.
--
Paul
>
> Thanks,
>
> Mathieu
>
>> {
>> ctx->chan = chan;
>> @@ -276,6 +282,8 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx,
>> * size_of_type must be non-zero.
>> */
>> static inline
>> +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace;
>> +static inline
>> unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type)
>> {
>> return offset_align(align_drift, size_of_type);
>> @@ -290,6 +298,8 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type)
>> * size_of_type must be non-zero.
>> */
>> static inline
>> +unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace;
>> +static inline
>> unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type)
>> {
>> return 0;
>> @@ -303,6 +313,9 @@ unsigned int lib_ring_buffer_align(size_t align_drift, size_t size_of_type)
>> */
>> static inline
>> void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx,
>> + size_t alignment) lttng_ust_notrace;
>> +static inline
>> +void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx,
>> size_t alignment)
>> {
>> ctx->buf_offset += lib_ring_buffer_align(ctx->buf_offset,
>> @@ -316,6 +329,10 @@ void lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx,
>> static inline
>> int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config,
>> unsigned int switch_timer_interval,
>> + unsigned int read_timer_interval) lttng_ust_notrace;
>> +static inline
>> +int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config,
>> + unsigned int switch_timer_interval,
>> unsigned int read_timer_interval)
>> {
>> if (config->alloc == RING_BUFFER_ALLOC_GLOBAL
>> diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h
>> index 5bab476..77595d3 100644
>> --- a/include/lttng/tracepoint.h
>> +++ b/include/lttng/tracepoint.h
>> @@ -22,6 +22,7 @@
>> #include <string.h> /* for memset */
>> #include <assert.h>
>> #include <lttng/ust-config.h> /* for sdt */
>> +#include <lttng/ust-compiler.h>
>>
>> #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION
>> #define SDT_USE_VARIADIC
>> @@ -137,6 +138,7 @@ extern "C" {
>>
>> #define _DECLARE_TRACEPOINT(_provider, _name, ...) \
>> extern struct tracepoint __tracepoint_##_provider##___##_name; \
>> +static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) lttng_ust_notrace; \
>> static inline void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \
>> { \
>> struct tracepoint_probe *__tp_probe; \
>> @@ -158,12 +160,16 @@ end: \
>> tp_rcu_read_unlock_bp(); \
>> } \
>> static inline void __tracepoint_register_##_provider##___##_name(char *name, \
>> + void (*func)(void), void *data) lttng_ust_notrace; \
>> +static inline void __tracepoint_register_##_provider##___##_name(char *name, \
>> void (*func)(void), void *data) \
>> { \
>> __tracepoint_probe_register(name, func, data, \
>> __tracepoint_##_provider##___##_name.signature); \
>> } \
>> static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \
>> + void (*func)(void), void *data) lttng_ust_notrace; \
>> +static inline void __tracepoint_unregister_##_provider##___##_name(char *name, \
>> void (*func)(void), void *data) \
>> { \
>> __tracepoint_probe_unregister(name, func, data); \
>> @@ -249,6 +255,7 @@ int __tracepoint_registered
>> struct tracepoint_dlopen tracepoint_dlopen
>> __attribute__((weak, visibility("hidden")));
>>
>> +static void __attribute__((constructor)) __tracepoints__init(void) lttng_ust_notrace;
>> static void __attribute__((constructor)) __tracepoints__init(void)
>> {
>> if (__tracepoint_registered++)
>> @@ -285,6 +292,7 @@ static void __attribute__((constructor)) __tracepoints__init(void)
>> __start___tracepoints_ptrs);
>> }
>>
>> +static void __attribute__((destructor)) __tracepoints__destroy(void) lttng_ust_notrace;
>> static void __attribute__((destructor)) __tracepoints__destroy(void)
>> {
>> int ret;
>> diff --git a/include/lttng/ust-compiler.h b/include/lttng/ust-compiler.h
>> new file mode 100644
>> index 0000000..c35a23e
>> --- /dev/null
>> +++ b/include/lttng/ust-compiler.h
>> @@ -0,0 +1,21 @@
>> +#ifndef _LTTNG_UST_COMPILER_H
>> +#define _LTTNG_UST_COMPILER_H
>> +
>> +/*
>> + * Copyright 2011-2012 - Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
>> + * Paul Woegerer <paul_woegerer at mentor.com>
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a copy
>> + * of this software and associated documentation files (the "Software"), to deal
>> + * in the Software without restriction, including without limitation the rights
>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>> + * copies of the Software, and to permit persons to whom the Software is
>> + * furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice shall be included in
>> + * all copies or substantial portions of the Software.
>> + */
>> +
>> +#define lttng_ust_notrace __attribute__((no_instrument_function))
>> +
>> +#endif /* _LTTNG_UST_COMPILER_H */
>> diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h
>> index 8db1e68..8628dbe 100644
>> --- a/include/lttng/ust-tracepoint-event.h
>> +++ b/include/lttng/ust-tracepoint-event.h
>> @@ -16,6 +16,7 @@
>> #include <urcu/compiler.h>
>> #include <lttng/ust-events.h>
>> #include <lttng/ringbuffer-config.h>
>> +#include <lttng/ust-compiler.h>
>> #include <string.h>
>>
>> /*
>> @@ -244,6 +245,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args));
>>
>> #undef TRACEPOINT_EVENT_CLASS
>> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
>> +static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \
>> static inline size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \
>> { \
>> size_t __event_len = 0; \
>> @@ -361,6 +363,7 @@ void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\
>> #undef TRACEPOINT_EVENT_CLASS
>> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
>> static inline \
>> +size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) lttng_ust_notrace; \
>> size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \
>> { \
>> size_t __event_align = 1; \
>> @@ -438,6 +441,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \
>> */
>> #undef TRACEPOINT_EVENT_CLASS
>> #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
>> +static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) lttng_ust_notrace; \
>> static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\
>> { \
>> struct ltt_event *__event = __tp_data; \
>> @@ -594,6 +598,8 @@ static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PR
>> /* Reset all macros within TRACEPOINT_EVENT */
>> #include <lttng/ust-tracepoint-event-reset.h>
>> static void __attribute__((constructor))
>> +_TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace;
>> +static void __attribute__((constructor))
>> _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void)
>> {
>> int ret;
>> @@ -603,6 +609,8 @@ _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void)
>> }
>>
>> static void __attribute__((destructor))
>> +_TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void) lttng_ust_notrace;
>> +static void __attribute__((destructor))
>> _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void)
>> {
>> ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
>> --
>> 1.7.10.4
>>
>
--
Paul Woegerer | SW Development Engineer
Mentor Embedded(tm) | Prinz Eugen Straße 72/2/4, Vienna, 1040 Austria
P 43.1.535991320
Nucleus® | Linux® | Android(tm) | Services | UI | Multi-OS
Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Make-lttng-ust-robust-against-finstrument-functions.patch
Type: text/x-patch
Size: 9666 bytes
Desc: not available
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20120718/cc1b092d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Use-lttng_ust_notrace-on-definitons-instead-of-decla.patch
Type: text/x-patch
Size: 6395 bytes
Desc: not available
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20120718/cc1b092d/attachment-0001.bin>
More information about the lttng-dev
mailing list