#define MARKER_LIB \
extern struct marker * const __start___markers_ptrs[] __attribute__((weak, visibility("hidden"))); \
extern struct marker * const __stop___markers_ptrs[] __attribute__((weak, visibility("hidden"))); \
+ static struct marker * const __mark_ptr_dummy \
+ __attribute__((used, section("__markers_ptrs"))) = NULL;\
\
static void __attribute__((constructor)) __markers__init(void) \
{ \
#define TRACEPOINT_LIB \
extern struct tracepoint * const __start___tracepoints_ptrs[] __attribute__((weak, visibility("hidden"))); \
extern struct tracepoint * const __stop___tracepoints_ptrs[] __attribute__((weak, visibility("hidden"))); \
+ static struct tracepoint * const __tracepoint_ptr_dummy \
+ __attribute__((used, section("__tracepoints_ptrs"))) = NULL; \
static void __attribute__((constructor)) __tracepoints__init(void) \
{ \
tracepoint_register_lib(__start___tracepoints_ptrs, \
__attribute__((weak, visibility("hidden"))); \
extern struct trace_event * const __stop___trace_events_ptrs[] \
__attribute__((weak, visibility("hidden"))); \
+ static struct trace_event * const __event_ptrs_dummy \
+ __attribute__((used, section("__trace_events_ptrs"))) = NULL; \
static void __attribute__((constructor)) \
__trace_events__init(void) \
{ \
#include <ust/marker.h>
#include <ust/tracepoint.h>
-/* FIXME: We have to define at least one trace_mark and
- * one tracepoint here. If we don't, the __start... and
- * __stop... symbols won't be defined and the constructors
- * won't be compilable. We should find a linker trick to
- * avoid this.
- */
-
-DECLARE_TRACE(ust_dummytp, TP_PROTO(int anint), TP_ARGS(anint));
-DEFINE_TRACE(ust_dummytp);
-
-#define CREATE_TRACE_POINTS
-#include "libust-initializer.h"
-
-void dummy_libust_initializer_func(void)
-{
- trace_mark(ust, dummymark, MARK_NOARGS);
- trace_ust_dummytp(0);
- trace_ust_dummy_event(0);
-}
-
MARKER_LIB;
TRACEPOINT_LIB;
TRACE_EVENT_LIB;
pthread_mutex_lock(&markers_mutex);
for (iter = begin; iter < end; iter++) {
+ if (!*iter)
+ continue; /* skip dummy */
mark_entry = get_marker((*iter)->channel, (*iter)->name);
if (mark_entry) {
set_marker(mark_entry, *iter, !!mark_entry->refcount);
struct marker * const *begin,
struct marker * const *end)
{
- if (!*marker && begin != end) {
+ if (!*marker && begin != end)
*marker = begin;
- return 1;
+ while (*marker >= begin && *marker < end) {
+ if (!**marker)
+ (*marker)++; /* skip dummy */
+ else
+ return 1;
}
- if (*marker >= begin && *marker < end)
- return 1;
return 0;
}
//ust// EXPORT_SYMBOL_GPL(marker_get_iter_range);
{
if (new_marker_cb) {
struct marker * const *m;
- for(m=start; m < end; m++) {
- new_marker_cb(*m);
+
+ for(m = start; m < end; m++) {
+ if (*m)
+ new_marker_cb(*m);
}
}
}
/* FIXME: update just the loaded lib */
lib_update_markers();
- DBG("just registered a markers section from %p and having %d markers", markers_start, markers_count);
+ /* markers_count - 1: skip dummy */
+ DBG("just registered a markers section from %p and having %d markers", markers_start, markers_count - 1);
return 0;
}
struct trace_event * const *begin,
struct trace_event * const *end)
{
- if (!*trace_event && begin != end) {
+ if (!*trace_event && begin != end)
*trace_event = begin;
- return 1;
+ while (*trace_event >= begin && *trace_event < end) {
+ if (!**trace_event)
+ (*trace_event)++; /* skip dummy */
+ else
+ return 1;
}
- if (*trace_event >= begin && *trace_event < end)
- return 1;
return 0;
}
lib_added:
pthread_mutex_unlock(&trace_events_mutex);
- DBG("just registered a trace_events section from %p and having %d trace_events", trace_events_start, trace_events_count);
+ /* trace_events_count - 1: skip dummy */
+ DBG("just registered a trace_events section from %p and having %d trace_events", trace_events_start, trace_events_count - 1);
return 0;
}
pthread_mutex_lock(&tracepoints_mutex);
for (iter = begin; iter < end; iter++) {
+ if (!*iter)
+ continue; /* skip dummy */
if (!(*iter)->name) {
disable_tracepoint(*iter);
continue;
int tracepoint_get_iter_range(struct tracepoint * const **tracepoint,
struct tracepoint * const *begin, struct tracepoint * const *end)
{
- if (!*tracepoint && begin != end) {
+ if (!*tracepoint && begin != end)
*tracepoint = begin;
- return 1;
+ while (*tracepoint >= begin && *tracepoint < end) {
+ if (!**tracepoint)
+ (*tracepoint)++; /* skip dummy */
+ else
+ return 1;
}
- if (*tracepoint >= begin && *tracepoint < end)
- return 1;
return 0;
}
//ust// EXPORT_SYMBOL_GPL(tracepoint_get_iter_range);
{
if (new_tracepoint_cb) {
struct tracepoint * const *t;
- for(t=start; t < end; t++) {
- new_tracepoint_cb(*t);
+
+ for(t = start; t < end; t++) {
+ if (*t)
+ new_tracepoint_cb(*t);
}
}
}
/* FIXME: update just the loaded lib */
lib_update_tracepoints();
- DBG("just registered a tracepoints section from %p and having %d tracepoints", tracepoints_start, tracepoints_count);
+ /* tracepoints_count - 1: skip dummy */
+ DBG("just registered a tracepoints section from %p and having %d tracepoints", tracepoints_start, tracepoints_count - 1);
return 0;
}