Markers: temporarily remove GDB support
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 26 Apr 2011 21:31:35 +0000 (17:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 26 Apr 2011 21:31:35 +0000 (17:31 -0400)
Remove GDB support temporarily, awaiting a better implementation that
does not require so much asm trickery. Imported the kernel LTTng code
back into UST to use C declarations for the marker structures.

The plan is to move to a SDT-based implementation (using variable
number of arguments).

This patch is required to make the MIPS port work. Tested by Jason
Wessel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tested-by: Jason Wessel <jason.wessel@windriver.com>
doc/info/ust.texi
include/ust/marker.h
include/ust/processor.h
libust/marker.c
libust/serialize.c
libust/tracectl.c
libust/tracer.h
libust/type-serializer.c
tests/make_shared_lib/Makefile

index 4a06ccdf94273caaf6becaa68c87cbe789d0ce3c..52de152e19918135fd76128783bceaa882efb53f 100644 (file)
@@ -606,25 +606,6 @@ If set, defines the default size of subbuffers, in bytes.
 GDB, the GNU Debugger, can use UST markers as GDB tracepoints (note GDB has its
 own concept of tracepoint). This feature is called GDB Static Tracepoints. When
 a GDB tracepoint is hit, GDB collects the marker arguments, as well as the
-state of the registers.
-
-In UST, support for GDB integration is not compiled in by default because of
-the cost of saving registers when a marker is hit. To enable it, run the
-@command{./configure} script with the @code{-DCONFIG_UST_GDB_INTEGRATION} flag
-in the @env{CFLAGS} environment variable. For example:
-
-@example
-@verbatim
-
-CFLAGS=-DCONFIG_UST_GDB_INTEGRATION ./configure
-
-@end verbatim
-@end example
-
-As of this writing, GDB Static Tracepoints have been submitted
-(@url{http://sourceware.org/ml/gdb-patches/2010-06/msg00592.html}) to the GDB
-mailing list.
-
-GDB integration is currently only supported on x86-32 and x86-64.
+state of the registers. Support for GDB is currently work in progress.
 
 @bye
index 009548fb533ecf5f1da5732dc8b6280af16e56b1..8f72c73b953c8de73a93b4689db50a8a4d9c7a7b 100644 (file)
@@ -5,6 +5,7 @@
  *
  * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
  * (C) Copyright 2009 Pierre-Marc Fournier <pierre-marc dot fournier at polymtl dot ca>
+ * (C) Copyright 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,9 +28,7 @@
 #include <stdarg.h>
 #include <ust/core.h>
 #include <urcu/list.h>
-#include <ust/processor.h>
 #include <ust/kcompat/kcompat.h>
-#include <ust/kcompat/stringify.h>
 
 #include <bits/wordsize.h>
 
@@ -49,7 +48,7 @@ struct ust_marker;
  * format string to recover the variable argument list.
  */
 typedef void ust_marker_probe_func(const struct ust_marker *mdata,
-               void *probe_private, struct registers *regs, void *call_private,
+               void *probe_private, void *call_private,
                const char *fmt, va_list *args);
 
 struct ust_marker_probe_closure {
@@ -68,93 +67,46 @@ struct ust_marker {
                                /* Probe wrapper */
        u16 channel_id;         /* Numeric channel identifier, dynamic */
        u16 event_id;           /* Numeric event identifier, dynamic */
-       void (*call)(const struct ust_marker *mdata, void *call_private, struct registers *regs, ...);
+       void (*call)(const struct ust_marker *mdata, void *call_private, ...);
        struct ust_marker_probe_closure single;
        struct ust_marker_probe_closure *multi;
        const char *tp_name;    /* Optional tracepoint name */
        void *tp_cb;            /* Optional tracepoint callback */
-       void *location;         /* Address of marker in code */
 };
 
-#define GET_UST_MARKER(name)           (__ust_marker_ust_##name)
-
-#define _DEFINE_UST_MARKER(channel, name, tp_name_str, tp_cb, format, unique, m)                       \
-               struct registers __ust_marker_regs;                                                     \
-                                                                                               \
-               /* This next asm has to be a basic inline asm (no input/output/clobber),        \
-                * because it must not require %-sign escaping, as we most certainly            \
-                * have some %-signs in the format string.                                      \
-                */                                                                             \
-               asm volatile (                                                                  \
-                       /* We only define these symbols if they have not yet been defined. Indeed, \
-                        * if two markers with the same channel/name are on the same line, they \
-                        * will try to create the same symbols, resulting in a conflict. This   \
-                        * is not unusual as it can be the result of function inlining.         \
-                        */                                                                     \
-                       ".ifndef __mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) "\n\t"  \
-                       /*".section __ust_marker_strings\n\t"*/                                 \
-                       ".section __ust_marker_strings,\"aw\"\n\t"                                      \
-                       "__mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) ":\n\t" \
-                       ".string \"" __stringify(channel) "\"\n\t"                                      \
-                       "__mstrtab_" __stringify(channel) "_" __stringify(name) "_name_" __stringify(unique) ":\n\t"    \
-                       ".string \"" __stringify(name) "\"\n\t"                                         \
-                       "__mstrtab_" __stringify(channel) "_" __stringify(name) "_format_" __stringify(unique) ":\n\t"  \
-                       ".string " "\"" format "\"" "\n\t"                                              \
-                       ".previous\n\t"                                                         \
-                       ".endif\n\t"                                                            \
-               );                                                                              \
-               asm volatile (                                                                  \
-                       /*".section __ust_marker\n\t"*/ \
-                       ".section __ust_marker,\"aw\"\n\t"                                              \
-                       "2:\n\t" \
-                       _ASM_PTR "(__mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) ")\n\t" /* channel string */ \
-                       _ASM_PTR "(__mstrtab_" __stringify(channel) "_" __stringify(name) "_name_" __stringify(unique) ")\n\t" /* name string */ \
-                       _ASM_PTR "(__mstrtab_" __stringify(channel) "_" __stringify(name) "_format_" __stringify(unique) ")\n\t" /* format string */ \
-                       ".byte 0\n\t" /* state imv */                                           \
-                       ".byte 0\n\t" /* ptype */                                                       \
-                       ".hword 0\n\t" /* channel_id */                                         \
-                       ".hword 0\n\t" /* event_id */                                           \
-                       ".balign " __stringify(__WORDSIZE) " / 8\n\t" /* alignment */                   \
-                       _ASM_PTR "(ust_marker_probe_cb)\n\t" /* call */                         \
-                       _ASM_PTR "(__ust_marker_empty_function)\n\t" /* ust_marker_probe_closure single.field1 */ \
-                       _ASM_PTR "0\n\t" /* ust_marker_probe_closure single.field2 */                   \
-                       _ASM_PTR "0\n\t" /* ust_marker_probe_closure *multi */                          \
-                       _ASM_PTR "0\n\t" /* tp_name */                                          \
-                       _ASM_PTR "0\n\t" /* tp_cb */                                            \
-                       _ASM_PTR "(1f)\n\t" /* location */                                              \
-                       ".previous\n\t"                                                         \
-                       /*".section __ust_marker_ptrs\n\t"*/ \
-                       ".section __ust_marker_ptrs,\"aw\"\n\t"                                 \
-                       _ASM_PTR "(2b)\n\t"                                                     \
-                       ".previous\n\t"                                                         \
-                       "1:\n\t"                                                                \
-                       ARCH_COPY_ADDR("%[outptr]")                                             \
-               : [outptr] "=r" (m) );                                                          \
-                                                                                               \
-               save_registers(&__ust_marker_regs)
-
-
-#define DEFINE_UST_MARKER(name, format, unique, m)                     \
-               _DEFINE_UST_MARKER(ust, name, NULL, NULL, format, unique, m)
+#define GET_UST_MARKER(name)           (__ust_marker_def_##name)
 
-#define DEFINE_UST_MARKER_TP(name, tp_name, tp_cb, format)             \
-               _DEFINE_UST_MARKER_TP(ust, name, #tp_name, tp_cb, format)
+/*
+ * We keep the "channel" as internal field for marker.c *only*. It will be
+ * removed soon.
+ */
 
-#define _DEFINE_UST_MARKER_TP(channel, name, tp_name_str, tp_cb, format)\
+/*
+ * __ust_marker_ptrs section is not const (read-only) because it needs to be
+ * read-write to let the linker apply relocations and keep the object PIC.
+ */
+#define _DEFINE_UST_MARKER(channel, name, tp_name_str, tp_cb, format)  \
                static const char __mstrtab_##channel##_##name[]        \
-               __attribute__((section("__ust_marker_strings")))        \
+               __attribute__((section("__ust_markers_strings")))       \
                = #channel "\0" #name "\0" format;                      \
-               static struct ust_marker __ust_marker_##channel##_##name\
-               __attribute__((section("__ust_marker"))) =              \
+               static struct ust_marker __ust_marker_def_##name        \
+               __attribute__((section("__ust_markers"))) =             \
                { __mstrtab_##channel##_##name,                         \
-                       &__mstrtab_##channel##_##name[sizeof(#channel)],\
-                       &__mstrtab_##channel##_##name[sizeof(#channel) + sizeof(#name)],                \
-                       0, 0, 0, 0, ust_marker_probe_cb,                \
-                       { __ust_marker_empty_function, NULL},           \
-                       NULL, tp_name_str, tp_cb };                     \
-               static struct ust_marker * const __ust_marker_ptr_##channel##_##name    \
+                 &__mstrtab_##channel##_##name[sizeof(#channel)],      \
+                 &__mstrtab_##channel##_##name[sizeof(#channel) +      \
+                                               sizeof(#name)],         \
+                 0, 0, 0, 0, ust_marker_probe_cb,                      \
+                 { __ust_marker_empty_function, NULL},                 \
+                 NULL, tp_name_str, tp_cb };                           \
+               static struct ust_marker * __ust_marker_ptr_##name      \
                        __attribute__((used, section("__ust_marker_ptrs"))) =   \
-                       &__ust_marker_##channel##_##name;
+                       &__ust_marker_def_##name
+
+#define DEFINE_UST_MARKER(name, format)                                        \
+               _DEFINE_UST_MARKER(ust, name, NULL, NULL, format)
+
+#define DEFINE_UST_MARKER_TP(name, tp_name, tp_cb, format)             \
+               _DEFINE_UST_MARKER(ust, name, #tp_name, tp_cb, format)
 
 /*
  * Make sure the alignment of the structure in the __ust_marker section will
@@ -162,32 +114,27 @@ struct ust_marker {
  * structure. Force alignment to the same alignment as the section start.
  */
 
-#define __ust_marker(channel, name, call_private, format, args...) \
-       __ust_marker_counter(channel, name, __LINE__, call_private, format, ## args)
-
-#define __ust_marker_counter(channel, name, unique, call_private, format, args...) \
+#define __ust_marker(channel, name, call_private, format, args...)     \
        do {                                                            \
-               struct ust_marker *__ust_marker_counter_ptr;                    \
-               _DEFINE_UST_MARKER(channel, name, NULL, NULL, format, unique, __ust_marker_counter_ptr);        \
+               _DEFINE_UST_MARKER(channel, name, NULL, NULL, format);  \
                __ust_marker_check_format(format, ## args);             \
-               if (unlikely(__ust_marker_counter_ptr->state)) \
-                       (__ust_marker_counter_ptr->call)(__ust_marker_counter_ptr, call_private, &__ust_marker_regs, ## args);          \
+               if (unlikely(__ust_marker_def_##name.state))            \
+                       (__ust_marker_def_##name.call)                  \
+                               (&__ust_marker_def_##name, call_private,\
+                               ## args);                               \
        } while (0)
 
-#define __ust_marker_tp(channel, name, call_private, tp_name, tp_cb, format, args...) \
-       __ust_marker_tp_counter(channel, name, __LINE__, call_private, tp_name, tp_cb, format, ## args)
-
-#define __ust_marker_tp_counter(channel, name, unique, call_private, tp_name, tp_cb, format, args...) \
+#define __ust_marker_tp(name, call_private, tp_name, tp_cb,            \
+                       format, args...)                                \
        do {                                                            \
-               struct registers __ust_marker_regs;                             \
                void __check_tp_type(void)                              \
                {                                                       \
-                       register_trace_##tp_name(tp_cb, call_private);          \
+                       register_trace_##tp_name(tp_cb, call_private);  \
                }                                                       \
-               _DEFINE_UST_MARKER_TP(channel, name, #tp_name, tp_cb, format);  \
+               DEFINE_UST_MARKER_TP(name, #tp_name, tp_cb, format);    \
                __ust_marker_check_format(format, ## args);             \
-               (*__ust_marker_##channel##_##name.call)(&__ust_marker_##channel##_##name,       \
-                       call_private, &__ust_marker_regs, ## args);                             \
+               (*__ust_marker_def_##name.call)                         \
+                       (&__ust_marker_def_##name, call_private, ## args);      \
        } while (0)
 
 extern void ust_marker_update_probe_range(struct ust_marker * const *begin,
@@ -262,7 +209,7 @@ static inline void __printf(1, 2) ___ust_marker_check_format(const char *fmt, ..
 extern ust_marker_probe_func __ust_marker_empty_function;
 
 extern void ust_marker_probe_cb(const struct ust_marker *mdata,
-       void *call_private, struct registers *regs, ...);
+       void *call_private, ...);
 
 /*
  * Connect a probe to a marker.
@@ -325,9 +272,6 @@ struct ust_marker_addr {
 
 struct ust_marker_lib {
        struct ust_marker * const *ust_marker_start;
-#ifdef CONFIG_UST_GDB_INTEGRATION
-       struct ust_marker_addr *ust_marker_addr_start;
-#endif
        int ust_marker_count;
        struct cds_list_head list;
 };
@@ -338,8 +282,8 @@ extern int ust_marker_unregister_lib(struct ust_marker * const *ust_marker_start
 #define UST_MARKER_LIB                                                 \
        extern struct ust_marker * const __start___ust_marker_ptrs[] __attribute__((weak, visibility("hidden"))); \
        extern struct ust_marker * const __stop___ust_marker_ptrs[] __attribute__((weak, visibility("hidden"))); \
-       static struct ust_marker * const __ust_marker_ptr_dummy                 \
-               __attribute__((used, section("__ust_marker_ptrs"))) = NULL;\
+       static struct ust_marker * __ust_marker_ptr_dummy               \
+               __attribute__((used, section("__ust_marker_ptrs")));    \
                                                                        \
        static void __attribute__((constructor)) __ust_marker__init(void)       \
        {                                                               \
index 35dcbb2eff33dc08c473741d368dda7b7d61711e..e3407bab9b94a7a3ea348e39e6893b0067679b64 100644 (file)
 #ifndef UST_PROCESSOR_H
 #define UST_PROCESSOR_H
 
-#include <stddef.h>
-#include <string.h>
-#include <urcu-bp.h>
-
-extern __thread long ust_reg_stack[500];
-extern volatile __thread long *ust_reg_stack_ptr;
-
 #define ____cacheline_aligned __attribute__((aligned(CAA_CACHE_LINE_SIZE)))
 
 #ifdef __i386
 
-struct registers {
-       short ss;
-       short cs;
-       long esi;
-       long ebp;
-       long edx;
-       long edi;
-       long ecx;
-       long ebx;
-       long eax;
-       long eflags;
-       long esp;
-};
-
 static inline int fls(int x)
 {
         int r;
@@ -52,193 +31,8 @@ static inline int fls(int x)
         return r + 1;
 }
 
-#ifdef CONFIG_UST_GDB_INTEGRATION
-
-/* save_registers - saves most of the processor's registers so
- * they are available to the probe. gdb uses this to give the
- * value of local variables.
- *
- * Saving all registers without losing any of their values is
- * tricky.
- *
- * We cannot pass to the asm stub the address of a registers structure
- * on the stack, because it will use a register and override its value.
- *
- * We don't want to use a stub to push the regs on the stack and then
- * another stub to copy them to a structure because changing %sp in asm
- * and then returning to C (even briefly) can have unexpected results.
- * Also, gcc might modify %sp between the stubs in reaction to the
- * register needs of the second stub that needs to know where to copy
- * the register values.
- *
- * So the chosen approach is to use another stack, declared in thread-
- * local storage, to push the registers. They are subsequently copied
- * to the stack, by C code.
- */
-
-#define save_registers(regsptr) \
-       asm volatile ( \
-            /* save original esp */ \
-            "pushl %%esp\n\t" \
-            /* push original eflags */ \
-            "pushfl\n\t" \
-             /* eax will hold the ptr to the private stack bottom */ \
-            "pushl %%eax\n\t" \
-            /* ebx is used for TLS access */ \
-            "pushl %%ebx\n\t" \
-            /* ecx will be used to temporarily hold the stack bottom addr */\
-            "pushl %%ecx\n\t"                                               \
-            /* rdi is the input to __tls_get_addr, and also a temp var */   \
-            "pushl %%edi\n\t"                                               \
-            /* For TLS access, we have to do function calls. However,       \
-             * we must not lose the original value of:                      \
-             *   esp, eflags, eax, ebx, ecx, edx, esi, edi, ebp, cs, ss     \
-             *                                                              \
-             * Some registers' original values have already been saved:     \
-             *   esp, eflags, eax, ebx, ecx, edi                            \
-             *                                                              \
-             * In addition, the i386 ABI says the following registers belong\
-             * to the caller function:                                      \
-             *   esp, ebp, esi, edi, ebx                                    \
-             *                                                              \
-             * The following registers should not be changed by the callee: \
-             *   cs, ss                                                     \
-             *                                                              \
-             * Therefore, the following registers must be explicitly        \
-             * preserved:                                                   \
-             *   edx                                                        \
-             */ \
-            "pushl %%edx\n\t" \
-            /* Get GOT address */ \
-            "call __i686.get_pc_thunk.bx\n\t" \
-            "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
-            /* Start TLS access of private reg stack pointer */ \
-            "leal ust_reg_stack_ptr@tlsgd(,%%ebx,1),%%eax\n\t" \
-            "call ___tls_get_addr@plt\n\t" \
-            /* --- End TLS access */ \
-            /* check if ust_reg_stack_ptr has been initialized */ \
-            "movl (%%eax),%%ecx\n\t" \
-            "testl %%ecx,%%ecx\n\t" \
-            "jne 1f\n\t" \
-            "movl %%eax,%%ecx\n\t" \
-            /* Save ecx because we are using it. */ \
-            "pushl %%ecx\n\t" \
-            /* Start TLS access of private reg stack */ \
-            "leal ust_reg_stack@tlsgd(,%%ebx,1),%%eax\n\t" \
-            "call ___tls_get_addr@plt\n\t" \
-            /* --- End TLS access */ \
-            "popl %%ecx\n\t" \
-            "addl $500,%%eax\n\t" \
-            "movl %%eax,(%%ecx)\n\t" \
-            "movl %%ecx,%%eax\n\t" \
-            /* now the pointer to the private stack is in eax. \
-               must add stack size so the ptr points to the stack bottom. */ \
-       "1:\n\t" \
-            /* edx was pushed for function calls */ \
-            "popl %%edx\n\t" \
-            /* Manually push esp to private stack */ \
-            "addl $-4,(%%eax)\n\t" \
-            "movl 20(%%esp), %%edi\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%edi, (%%ebx)\n\t" \
-            /* Manually push eflags to private stack */ \
-            "addl $-4,(%%eax)\n\t" \
-            "movl 16(%%esp), %%edi\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%edi, (%%ebx)\n\t" \
-            /* Manually push eax to private stack */ \
-            "addl $-4,(%%eax)\n\t" \
-            "movl 12(%%esp), %%edi\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%edi, (%%ebx)\n\t" \
-            /* Manually push ebx to private stack */ \
-            "addl $-4,(%%eax)\n\t" \
-            "movl 8(%%esp), %%edi\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%edi, (%%ebx)\n\t" \
-            /* Manually push ecx to private stack */ \
-            "addl $-4,(%%eax)\n\t" \
-            "movl 4(%%esp), %%edi\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%edi, (%%ebx)\n\t" \
-            /* Manually push edi to private stack */ \
-            "addl $-4,(%%eax)\n\t" \
-            "movl 0(%%esp), %%edi\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%edi, (%%ebx)\n\t" \
-            /* now push regs to tls */ \
-            /* -- esp already pushed -- */ \
-            /* -- eax already pushed -- */ \
-            /* -- ebx already pushed -- */ \
-            /* -- ecx already pushed -- */ \
-            /* -- edi already pushed -- */ \
-            "addl $-4,(%%eax)\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%edx,(%%ebx)\n\t" \
-            "addl $-4,(%%eax)\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%ebp,(%%ebx)\n\t" \
-            "addl $-4,(%%eax)\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movl %%esi,(%%ebx)\n\t" \
-            /* push cs */ \
-            "addl $-2,(%%eax)\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movw %%cs, (%%ebx)\n\t" \
-            /* push ss */ \
-            "addl $-2,(%%eax)\n\t" \
-            "movl (%%eax), %%ebx\n\t" \
-            "movw %%ss, (%%ebx)\n\t" \
-            /* restore original values of regs that were used internally */ \
-            "popl %%edi\n\t" \
-            "popl %%ecx\n\t" \
-            "popl %%ebx\n\t" \
-            "popl %%eax\n\t" \
-            /* cancel push of rsp */ \
-            "addl $4,%%esp\n\t" \
-            /* cancel push of eflags */ \
-            "addl $4,%%esp\n\t" \
-            ::: "memory"); \
-       memcpy(regsptr, (void *)ust_reg_stack_ptr, sizeof(struct registers)); \
-       ust_reg_stack_ptr = (void *)(((long)ust_reg_stack_ptr) + sizeof(struct registers));
-
-#else /* CONFIG_UST_GDB_INTEGRATION */
-
-#define save_registers(a)
-
-#endif /* CONFIG_UST_GDB_INTEGRATION */
-
-#define RELATIVE_ADDRESS(__rel_label__) __rel_label__
-
-#define ARCH_COPY_ADDR(dst) "lea 2b," dst "\n\t"
-
-#define _ASM_PTR ".long "
-
 #elif defined(__x86_64)
 
-struct registers {
-       int padding; /* 4 bytes */
-       short ss;
-       short cs;
-       unsigned long r15;
-       unsigned long r14;
-       unsigned long r13;
-       unsigned long r12;
-       unsigned long r11;
-       unsigned long r10;
-       unsigned long r9;
-       unsigned long r8;
-       unsigned long rsi;
-       unsigned long rbp;
-       unsigned long rdx;
-       unsigned long rcx;
-       unsigned long rdi;
-       unsigned long rbx;
-       unsigned long rax;
-       unsigned long rflags;
-       unsigned long rsp;
-};
-
 static inline int fls(int x)
 {
         int r;
@@ -248,186 +42,8 @@ static inline int fls(int x)
         return r + 1;
 }
 
-#ifdef CONFIG_UST_GDB_INTEGRATION
-
-#define save_registers(regsptr) \
-       asm volatile ( \
-            /* save original rsp */ \
-            "pushq %%rsp\n\t" \
-            /* push original rflags */ \
-            "pushfq\n\t" \
-             /* rax will hold the ptr to the private stack bottom */ \
-            "pushq %%rax\n\t" \
-            /* rbx will be used to temporarily hold the stack bottom addr */ \
-            "pushq %%rbx\n\t" \
-            /* rdi is the input to __tls_get_addr, and also a temp var */ \
-            "pushq %%rdi\n\t" \
-            /* For TLS access, we have to do function calls. However,       \
-             * we must not lose the original value of:                      \
-             *   rsp, rflags, rax, rbx, rcx, rdx, rsi, rdi, rbp, r8, r9     \
-             *   r10, r11, r12, r13, r14, r15, cs, ss                       \
-             *                                                              \
-             * Some registers' original values have already been saved:     \
-             *   rsp, rflags, rax, rbx, rdi                                 \
-             *                                                              \
-             * In addition, the x86-64 ABI says the following registers     \
-             * belong to the caller function:                               \
-             *   rbp, rbx, r12, r13, r14, r15                               \
-             *                                                              \
-             * The following registers should not be changed by the callee: \
-             *   cs, ss                                                     \
-             *                                                              \
-             * Therefore, the following registers must be explicitly        \
-             * preserved:                                                   \
-             *   rcx, rdx, rsi, r8, r9, r10, r11                            \
-             */ \
-            "pushq %%rcx\n\t" \
-            "pushq %%rdx\n\t" \
-            "pushq %%rsi\n\t" \
-            "pushq %%r8\n\t" \
-            "pushq %%r9\n\t" \
-            "pushq %%r10\n\t" \
-            "pushq %%r11\n\t" \
-            /* Start TLS access of private reg stack pointer */ \
-            ".byte 0x66\n\t" \
-            "leaq ust_reg_stack_ptr@tlsgd(%%rip), %%rdi\n\t" \
-            ".hword 0x6666\n\t" \
-            "rex64\n\t" \
-            "call __tls_get_addr@plt\n\t" \
-            /* --- End TLS access */ \
-            /* check if ust_reg_stack_ptr has been initialized */ \
-            "movq (%%rax),%%rbx\n\t" \
-            "testq %%rbx,%%rbx\n\t" \
-            "jne 1f\n\t" \
-            "movq %%rax,%%rbx\n\t" \
-            /* Start TLS access of private reg stack */ \
-            ".byte 0x66\n\t" \
-            "leaq ust_reg_stack@tlsgd(%%rip), %%rdi\n\t" \
-            ".hword 0x6666\n\t" \
-            "rex64\n\t" \
-            "call __tls_get_addr@plt\n\t" \
-            /* --- End TLS access */ \
-            "addq $500,%%rax\n\t" \
-            "movq %%rax,(%%rbx)\n\t" \
-            "movq %%rbx,%%rax\n\t" \
-            /* now the pointer to the private stack is in rax.
-               must add stack size so the ptr points to the stack bottom. */ \
-       "1:\n\t" \
-            /* Pop regs that were pushed for function calls */ \
-            "popq %%r11\n\t" \
-            "popq %%r10\n\t" \
-            "popq %%r9\n\t" \
-            "popq %%r8\n\t" \
-            "popq %%rsi\n\t" \
-            "popq %%rdx\n\t" \
-            "popq %%rcx\n\t" \
-            /* Manually push rsp to private stack */ \
-            "addq $-8,(%%rax)\n\t" \
-            "movq 32(%%rsp), %%rdi\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rdi, (%%rbx)\n\t" \
-            /* Manually push eflags to private stack */ \
-            "addq $-8,(%%rax)\n\t" \
-            "movq 24(%%rsp), %%rdi\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rdi, (%%rbx)\n\t" \
-            /* Manually push rax to private stack */ \
-            "addq $-8,(%%rax)\n\t" \
-            "movq 16(%%rsp), %%rdi\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rdi, (%%rbx)\n\t" \
-            /* Manually push rbx to private stack */ \
-            "addq $-8,(%%rax)\n\t" \
-            "movq 8(%%rsp), %%rdi\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rdi, (%%rbx)\n\t" \
-            /* Manually push rdi to private stack */ \
-            "addq $-8,(%%rax)\n\t" \
-            "movq 0(%%rsp), %%rdi\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rdi, (%%rbx)\n\t" \
-            /* now push regs to tls */ \
-            /* -- rsp already pushed -- */ \
-            /* -- rax already pushed -- */ \
-            /* -- rbx already pushed -- */ \
-            /* -- rdi already pushed -- */ \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rcx,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rdx,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rbp,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%rsi,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%r8,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%r9,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%r10,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%r11,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%r12,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%r13,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%r14,(%%rbx)\n\t" \
-            "addq $-8,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movq %%r15,(%%rbx)\n\t" \
-            /* push cs */ \
-            "addq $-2,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movw %%cs, (%%rbx)\n\t" \
-            /* push ss */ \
-            "addq $-2,(%%rax)\n\t" \
-            "movq (%%rax), %%rbx\n\t" \
-            "movw %%ss, (%%rbx)\n\t" \
-            /* add padding for struct registers */ \
-            "addq $-4,(%%rax)\n\t" \
-            /* restore original values of regs that were used internally */ \
-            "popq %%rdi\n\t" \
-            "popq %%rbx\n\t" \
-            "popq %%rax\n\t" \
-            /* cancel push of rsp */ \
-            "addq $8,%%rsp\n\t" \
-            /* cancel push of rflags */ \
-            "addq $8,%%rsp\n\t" \
-            ::); \
-       memcpy(regsptr, (void *)ust_reg_stack_ptr, sizeof(struct registers)); \
-       ust_reg_stack_ptr = (void *)(((long)ust_reg_stack_ptr) + sizeof(struct registers));
-
-#else /* CONFIG_UST_GDB_INTEGRATION */
-
-#define save_registers(a)
-
-#endif /* CONFIG_UST_GDB_INTEGRATION */
-
-/* Macro to insert the address of a relative jump in an assembly stub,
- * in a relocatable way. On x86-64, this uses a special (%rip) notation. */
-#define RELATIVE_ADDRESS(__rel_label__) __rel_label__(%%rip)
-
-#define ARCH_COPY_ADDR(dst) "lea 2b(%%rip)," dst "\n\t"
-
-#define _ASM_PTR ".quad "
-
 #elif defined(__PPC__)
 
-struct registers {
-};
-
 static __inline__ int fls(unsigned int x)
 {
         int lz;
@@ -436,13 +52,6 @@ static __inline__ int fls(unsigned int x)
         return 32 - lz;
 }
 
-#define ARCH_COPY_ADDR(dst) \
-                    "lis " dst ",2b@h\n\t" /* load high bytes */ \
-                    "ori " dst "," dst ",2b@l\n\t" /* load low bytes */
-
-#define _ASM_PTR ".long "
-#define save_registers(a)
-
 #else /* arch-agnostic */
 
 static __inline__ int fls(unsigned int x)
@@ -476,19 +85,4 @@ static __inline__ int fls(unsigned int x)
 
 #endif
 
-#ifdef __arm__
-
-struct registers {
-};
-
-#define ARCH_COPY_ADDR(dst) "ldr "dst", =2b\n\t" \
-               "b 55f\n\t" \
-               ".ltorg\n\t" \
-               "55:\n\t"
-
-#define _ASM_PTR ".long "
-#define save_registers(a)
-
-#endif /* __arm__ */
-
 #endif /* UST_PROCESSOR_H */
index 9854c0973a88301b175ae65dd4b9861ba1974dcf..95999757df9762808dca3ad4910e2d9b033813ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Mathieu Desnoyers
+ * Copyright (C) 2007-2011 Mathieu Desnoyers
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -81,7 +81,7 @@ struct ust_marker_entry {
        char *format;
        char *name;
                        /* Probe wrapper */
-       void (*call)(const struct ust_marker *mdata, void *call_private, struct registers *regs, ...);
+       void (*call)(const struct ust_marker *mdata, void *call_private, ...);
        struct ust_marker_probe_closure single;
        struct ust_marker_probe_closure *multi;
        int refcount;   /* Number of times armed. 0 if disarmed. */
@@ -118,7 +118,7 @@ static void ust_marker_update_processes(void)
  * execution flow of preemptible code.
  */
 notrace void __ust_marker_empty_function(const struct ust_marker *mdata,
-       void *probe_private, struct registers *regs, void *call_private, const char *fmt, va_list *args)
+       void *probe_private, void *call_private, const char *fmt, va_list *args)
 {
 }
 //ust// EXPORT_SYMBOL_GPL(__ust_marker_empty_function);
@@ -134,7 +134,7 @@ notrace void __ust_marker_empty_function(const struct ust_marker *mdata,
  * rcu_dereference() for the pointer read.
  */
 notrace void ust_marker_probe_cb(const struct ust_marker *mdata,
-               void *call_private, struct registers *regs, ...)
+               void *call_private, ...)
 {
        va_list args;
        char ptype;
@@ -155,8 +155,8 @@ notrace void ust_marker_probe_cb(const struct ust_marker *mdata,
                /* Must read the ptr before private data. They are not data
                 * dependant, so we put an explicit cmm_smp_rmb() here. */
                cmm_smp_rmb();
-               va_start(args, regs);
-               func(mdata, mdata->single.probe_private, regs, call_private,
+               va_start(args, call_private);
+               func(mdata, mdata->single.probe_private, call_private,
                        mdata->format, &args);
                va_end(args);
        } else {
@@ -176,9 +176,9 @@ notrace void ust_marker_probe_cb(const struct ust_marker *mdata,
                 */
                cmm_smp_read_barrier_depends();
                for (i = 0; multi[i].func; i++) {
-                       va_start(args, regs);
+                       va_start(args, call_private);
                        multi[i].func(mdata, multi[i].probe_private,
-                               regs, call_private, mdata->format, &args);
+                               call_private, mdata->format, &args);
                        va_end(args);
                }
        }
@@ -195,7 +195,7 @@ notrace void ust_marker_probe_cb(const struct ust_marker *mdata,
  * Should be connected to ust_marker "UST_MARKER_NOARGS".
  */
 static notrace void ust_marker_probe_cb_noarg(const struct ust_marker *mdata,
-               void *call_private, struct registers *regs, ...)
+               void *call_private, ...)
 {
        va_list args;   /* not initialized */
        char ptype;
@@ -211,7 +211,7 @@ static notrace void ust_marker_probe_cb_noarg(const struct ust_marker *mdata,
                /* Must read the ptr before private data. They are not data
                 * dependant, so we put an explicit cmm_smp_rmb() here. */
                cmm_smp_rmb();
-               func(mdata, mdata->single.probe_private, regs, call_private,
+               func(mdata, mdata->single.probe_private, call_private,
                        mdata->format, &args);
        } else {
                struct ust_marker_probe_closure *multi;
@@ -230,7 +230,7 @@ static notrace void ust_marker_probe_cb_noarg(const struct ust_marker *mdata,
                 */
                cmm_smp_read_barrier_depends();
                for (i = 0; multi[i].func; i++)
-                       multi[i].func(mdata, multi[i].probe_private, regs,
+                       multi[i].func(mdata, multi[i].probe_private,
                                call_private, mdata->format, &args);
        }
 //ust//        rcu_read_unlock_sched_notrace();
index c3b7fc3d1d918e534251ee3c7f13d39175d2221c..f2c5df03b09d2513f538dfc21f633451341b41a5 100644 (file)
@@ -625,7 +625,7 @@ void ltt_write_event_data(struct ust_buffer *buf, size_t buf_offset,
 
 
 notrace void ltt_vtrace(const struct ust_marker *mdata, void *probe_data,
-                       struct registers *regs, void *call_data,
+                       void *call_data,
                        const char *fmt, va_list *args)
 {
        int largest_align, ret;
@@ -753,13 +753,13 @@ notrace void ltt_vtrace(const struct ust_marker *mdata, void *probe_data,
 }
 
 notrace void ltt_trace(const struct ust_marker *mdata, void *probe_data,
-                      struct registers *regs, void *call_data,
+                      void *call_data,
                       const char *fmt, ...)
 {
        va_list args;
 
        va_start(args, fmt);
-       ltt_vtrace(mdata, probe_data, regs, call_data, fmt, &args);
+       ltt_vtrace(mdata, probe_data, call_data, fmt, &args);
        va_end(args);
 }
 
index 1487ac73a3dd0b462798c3095fceed0f44d5a4a9..bc0a07c046d26333f36ef1b19145f79c8ba53fa8 100644 (file)
@@ -113,7 +113,10 @@ static void print_ust_marker(FILE *fp)
                        (*iter.ust_marker)->name,
                        (int)(*iter.ust_marker)->state,
                        (*iter.ust_marker)->format,
-                       (*iter.ust_marker)->location);
+                       NULL);  /*
+                                * location is null for now, will be added
+                                * to a different table.
+                                */
                ust_marker_iter_next(&iter);
        }
        unlock_ust_marker();
index 5d7d4f6181a310a9becef42752776349ff037f09..ed237e34dd89b0d10de53f9817bc74f08b16dd00 100644 (file)
@@ -103,9 +103,9 @@ struct ltt_active_ust_marker {
 
 struct ust_marker; //ust//
 extern void ltt_vtrace(const struct ust_marker *mdata, void *probe_data,
-       struct registers *regs, void *call_data, const char *fmt, va_list *args);
+       void *call_data, const char *fmt, va_list *args);
 extern void ltt_trace(const struct ust_marker *mdata, void *probe_data,
-       struct registers *regs, void *call_data, const char *fmt, ...);
+       void *call_data, const char *fmt, ...);
 
 /*
  * Unique ID assigned to each registered probe.
index 261c09c37fc531657c37d2c9fd2c6ab22ca62989..611f91f49caab4f5dfa219c321ebaa2135056b6f 100644 (file)
 
 /* This file contains functions for tracepoint custom probes support. */
 
+#define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <urcu/rculist.h>
 #include <ust/type-serializer.h>
 #include <ust/core.h>
 #include <ust/clock.h>
+#include <urcu-bp.h>
 #include "tracer.h"
 
 notrace
index 7c56a73633a319142d0d913933ae3c55a5c6d377..5164ba92f6ea932bf36d04c28b0ea84be608d292 100644 (file)
@@ -7,14 +7,14 @@ libbasic-noscript.so: basic_lib_noscript.o
        gcc -g $(LDFLAGS) -fPIC -o libbasic-noscript.so -shared basic_lib_noscript.o /usr/local/lib/libust.so.0 /usr/local/lib/libust-initializer.o
 
 basic_lib.o: basic_lib.c
-       gcc -g $(CFLAGS) -DCONFIG_UST_GDB_INTEGRATION -fPIC -c basic_lib.c
+       gcc -g $(CFLAGS) -fPIC -c basic_lib.c
 basic_lib_noscript.o: basic_lib.c
-       gcc -g -DCONFIG_UST_GDB_INTEGRATION -fPIC -o basic_lib_noscript.o -c basic_lib.c
+       gcc -g -fPIC -o basic_lib_noscript.o -c basic_lib.c
 
 prog: prog.c
-       gcc -g -DCONFIG_UST_GDB_INTEGRATION $(CFLAGS) $(LDFLAGS) -o prog -L . -lbasic -lust prog.c
+       gcc -g $(CFLAGS) $(LDFLAGS) -o prog -L . -lbasic -lust prog.c
 prog_noscript: prog.c
-       gcc -g -DCONFIG_UST_GDB_INTEGRATION -o prog_noscript -L . -lbasic-noscript prog.c /usr/local/lib/libust.so.0 /usr/local/lib/libust-initializer.o
+       gcc -g -o prog_noscript -L . -lbasic-noscript prog.c /usr/local/lib/libust.so.0 /usr/local/lib/libust-initializer.o
 
 .PHONY: clean
 clean:
This page took 0.037208 seconds and 4 git commands to generate.