- this also includes being able to link libmarkers dynamically
- a special init function must be added via the MARKER_LIB macro
hello: hello.c
#dynamic version
hello: hello.c
#dynamic version
-# gcc -g -I../libmarkers -I../share -I../libtracing -L../libmarkers -lmarkers -L../libtracectl -ltracectl -L../libtracing -ltracing -o hello hello.c marker-control.c serialize.c -static
+ gcc -g -Wl,--print-map -I../libmarkers -I../share -I../libtracing -L../libmarkers -lmarkers -L../libtracectl -ltracectl -L../libtracing -ltracing -o hello hello.c marker-control.c serialize.c
- gcc -g -I../libmarkers -I../share -I../libtracing -L../libmarkers -o hello hello.c marker-control.c serialize.c ../libtracing/*.c ../libmarkers/*.c ../libtracectl/*.c ../share/*.c
+# gcc -g -I../libmarkers -I../share -I../libtracing -L../libmarkers -o hello hello.c marker-control.c serialize.c ../libtracing/*.c ../libmarkers/*.c ../libtracectl/*.c ../share/*.c
printf("page size is %d\n", sysconf(_SC_PAGE_SIZE));
printf("page size is %d\n", sysconf(_SC_PAGE_SIZE));
+// extern struct marker __start___markers[] __attribute__((visibility("hidden")));
+// extern struct marker __stop___markers[] __attribute__((visibility("hidden")));
+//
+// printf("the executable's markers start at %lx and end at %lx, the size of a marker is %d\n", __start___markers, __stop___markers, sizeof(struct marker));
+
marker_control_init();
//marker_probe_register("abc", "testmark", "", probe, NULL);
marker_control_init();
//marker_probe_register("abc", "testmark", "", probe, NULL);
#include "tracercore.h"
#include "tracer.h"
#include "tracercore.h"
#include "tracer.h"
-extern struct marker __start___markers[];
-extern struct marker __stop___markers[];
+extern struct marker __start___markers[] __attribute__((visibility("hidden")));
+extern struct marker __stop___markers[] __attribute__((visibility("hidden")));
/* Set to 1 to enable marker debug output */
static const int marker_debug;
/* Set to 1 to enable marker debug output */
static const int marker_debug;
static void marker_update_probes(void)
{
/* Core kernel markers */
static void marker_update_probes(void)
{
/* Core kernel markers */
- marker_update_probe_range(__start___markers, __stop___markers);
+//ust// marker_update_probe_range(__start___markers, __stop___markers);
/* Markers in modules. */
//ust// module_update_markers();
/* Markers in modules. */
//ust// module_update_markers();
//ust// tracepoint_probe_update_all();
/* Update immediate values */
core_imv_update();
//ust// tracepoint_probe_update_all();
/* Update immediate values */
core_imv_update();
/* Core kernel markers */
if (!iter->lib) {
/* Core kernel markers */
if (!iter->lib) {
+ /* ust FIXME: how come we cannot disable the following line? we shouldn't need core stuff */
found = marker_get_iter_range(&iter->marker,
__start___markers, __stop___markers);
if (found)
found = marker_get_iter_range(&iter->marker,
__start___markers, __stop___markers);
if (found)
+void lib_update_markers(void)
+{
+ struct lib *lib;
+
+//ust// mutex_lock(&module_mutex);
+ list_for_each_entry(lib, &libs, list)
+ marker_update_probe_range(lib->markers_start,
+ lib->markers_start + lib->markers_count);
+//ust// mutex_unlock(&module_mutex);
+}
+
int marker_register_lib(struct marker *markers_start, int markers_count)
{
struct lib *pl;
int marker_register_lib(struct marker *markers_start, int markers_count)
{
struct lib *pl;
+
+static void __attribute__((constructor)) __markers__init(void)
+{
+ marker_register_lib(__start___markers, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));
+ printf("markers_start: %p, markers_stop: %p\n", __start___markers, __stop___markers);
+}
struct list_head list;
};
struct list_head list;
};
+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) \
+{ \
+ marker_register_lib(__start___markers, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));\
+}