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(®s)
-
#define DEFINE_MARKER(channel, name, format) \
_DEFINE_MARKER(channel, name, NULL, NULL, format)
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;
};
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"))); \
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 */
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;
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 */
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 */ \
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)
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;
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();
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;
}