[fusil] [PATCH] Add -i option for displaying the instruction pointer

[ Thread Index | Date Index | More lists.tuxfamily.org/fusil Archives ]


Here's a patch to add the -i option that the regular strace supports.

A minor problem is that it doesn't work on the exit_group() syscall.

diff --git a/strace.py b/strace.py
index 9de9213..eec013e 100755
--- a/strace.py
+++ b/strace.py
@@ -62,6 +62,8 @@ class SyscallTracer(Application):
             action="store_true", default=False)
         parser.add_option("--list-syscalls", help="Display system calls and exit",
             action="store_true", default=False)
+        parser.add_option("-i", help="print instruction pointer at time of syscall",
+            action="store_true", default=False, dest="show_ip")
 
         self.createLogOptions(parser)
 
@@ -136,8 +138,10 @@ class SyscallTracer(Application):
         text = syscall.format()
         if syscall.result is not None:
             text = "%-40s = %s" % (text, syscall.result_text)
+        if self.options.show_ip:
+            text = "[%x] %s" % (syscall.process.getInstrPointer(), text)
         if self.options.show_pid:
-            text = "[%s] %s" % (syscall.process.pid, text)
+            text = "[pid %s] %s" % (syscall.process.pid, text)
         error(text)
 
     def syscallTrace(self, process):



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/