]> sourceware.org Git - systemtap.git/commitdiff
Fixes for 2.6.25 pt_regs changes.
authorMartin Hunt <hunt@redhat.com>
Wed, 9 Apr 2008 21:02:40 +0000 (17:02 -0400)
committerMartin Hunt <hunt@redhat.com>
Wed, 9 Apr 2008 21:02:40 +0000 (17:02 -0400)
ChangeLog
buildrun.cxx
runtime/stack-x86_64.c
runtime/unwind/i386.h
runtime/unwind/x86_64.h

index d193233b82bf4630ceb367e06b8eabf42c775fe0..f2959b3b5f775c9e3c230ae2afac8137588b089d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-04-09  Martin Hunt  <hunt@dragon>
 
+       * buildrun.cxx (run_pass): Remove unused "-d" option
+       passed to staprun.
+
        * translate.cxx (emit_symbol_data): When available,
        grab symbols from debuginfo instead of /proc/kallsyms.
 
index f3e72272a8c1e7e5cb371b04e1dd3dd1b0d21efb..a186326fbaedcff53265ad55ee8367b4db6c413f 100644 (file)
@@ -254,8 +254,6 @@ run_pass (systemtap_session& s)
     + (s.verbose>2 ? "-v " : "")
     + (s.output_file.empty() ? "" : "-o " + s.output_file + " ");
   
-  staprun_cmd += "-d " + stringify(getpid()) + " ";
-  
   if (s.cmd != "")
     staprun_cmd += "-c " + cmdstr_quoted(s.cmd) + " ";
   
index 96f82004cd4df67d96424c9962a115bc62c8abbe..ae8e446d546ab4e9b419a6182741088ff10b17c6 100644 (file)
@@ -8,8 +8,6 @@
  * later version.
  */
 
-// todo: don't use unwinder for kernel if CONFIG_FRAME
-
 /* DWARF unwinder failed.  Just dump intereting addresses on kernel stack. */
 static void _stp_stack_print_fallback(unsigned long stack, int verbose)
 {
@@ -26,6 +24,7 @@ static void _stp_stack_print_fallback(unsigned long stack, int verbose)
 
 static void __stp_stack_print(struct pt_regs *regs, int verbose, int levels)
 {
+       // FIXME: large stack allocation
        struct unwind_frame_info info;
        arch_unw_init_frame_info(&info, regs);
 
index 354807a0154deb55a473c65ea2083448389a0479..1f69b4a922aa68ba60ae9462a2b0439ece13521e 100644 (file)
@@ -28,6 +28,35 @@ struct unwind_frame_info
        unsigned call_frame:1;
 };
 
+#define STACK_LIMIT(ptr)     (((ptr) - 1) & ~(THREAD_SIZE - 1))
+
+#ifdef STAPCONF_X86_UNIREGS
+
+#define UNW_PC(frame)        (frame)->regs.ip
+#define UNW_SP(frame)        (frame)->regs.sp
+#ifdef STP_USE_FRAME_POINTER
+#define UNW_FP(frame)        (frame)->regs.bp
+#define FRAME_RETADDR_OFFSET 4
+#define FRAME_LINK_OFFSET    0
+#define STACK_BOTTOM(tsk)    STACK_LIMIT((tsk)->thread.sp0)
+#define STACK_TOP(tsk)       ((tsk)->thread.sp0)
+#else
+#define UNW_FP(frame) ((void)(frame), 0)
+#endif
+
+#define UNW_REGISTER_INFO \
+       PTREGS_INFO(ax), \
+       PTREGS_INFO(cx), \
+       PTREGS_INFO(dx), \
+       PTREGS_INFO(bx), \
+       PTREGS_INFO(sp), \
+       PTREGS_INFO(bp), \
+       PTREGS_INFO(si), \
+       PTREGS_INFO(di), \
+       PTREGS_INFO(ip)
+
+#else /* !STAPCONF_X86_UNIREGS */
+
 #define UNW_PC(frame)        (frame)->regs.eip
 #define UNW_SP(frame)        (frame)->regs.esp
 #ifdef STP_USE_FRAME_POINTER
@@ -39,7 +68,6 @@ struct unwind_frame_info
 #else
 #define UNW_FP(frame) ((void)(frame), 0)
 #endif
-#define STACK_LIMIT(ptr)     (((ptr) - 1) & ~(THREAD_SIZE - 1))
 
 #define UNW_REGISTER_INFO \
        PTREGS_INFO(eax), \
@@ -52,6 +80,8 @@ struct unwind_frame_info
        PTREGS_INFO(edi), \
        PTREGS_INFO(eip)
 
+#endif /* STAPCONF_X86_UNIREGS */
+
 #define UNW_DEFAULT_RA(raItem, dataAlign) \
        ((raItem).where == Memory && \
         !((raItem).value * (dataAlign) + 4))
@@ -62,9 +92,16 @@ static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
        if (user_mode_vm(regs))
                info->regs = *regs;
        else {
+#ifdef STAPCONF_X86_UNIREGS
+               memcpy(&info->regs, regs, offsetof(struct pt_regs, sp));
+               info->regs.sp = (unsigned long)&regs->sp;
+               info->regs.ss = __KERNEL_DS;
+#else
                memcpy(&info->regs, regs, offsetof(struct pt_regs, esp));
                info->regs.esp = (unsigned long)&regs->esp;
-               info->regs.xss = __KERNEL_DS;
+               info->regs.xss = __KERNEL_DS;           
+#endif
+               
        }
        info->call_frame = 1;
 }
