From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13686 invoked by alias); 18 Dec 2006 14:01:58 -0000 Received: (qmail 13670 invoked by uid 22791); 18 Dec 2006 14:01:56 -0000 X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,FORGED_RCVD_HELO,TW_VZ,TW_ZB,TW_ZW X-Spam-Check-By: sourceware.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (83.160.170.119) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 18 Dec 2006 14:01:40 +0000 Received: from dijkstra.wildebeest.org ([192.168.1.29]) by gnu.wildebeest.org with esmtp (Exim 3.36 #1 (Debian)) id 1GwJ3e-00022l-00 for ; Mon, 18 Dec 2006 15:01:34 +0100 Subject: fstep added From: Mark Wielaard To: frysk@sourceware.org Content-Type: text/plain Date: Mon, 18 Dec 2006 14:01:00 -0000 Message-Id: <1166450488.3022.19.camel@dijkstra.wildebeest.org> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2006-q4/txt/msg00280.txt.bz2 Hi, I finally added my little fstep program. It is certainly not complete, and I am not sure it is a much use as is now since it makes programs really, really slow. But it is a nice start for the future. You can use it as follows: $ frysk/bindir/fstep -i 5 -s 15000 /bin/echo Which means, execute /bin/echo, print 5 instructions, every 15000 steps. And gives the following output: [30788] 0x3375dff160 add $0x18,%rcx [30788] 0x3375dff164 cmp %rcx,%rsi [30788] 0x3375dff167 jbe 0x3375dff1d8 [30788] 0x3375dff169 movzbl 0x4(%rcx),%edx [30788] 0x3375dff16d mov %edx,%eax [30788] 0x3375dff17e cmp $0x6,%eax [30788] 0x3375dff181 je 0x3375dff160 [30788] 0x3375dff183 movzwl 0x6(%rcx),%edx [30788] 0x3375dff187 test %dx,%dx [30788] 0x3375dff18a jne 0x3375dff193 [30788] 0x3375dff169 movzbl 0x4(%rcx),%edx [30788] 0x3375dff16d mov %edx,%eax [30788] 0x3375dff16f shr $0x4,%al [30788] 0x3375dff172 sub $0x1,%eax [30788] 0x3375dff175 cmp $0x1,%al [30788] 0x3375d271d5 add 0xfffffffffffffee8(%rbp),%rax [30788] 0x3375d271dc add $0x1,%edi [30788] 0x3375d271df shl $0x4,%rdx [30788] 0x3375d271e3 mov %esi,%esi [30788] 0x3375d271e5 cmp $0xc,%edi [30788] 0x3375d73f8b sub $0x1,%rdx [30788] 0x3375d73f8f je 0x3375d73f20 [30788] 0x3375d73f91 movzbl 0x1(%r8,%rdi,1),%eax [30788] 0x3375d73f97 movzbl 0x1(%r8,%rsi,1),%ecx [30788] 0x3375d73f9d add $0x1,%r8 Total steps [30788]: 86545 You can also attach it to a running process with --pid. The following things can/should be improved: - It is currently build right on top of the Instruction TaskObserver. It might be better to build it on top of the new rt framework. The rt framework can probably also handle stepping over locking sequences like on ppc (lwarx/stwcx). - It only steps the main task. Plumbing is in place to track other Tasks, but nothing is connected to that yet. - Maybe merge it completely with ftrace? - It is partially so slow because it accesses the Task memory for every disassambly. Maybe that can be cached? Although instruction stepping is just slow in general. An alternative could be combining stepping with breakpoints set on "interesting functions". Or only stepping while in the main program map, and not in any of the shared library maps? - It could give the name of the memory map the PC is currently in. - It could even give the source/line-number if available. Note that I have marked the original tracker bug as suspended. http://sourceware.org/bugzilla/show_bug.cgi?id=3364 If any of the above is useful they should probably be raised as bugs and depend on #3364. Cheers, Mark