create directories branches, tags, trunk
[lttv.git] / markers-userspace / marker-lib.c
index e5ae4fb8baa174bdbd4832b72a9068b6337dcea2..14d2466d4c8904a86791f13ba6e3c633493f6164 100644 (file)
@@ -2,8 +2,12 @@
 #include "marker.h"
 #include <stdio.h>
 #include <errno.h>
+#include <sys/user.h>
 
+__attribute__ ((visibility ("protected")))
 extern struct marker __start___markers[];
+
+__attribute__ ((visibility ("protected")))
 extern struct marker __stop___markers[];
 
 /**
@@ -18,6 +22,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,24 +36,36 @@ 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, ...)
 {
-       static unsigned int count = 0;
+       char buf[PAGE_SIZE];
+       va_list ap;
 
-       printf("Test probe function %u\n", count++);
+       va_start(ap, fmt);
+       vsnprintf(buf, PAGE_SIZE-1, fmt, ap);
+       sys_trace(0, 0, buf);
+       va_end(ap);
 }
 
 //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)) void marker_init(void)
+__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,
@@ -58,7 +75,8 @@ __attribute__((constructor)) void marker_init(void)
        }
 }
 
-__attribute__((destructor)) void marker_fini(void)
+__attribute__((destructor, visibility ("protected")))
+void marker_fini(void)
 {
        struct marker *iter;
        int ret;
This page took 0.034612 seconds and 4 git commands to generate.