@@ -72,6 +109,15 @@ static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
 static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
 {
        memset(&info->regs, 0, sizeof(info->regs));
+#ifdef STAPCONF_X86_UNIREGS    
+       info->regs.ip = info->task->thread.ip;
+       info->regs.cs = __KERNEL_CS;
+       __get_user(info->regs.bp, (long *)info->task->thread.sp);
+       info->regs.sp = info->task->thread.sp;
+       info->regs.ss = __KERNEL_DS;
+       info->regs.ds = __USER_DS;
+       info->regs.es = __USER_DS;
+#else
        info->regs.eip = info->task->thread.eip;
        info->regs.xcs = __KERNEL_CS;
        __get_user(info->regs.ebp, (long *)info->task->thread.esp);
@@ -79,6 +125,8 @@ static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
        info->regs.xss = __KERNEL_DS;
        info->regs.xds = __USER_DS;
        info->regs.xes = __USER_DS;
+#endif
+       
 }
 
 
@@ -87,11 +135,18 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
 #if 0 /* This can only work when selector register and EFLAGS saves/restores
          are properly annotated (and tracked in UNW_REGISTER_INFO). */
        return user_mode_vm(&info->regs);
+#else
+#ifdef STAPCONF_X86_UNIREGS            
+       return info->regs.ip < PAGE_OFFSET
+              || (info->regs.ip >= __fix_to_virt(FIX_VDSO)
+                   && info->regs.ip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
+              || info->regs.sp < PAGE_OFFSET;
 #else
        return info->regs.eip < PAGE_OFFSET
               || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
                    && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
               || info->regs.esp < PAGE_OFFSET;
+#endif 
 #endif
 }
 
index 48838490fa81b96fa7d8da4f4e394733e631a26d..5eb3a58f3cfacc5f29428541716861467ac87105 100644 (file)
@@ -33,8 +33,13 @@ struct unwind_frame_info
        unsigned call_frame:1;
 };
 
+#ifdef STAPCONF_X86_UNIREGS
+#define UNW_PC(frame)        (frame)->regs.ip
+#define UNW_SP(frame)        (frame)->regs.sp
+#else
 #define UNW_PC(frame)        (frame)->regs.rip
 #define UNW_SP(frame)        (frame)->regs.rsp
+#endif /* STAPCONF_X86_UNIREGS */
 
 #if 0 /* STP_USE_FRAME_POINTER */
 /* Frame pointers not implemented in x86_64 currently */
@@ -54,6 +59,26 @@ struct unwind_frame_info
    not desirable. */
 #define STACK_LIMIT(ptr)     (((ptr) - 1) & ~(THREAD_SIZE - 1))
 
+#ifdef STAPCONF_X86_UNIREGS
+#define UNW_REGISTER_INFO \
+       PTREGS_INFO(ax), \
+       PTREGS_INFO(dx), \
+       PTREGS_INFO(cx), \
+       PTREGS_INFO(bx), \
+       PTREGS_INFO(si), \
+       PTREGS_INFO(di), \
+       PTREGS_INFO(bp), \
+       PTREGS_INFO(sp), \
+       PTREGS_INFO(r8), \
+       PTREGS_INFO(r9), \
+       PTREGS_INFO(r10), \
+       PTREGS_INFO(r11), \
+       PTREGS_INFO(r12), \
+       PTREGS_INFO(r13), \
+       PTREGS_INFO(r14), \
+       PTREGS_INFO(r15), \
+       PTREGS_INFO(ip)
+#else
 #define UNW_REGISTER_INFO \
        PTREGS_INFO(rax), \
        PTREGS_INFO(rdx), \
@@ -72,6 +97,7 @@ struct unwind_frame_info
        PTREGS_INFO(r14), \
        PTREGS_INFO(r15), \
        PTREGS_INFO(rip)
+#endif /* STAPCONF_X86_UNIREGS */
 
 #define UNW_DEFAULT_RA(raItem, dataAlign) \
        ((raItem).where == Memory && \
@@ -89,11 +115,18 @@ static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
        extern const char thread_return[];
 
        memset(&info->regs, 0, sizeof(info->regs));
-       info->regs.rip = (unsigned long)thread_return;
        info->regs.cs = __KERNEL_CS;
+       info->regs.ss = __KERNEL_DS;    
+       
+#ifdef STAPCONF_X86_UNIREGS    
+       info->regs.ip = (unsigned long)thread_return;
+       __get_user(info->regs.bp, (unsigned long *)info->task->thread.sp);
+       info->regs.sp = info->task->thread.sp;
+#else
+       info->regs.rip = (unsigned long)thread_return;
        __get_user(info->regs.rbp, (unsigned long *)info->task->thread.rsp);
        info->regs.rsp = info->task->thread.rsp;
-       info->regs.ss = __KERNEL_DS;
+#endif
 }
 
 static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
@@ -101,11 +134,17 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
 #if 0 /* This can only work when selector register saves/restores
          are properly annotated (and tracked in UNW_REGISTER_INFO). */
        return user_mode(&info->regs);
+#else
+#ifdef STAPCONF_X86_UNIREGS    
+       return (long)info->regs.ip >= 0
+              || (info->regs.ip >= VSYSCALL_START && info->regs.ip < VSYSCALL_END)
+              || (long)info->regs.sp >= 0;
 #else
        return (long)info->regs.rip >= 0
               || (info->regs.rip >= VSYSCALL_START && info->regs.rip < VSYSCALL_END)
               || (long)info->regs.rsp >= 0;
 #endif
+#endif
 }
 
 #endif /* _STP_X86_64_UNWIND_H */
This page took 0.040304 seconds and 5 git commands to generate.