X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=markers-userspace%2Fmarker-lib.c;h=c13c9eec194fd7154151f4736cf75115422fc63a;hb=a010d844338a34772e08e5c41e1d28158982d522;hp=739c7580e8f1901519c88b0d34e4be25db2337dd;hpb=c604f8bf7748c424c3b4e5cb2f41f9860648123b;p=lttv.git diff --git a/markers-userspace/marker-lib.c b/markers-userspace/marker-lib.c index 739c7580..c13c9eec 100644 --- a/markers-userspace/marker-lib.c +++ b/markers-userspace/marker-lib.c @@ -3,7 +3,10 @@ #include #include +__attribute__ ((visibility ("protected"))) extern struct marker __start___markers[]; + +__attribute__ ((visibility ("protected"))) extern struct marker __stop___markers[]; /** @@ -18,6 +21,7 @@ extern struct marker __stop___markers[]; * though the function pointer change and the marker enabling are two distinct * operations that modifies the execution flow of preemptible code. */ +__attribute__ ((visibility ("protected"))) void __mark_empty_function(void *probe_private, void *call_private, const char *fmt, va_list *args) { @@ -31,6 +35,7 @@ void __mark_empty_function(void *probe_private, void *call_private, * @...: Variable argument list. * */ +__attribute__ ((visibility ("protected"))) void marker_probe_cb(const struct marker *mdata, void *call_private, const char *fmt, ...) { @@ -39,17 +44,45 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, printf("Test probe function %u\n", count++); } -__attribute__((constructor)) void marker_init(void) +//FIXME : imv_read won't work with optimized immediate values. +//will need to issue one sys_marker call for each immediate value. +__attribute__ ((visibility ("protected"))) +void testip(void) +{ + printf("addr : %p\n", __builtin_return_address(0)); +} + +__attribute__((constructor, visibility ("protected"))) +void marker_init(void) +{ + struct marker *iter; + int ret; + + printf("Marker section : from %p to %p (init)\n", + __start___markers, __stop___markers); + testip(); + for (iter = __start___markers; iter < __stop___markers; iter++) { + printf("Marker : %s\n", iter->name); + ret = sys_marker(iter->name, iter->format, + &imv_read(iter->state), 1); + if (ret) + perror("Error connecting markers"); + } +} + +__attribute__((destructor, visibility ("protected"))) +void marker_fini(void) { struct marker *iter; int ret; - printf("Marker section : from %p to %p\n", + printf("Marker section : from %p to %p (fini)\n", __start___markers, __stop___markers); - ret = sys_marker(__start___markers, __stop___markers); - if (ret) - perror("Error connecting markers"); for (iter = __start___markers; iter < __stop___markers; iter++) { printf("Marker : %s\n", iter->name); + ret = sys_marker(iter->name, iter->format, + &imv_read(iter->state), 0); + if (ret) + perror("Error disconnecting markers"); } }