Revision: 1546 Author: teawater Date: Mon May 6 07:43:38 2013 Log: Fix build error with arm http://code.google.com/p/kgtp/source/detail?r=1546 Modified: /trunk/gtp.c ======================================= --- /trunk/gtp.c Mon May 6 06:34:14 2013 +++ /trunk/gtp.c Mon May 6 07:43:38 2013 @@ -99,7 +99,9 @@ #include <linux/slab.h> #include <linux/ctype.h> #include <asm/atomic.h> +#ifdef CONFIG_X86 #include <asm/debugreg.h> +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)) #include <linux/kdebug.h> #else @@ -1804,7 +1806,9 @@ static struct gtp_var_hooks gtp_watch_val_hooks = { .agent_get_val = gtp_watch_val_get_val, }; +#endif +#ifdef GTP_RB static int gtp_step_count_hooks_get_val(struct gtp_trace_s *gts, struct gtp_var *gtv, int64_t *val) @@ -4818,6 +4822,7 @@ } #endif +#ifdef CONFIG_X86 /* while-stepping stop. */ static void @@ -4839,6 +4844,7 @@ __get_cpu_var(gtp_step).tpe = NULL; __get_cpu_var(gtp_step).irq_need_open = 0; } +#endif static void gtp_handler(struct gtp_trace_s *gts) @@ -4849,8 +4855,10 @@ printk(GTP_DEBUG_V "gtp_handler: tracepoint %d %p\n", (int)gts->tpe->num, (void *)(CORE_ADDR)gts->tpe->addr); #endif +#ifdef CONFIG_X86 if (gts->step == 0 && __get_cpu_var(gtp_step).step) gtp_step_stop(gts->regs); +#endif gts->read_memory = (void *)probe_kernel_read; if (gts->tpe->flags & GTP_ENTRY_FLAGS_CURRENT_TASK) { @@ -7625,7 +7633,9 @@ int i; struct gtp_var *var; struct list_head *cur; +#ifdef CONFIG_X86 unsigned long flags; +#endif #ifdef GTP_DEBUG printk(GTP_DEBUG "gtp_gdbrsp_qtstart\n"); @@ -8019,7 +8029,12 @@ gtp_start_last_errno = 0; for (tpe = gtp_list; tpe; tpe = tpe->next) { if ((tpe->flags & GTP_ENTRY_FLAGS_IS_KRETPROBE) - && (tpe->step || tpe->type != gtp_entry_kprobe || gtp_have_step)) { + && (tpe->step || tpe->type != gtp_entry_kprobe +#ifdef CONFIG_X86 + || gtp_have_step)) { +#else + )) { +#endifprintk(KERN_WARNING "KGTP: $kret cannot use with while-stepping or watch.\n");
gtp_gdbrsp_qtstop(); return -EINVAL; @@ -8224,14 +8239,22 @@ || gtp_have_pc_pe #endif ) { +#ifdef CONFIG_X86 if (tpe->step || gtp_have_step) { +#else + if (tpe->step) { +#endif tpe->u.kp.kpret.kp.pre_handler = gtp_kp_pre_handler_plus_step; tpe->u.kp.kpret.kp.post_handler = gtp_kp_post_handler_plus; } else tpe->u.kp.kpret.kp.pre_handler = gtp_kp_pre_handler_plus; } else { tpe->u.kp.kpret.kp.pre_handler = gtp_kp_pre_handler; +#ifdef CONFIG_X86 if (tpe->step || gtp_have_step) +#else + if (tpe->step) +#endif tpe->u.kp.kpret.kp.post_handler = gtp_kp_post_handler; } ret = register_kprobe(&tpe->u.kp.kpret.kp);