fix 32 bit support by conditionally compiling gdb support
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Mon, 7 Dec 2009 20:54:40 +0000 (15:54 -0500)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Mon, 7 Dec 2009 20:54:40 +0000 (15:54 -0500)
must define CONFIG_UST_GDB_INTEGRATION for gdb support to be enabled

include/ust/marker.h
include/ust/processor.h
libust/marker.c

index 2d995e9f25ed69fe2388e347e88238597460a9ce..79b861cb0a2a1633ff7711f77b1b99ff91af7989 100644 (file)
@@ -94,15 +94,10 @@ struct marker {
                  0, 0, 0, 0, marker_probe_cb,                          \
                  { __mark_empty_function, NULL},                       \
                  NULL, tp_name_str, tp_cb, NULL };                     \
-               asm (".section __marker_addr,\"aw\",@progbits\n\t"      \
-                      _ASM_PTR "%c[marker_struct], (1f)\n\t"           \
-                      ".previous\n\t"                                  \
-                      "1:\n\t"                                         \
-                       :: [marker_struct] "i" (&__mark_##channel##_##name));\
+               save_ip();                                              \
                save_registers(&regs)
 
 
-
 #define DEFINE_MARKER(channel, name, format)                           \
                _DEFINE_MARKER(channel, name, NULL, NULL, format)
 
@@ -304,7 +299,9 @@ struct marker_addr {
 
 struct lib {
        struct marker *markers_start;
+#ifdef CONFIG_UST_GDB_INTEGRATION
        struct marker_addr *markers_addr_start;
+#endif
        int markers_count;
        struct list_head list;
 };
@@ -313,6 +310,8 @@ extern int marker_register_lib(struct marker *markers_start,
                               struct marker_addr *marker_addr_start,
                               int markers_count);
 
+#ifdef CONFIG_UST_GDB_INTEGRATION
+
 #define MARKER_LIB                                                     \
        extern struct marker __start___markers[] __attribute__((weak, visibility("hidden"))); \
        extern struct marker __stop___markers[] __attribute__((weak, visibility("hidden"))); \
@@ -327,4 +326,20 @@ extern int marker_register_lib(struct marker *markers_start,
 extern void marker_set_new_marker_cb(void (*cb)(struct marker *));
 extern void init_markers(void);
 
-#endif
+#else /* CONFIG_UST_GDB_INTEGRATION */
+
+#define MARKER_LIB                                                     \
+       extern struct marker __start___markers[] __attribute__((weak, visibility("hidden"))); \
+       extern struct marker __stop___markers[] __attribute__((weak, visibility("hidden"))); \
+                                                                       \
+       static void __attribute__((constructor)) __markers__init(void)  \
+       {                                                               \
+               marker_register_lib(__start___markers, NULL, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker)); \
+       }
+
+extern void marker_set_new_marker_cb(void (*cb)(struct marker *));
+extern void init_markers(void);
+
+#endif /* CONFIG_UST_GDB_INTEGRATION */
+
+#endif /* _UST_MARKER_H */
index 6caae6e7a7a5d4e338524f69eb7dc78ca34bdc08..2ee7efa68c15dfa470cffe802536200a9ba31174 100644 (file)
@@ -7,9 +7,14 @@
 extern __thread long ust_reg_stack[500];
 extern volatile __thread long *ust_reg_stack_ptr;
 
+#ifndef CONFIG_UST_GDB_INTEGRATION
+static inline save_ip(void)
+{
+}
+#endif
+
 
-#ifdef x86_32
-#error "32-bit support broken"
+#ifndef x86_64
 
 struct registers {
        long eax;
@@ -30,15 +35,25 @@ struct registers {
        int  xss;
 };
 
-static inline save_registers(struct registers *regs)
-{
-}
+#ifdef CONFIG_UST_GDB_ITEGRATION
+
+#error "GDB integration not supported for x86-32 yet."
+
+#define save_ip()
+#define save_registers(a)
+
+#else /* CONFIG_UST_GDB_ITEGRATION */
+
+#define save_ip()
+#define save_registers(a)
+
+#endif /* CONFIG_UST_GDB_ITEGRATION */
 
 #define RELATIVE_ADDRESS(__rel_label__) __rel_label__
 
 #define _ASM_PTR ".long "
 
-#else
+#else /* below is code for x86-64 */
 
 struct registers {
        int padding; /* 4 bytes */
@@ -63,6 +78,14 @@ struct registers {
        unsigned long rsp;
 };
 
+#ifdef CONFIG_UST_GDB_ITEGRATION
+#define save_ip() \
+       asm (".section __marker_addr,\"aw\",@progbits\n\t"      \
+              _ASM_PTR "%c[marker_struct], (1f)\n\t"           \
+              ".previous\n\t"                                  \
+              "1:\n\t"                                         \
+               :: [marker_struct] "i" (&__mark_##channel##_##name));\
+
 #define save_registers(regsptr) \
        asm volatile ( \
             /* save original rsp */ \
@@ -188,6 +211,8 @@ struct registers {
        memcpy(regsptr, (void *)ust_reg_stack_ptr, sizeof(struct registers)); \
        ust_reg_stack_ptr = (void *)(((long)ust_reg_stack_ptr) + sizeof(struct registers));
 
+#endif /* CONFIG_UST_GDB_ITEGRATION */
+
 /* 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)
index 47b6d11fc0c65f29873c951049d33a4ddbf7ccd9..da16e4f681dcf1e025f685a0be7c8c0925ddd941 100644 (file)
@@ -46,8 +46,11 @@ volatile __thread long *ust_reg_stack_ptr = (long *) 0;
 
 extern struct marker __start___markers[] __attribute__((visibility("hidden")));
 extern struct marker __stop___markers[] __attribute__((visibility("hidden")));
+
+#ifdef CONFIG_UST_GDB_INTEGRATION
 extern struct marker_addr __start___marker_addr[] __attribute__((visibility("hidden")));
 extern struct marker_addr __stop___marker_addr[] __attribute__((visibility("hidden")));
+#endif
 
 /* Set to 1 to enable marker debug output */
 static const int marker_debug;
@@ -1509,7 +1512,9 @@ int marker_register_lib(struct marker *markers_start, struct marker_addr *marker
        pl = (struct lib *) malloc(sizeof(struct lib));
 
        pl->markers_start = markers_start;
+#ifdef CONFIG_UST_GDB_INTEGRATION
        pl->markers_addr_start = marker_addr_start;
+#endif
        pl->markers_count = markers_count;
 
        lock_markers();
@@ -1545,7 +1550,11 @@ static int initialized = 0;
 void __attribute__((constructor)) init_markers(void)
 {
        if(!initialized) {
+#ifdef CONFIG_UST_GDB_INTEGRATION
                marker_register_lib(__start___markers, __start___marker_addr, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));
+#else
+               marker_register_lib(__start___markers, NULL, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));
+#endif
                //DBG("markers_start: %p, markers_stop: %p\n", __start___markers, __stop___markers);
                initialized = 1;
        }
This page took 0.027939 seconds and 4 git commands to generate.