This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] [PATCH] To make systemtap work on 2.6.24-rc4-mm1



I was testing Masami's kprobes patch on x86_64. I found that some changes in vfs and Roland's fix (those are present in -mm1) have made
systemtap not to work on -mm1.
===========================================
/home/systemtap/tmp/stap_testing_200712110755/install/share/systemtap/runtime/regs.c:37: error: 'struct pt_regs' has no member named 'rsp'
_stp_print_regs
/home/systemtap/tmp/stap_testing_200712110755/install/share/systemtap/runtime/regs.c: In function '_stp_print_regs':
/home/systemtap/tmp/stap_testing_200712110755/install/share/systemtap/runtime/regs.c:87: error: 'struct pt_regs' has no member named 'rip'
/home/systemtap/tmp/stap_testing_200712110755/install/share/systemtap/runtime/regs.c:87: error: 'struct pt_regs' has no member named 'rsp'
==========================================


I have developed the patch, which fixes this issue. Since Roland's and
vfs patches may get pulled to rc tree from mm, this patch might be helpful
to people.


Please let me know your comments on this patch.


=======================================================

Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>

diff -Naurp src-orig/runtime/loc2c-runtime.h src/runtime/loc2c-runtime.h
--- src-orig/runtime/loc2c-runtime.h    2007-10-03 02:03:22.000000000 +0530
+++ src/runtime/loc2c-runtime.h 2007-12-11 13:44:55.000000000 +0530
@@ -104,14 +104,14 @@

#elif defined __x86_64__

-#define dwarf_register_0(regs) regs->rax
-#define dwarf_register_1(regs) regs->rdx
-#define dwarf_register_2(regs) regs->rcx
-#define dwarf_register_3(regs) regs->rbx
-#define dwarf_register_4(regs) regs->rsi
-#define dwarf_register_5(regs) regs->rdi
-#define dwarf_register_6(regs) regs->rbp
-#define dwarf_register_7(regs) regs->rsp
+#define dwarf_register_0(regs) regs->ax
+#define dwarf_register_1(regs) regs->dx
+#define dwarf_register_2(regs) regs->cx
+#define dwarf_register_3(regs) regs->bx
+#define dwarf_register_4(regs) regs->si
+#define dwarf_register_5(regs) regs->di
+#define dwarf_register_6(regs) regs->bp
+#define dwarf_register_7(regs) regs->sp
#define dwarf_register_8(regs) regs->r8
#define dwarf_register_9(regs) regs->r9
#define dwarf_register_10(regs)        regs->r10
diff -Naurp src-orig/runtime/procfs.c src/runtime/procfs.c
--- src-orig/runtime/procfs.c   2007-09-19 18:34:57.000000000 +0530
+++ src/runtime/procfs.c        2007-12-11 14:19:59.000000000 +0530
@@ -87,8 +87,8 @@ int _stp_mkdir_proc_module(void)
                               goto done;
                       }
               } else {
-                       _stp_proc_stap = PDE(nd.dentry->d_inode);
-                       path_release (&nd);
+                       _stp_proc_stap = PDE(nd.path.dentry->d_inode);
+                       path_put (&nd.path);
               }

               _stp_proc_root = proc_mkdir(THIS_MODULE->name, _stp_proc_stap);
diff -Naurp src-orig/runtime/regs.c src/runtime/regs.c
--- src-orig/runtime/regs.c     2007-07-04 22:35:00.000000000 +0530
+++ src/runtime/regs.c  2007-12-11 13:44:11.000000000 +0530
@@ -34,7 +34,7 @@
unsigned long _stp_ret_addr (struct pt_regs *regs)
{
#ifdef __x86_64__
-       unsigned long *ra = (unsigned long *)regs->rsp;
+       unsigned long *ra = (unsigned long *)regs->sp;
       if (ra)
               return *ra;
       else
@@ -84,13 +84,13 @@ void _stp_print_regs(struct pt_regs * re
        unsigned int fsindex,gsindex;
        unsigned int ds,cs,es;

-        _stp_printf("RIP: %016lx\nRSP: %016lx  EFLAGS: %08lx\n", regs->rip, regs->rsp, regs->eflags);
+        _stp_printf("RIP: %016lx\nRSP: %016lx  EFLAGS: %08lx\n", regs->ip, regs->sp, regs->flags);
        _stp_printf("RAX: %016lx RBX: %016lx RCX: %016lx\n",
-               regs->rax, regs->rbx, regs->rcx);
+               regs->ax, regs->bx, regs->cx);
        _stp_printf("RDX: %016lx RSI: %016lx RDI: %016lx\n",
-               regs->rdx, regs->rsi, regs->rdi);
+               regs->dx, regs->si, regs->di);
        _stp_printf("RBP: %016lx R08: %016lx R09: %016lx\n",
-               regs->rbp, regs->r8, regs->r9);
+               regs->bp, regs->r8, regs->r9);
        _stp_printf("R10: %016lx R11: %016lx R12: %016lx\n",
               regs->r10, regs->r11, regs->r12);
        _stp_printf("R13: %016lx R14: %016lx R15: %016lx\n",
diff -Naurp src-orig/runtime/regs.h src/runtime/regs.h
--- src-orig/runtime/regs.h     2007-05-30 20:03:55.000000000 +0530
+++ src/runtime/regs.h  2007-12-11 13:51:04.000000000 +0530
@@ -14,8 +14,8 @@

#ifdef __x86_64__

-#define REG_IP(regs) regs->rip
-#define REG_SP(regs) regs->rsp
+#define REG_IP(regs) regs->ip
+#define REG_SP(regs) regs->sp

#elif defined (__i386__)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]