extern struct marker __start___markers[] __attribute__((visibility("hidden")));
extern struct marker __stop___markers[] __attribute__((visibility("hidden")));
+extern struct marker_addr __start___marker_addr[] __attribute__((visibility("hidden")));
+extern struct marker_addr __stop___marker_addr[] __attribute__((visibility("hidden")));
/* Set to 1 to enable marker debug output */
static const int marker_debug;
}
}
-int marker_register_lib(struct marker *markers_start, int markers_count)
+int marker_register_lib(struct marker *markers_start, struct marker_addr *marker_addr_start, int markers_count)
{
struct lib *pl;
+ struct marker_addr *addr;
pl = (struct lib *) malloc(sizeof(struct lib));
pl->markers_start = markers_start;
+ pl->markers_addr_start = marker_addr_start;
pl->markers_count = markers_count;
+ lock_markers();
+ for(addr = marker_addr_start; addr < marker_addr_start + markers_count; addr++)
+ addr->marker->location = addr->addr;
+ unlock_markers();
+
/* FIXME: maybe protect this with its own mutex? */
lock_markers();
list_add(&pl->list, &libs);
void __attribute__((constructor)) init_markers(void)
{
if(!initialized) {
- marker_register_lib(__start___markers, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));
- DBG("markers_start: %p, markers_stop: %p\n", __start___markers, __stop___markers);
+ marker_register_lib(__start___markers, __start___marker_addr, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));
+ //DBG("markers_start: %p, markers_stop: %p\n", __start___markers, __stop___markers);
initialized = 1;
}
}
#include "kernelcompat.h"
#include <kcompat/list.h>
#include "localerr.h"
+#include "registers.h"
//ust// struct module;
//ust// struct task_struct;
struct marker_probe_closure *multi;
const char *tp_name; /* Optional tracepoint name */
void *tp_cb; /* Optional tracepoint callback */
+ void *location; /* Address of marker in code */
} __attribute__((aligned(8)));
#define CONFIG_MARKERS
sizeof(#name)], \
0, 0, 0, 0, marker_probe_cb, \
{ __mark_empty_function, NULL}, \
- NULL, tp_name_str, tp_cb }
+ NULL, tp_name_str, tp_cb }; \
+ asm (".section __marker_addr,\"aw\",@progbits\n\t" \
+ _ASM_PTR "%c[marker_struct], (1f)\n\t" \
+ ".previous\n\t" \
+ "\n\t" \
+ "1:\n\t" \
+ :: [marker_struct] "i" (&__mark_##channel##_##name));\
+ save_registers(®s)
+
+
#define DEFINE_MARKER(channel, name, format) \
_DEFINE_MARKER(channel, name, NULL, NULL, format)
//ust// }
//ust// #endif
+struct marker_addr {
+ struct marker *marker;
+ void *addr;
+};
struct lib {
struct marker *markers_start;
+ struct marker_addr *markers_addr_start;
int markers_count;
struct list_head list;
};
-extern int marker_register_lib(struct marker *markers_start,
- int markers_count);
-
-#define MARKER_LIB \
-extern struct marker __start___markers[] __attribute__((visibility("hidden"))); \
-extern struct marker __stop___markers[] __attribute__((visibility("hidden"))); \
- \
-static void __attribute__((constructor)) __markers__init(void) \
-{ \
- DBG("next registration in "__FILE__"\n");\
- marker_register_lib(__start___markers, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));\
+extern int marker_register_lib(struct marker *markers_start, struct marker_addr *marker_addr_start, int markers_count);
+
+#define MARKER_LIB \
+extern struct marker __start___markers[] __attribute__((visibility("hidden"))); \
+extern struct marker __stop___markers[] __attribute__((visibility("hidden"))); \
+extern struct marker_addr __start___marker_addr[] __attribute__((visibility("hidden"))); \
+extern struct marker_addr __stop___marker_addr[] __attribute__((visibility("hidden"))); \
+ \
+static void __attribute__((constructor)) __markers__init(void) \
+{ \
+ DBG("next registration in "__FILE__"\n"); \
+ marker_register_lib(__start___markers, __start___marker_addr, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker)); \
}
extern void marker_set_new_marker_cb(void (*cb)(struct marker *));
marker_iter_start(&iter);
while(iter.marker) {
- fprintf(fp, "marker: %s/%s %d \"%s\"\n", iter.marker->channel, iter.marker->name, (int)imv_read(iter.marker->state), iter.marker->format);
+ fprintf(fp, "marker: %s/%s %d \"%s\" %p\n", iter.marker->channel, iter.marker->name, (int)imv_read(iter.marker->state), iter.marker->format, iter.marker->location);
marker_iter_next(&iter);
}
unlock_markers();
if(result && result != -EEXIST)
ERR("ltt_marker_connect (marker = %s/%s, errno = %d)", m->channel, m->name, -result);
- DBG("auto connected marker %s %s to probe default", m->channel, m->name);
+ DBG("auto connected marker %s (addr: %p) %s to probe default", m->channel, m, m->name);
}