From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2500 invoked by alias); 15 Aug 2010 06:33:33 -0000 Received: (qmail 2484 invoked by uid 22791); 15 Aug 2010 06:33:32 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,TW_EB,TW_VX,TW_XF,TW_XJ X-Spam-Check-By: sourceware.org Received: from mail-ww0-f41.google.com (HELO mail-ww0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 15 Aug 2010 06:33:26 +0000 Received: by wwb17 with SMTP id 17so1750124wwb.0 for ; Sat, 14 Aug 2010 23:33:23 -0700 (PDT) Received: by 10.216.23.78 with SMTP id u56mr1276829weu.56.1281854003229; Sat, 14 Aug 2010 23:33:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.186.205 with HTTP; Sat, 14 Aug 2010 23:33:03 -0700 (PDT) In-Reply-To: <4C642BCD.6070201@vmware.com> References: <4C6311E0.5070909@vmware.com> <4C642BCD.6070201@vmware.com> From: Hui Zhu Date: Sun, 15 Aug 2010 06:33:00 -0000 Message-ID: Subject: Re: Linux Kernel GDB tracepoint module demo release To: "gdb@sourceware.org" , "linux-kernel@vger.kernel.org" Cc: Thiago Jung Bauermann , Michael Snyder Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00090.txt.bz2 Support x86-64 now. On Fri, Aug 13, 2010 at 01:13, Michael Snyder wrote: > Very interesting then. =A0I'd like to see you continue this work. > > > Hui Zhu wrote: >> >> KGTP use Kprobes, I think it can work with most part of kernel. >> >> Thanks, >> Hui >> >> On Thu, Aug 12, 2010 at 05:10, Michael Snyder wrote: >>> >>> Actually, this is kind of interesting. >>> Can your system set a tracepoint at any arbitrary location in the >>> kernel? =A0If so, I think that makes it more powerful than existing >>> systems such as LTTng, which can only trace statically pre-determined >>> locations. >>> >>> Hui Zhu wrote: >>>> >>>> Hi, >>>> >>>> GDB Tracepoint >>>> (http://sourceware.org/gdb/current/onlinedocs/gdb/Tracepoints.html) >>>> is new feature that make GDB can debug real-time program. >>>> I think this feature is very fit for debug Linux Kernel. =A0So I make a >>>> lkm to make kernel support it. You can get it in >>>> https://code.google.com/p/kgtp/ >>>> >>>> I just release the demo for it. =A0It just support collect $reg in >>>> x86_32. =A0I will add the other tracepoint support in the future. >>>> >>>> For example: >>>> tar vxjf gtp_20100811.tar.bz2 >>>> cd gtp >>>> make >>>> insmod gtp.ko >>>> gdb ./vmlinux >>>> GNU gdb (GDB) 7.2.50.20100720-cvs >>>> Copyright (C) 2010 Free Software Foundation, Inc. >>>> License GPLv3+: GNU GPL version 3 or later >>>> >>>> This is free software: you are free to change and redistribute it. >>>> There is NO WARRANTY, to the extent permitted by law. =A0Type "show >>>> copying" >>>> and "show warranty" for details. >>>> This GDB was configured as "i686-pc-linux-gnu". >>>> For bug reporting instructions, please see: >>>> ... >>>> Reading symbols from /vmlinux...done. >>>> (gdb) target remote /proc/gtp >>>> Remote debugging using /proc/gtp >>>> 0x00000000 in ?? () >>>> (gdb) trace vfs_readdir >>>> Tracepoint 1 at 0xc01a1ac0: file >>>> /home/teawater/kernel/linux-2.6/fs/readdir.c, line 23. >>>> (gdb) actions >>>> Enter actions for tracepoint 1, one per line. >>>> End with a line saying just "end". >>>>> >>>>> collect $reg >>>>> end >>>> >>>> (gdb) tstart >>>> (gdb) shell ls >>>> (gdb) tstop >>>> (gdb) tfind >>>> Found trace frame 0, tracepoint 1 >>>> #0 =A00xc01a1ac1 in vfs_readdir (file=3D0xc5528d00, filler=3D0xc01a1900 >>>> , >>>> =A0 buf=3D0xc0d09f90) at /home/teawater/kernel/linux-2.6/fs/readdir.c:= 23 >>>> 23 =A0 =A0 =A0/home/teawater/kernel/linux-2.6/fs/readdir.c: No such fi= le or >>>> directory. >>>> =A0 =A0 =A0 in /home/teawater/kernel/linux-2.6/fs/readdir.c >>>> (gdb) info reg >>>> eax =A0 =A0 =A0 =A0 =A0 =A00xc5528d00 =A0 =A0 =A0 -984445696 >>>> ecx =A0 =A0 =A0 =A0 =A0 =A00xc0d09f90 =A0 =A0 =A0 -1060069488 >>>> edx =A0 =A0 =A0 =A0 =A0 =A00xc01a1900 =A0 =A0 =A0 -1072031488 >>>> ebx =A0 =A0 =A0 =A0 =A0 =A00xfffffff7 =A0 =A0 =A0 -9 >>>> esp =A0 =A0 =A0 =A0 =A0 =A00xc0d09f8c =A0 =A0 =A0 0xc0d09f8c >>>> ebp =A0 =A0 =A0 =A0 =A0 =A00x0 =A0 =A0 =A00x0 >>>> esi =A0 =A0 =A0 =A0 =A0 =A00x8061480 =A0 =A0 =A0 =A0134616192 >>>> edi =A0 =A0 =A0 =A0 =A0 =A00xc5528d00 =A0 =A0 =A0 -984445696 >>>> eip =A0 =A0 =A0 =A0 =A0 =A00xc01a1ac1 =A0 =A0 =A0 0xc01a1ac1 >>>> eflags =A0 =A0 =A0 =A0 0x286 =A0 =A0[ PF SF IF ] >>>> cs =A0 =A0 =A0 =A0 =A0 =A0 0x60 =A0 =A0 96 >>>> ss =A0 =A0 =A0 =A0 =A0 =A0 0x8061480 =A0 =A0 =A0 =A0134616192 >>>> ds =A0 =A0 =A0 =A0 =A0 =A0 0x7b =A0 =A0 123 >>>> es =A0 =A0 =A0 =A0 =A0 =A0 0x7b =A0 =A0 123 >>>> fs =A0 =A0 =A0 =A0 =A0 =A0 0x0 =A0 =A0 =A00 >>>> gs =A0 =A0 =A0 =A0 =A0 =A0 0x0 =A0 =A0 =A00 >>>> (gdb) tfind >>>> Found trace frame 1, tracepoint 1 >>>> 0xc01a1ac1 =A0 =A0 =A023 =A0 =A0 =A0in /home/teawater/kernel/linux-2.6= /fs/readdir.c >>>> (gdb) info reg >>>> eax =A0 =A0 =A0 =A0 =A0 =A00xc5528d00 =A0 =A0 =A0 -984445696 >>>> ecx =A0 =A0 =A0 =A0 =A0 =A00xc0d09f90 =A0 =A0 =A0 -1060069488 >>>> edx =A0 =A0 =A0 =A0 =A0 =A00xc01a1900 =A0 =A0 =A0 -1072031488 >>>> ebx =A0 =A0 =A0 =A0 =A0 =A00xfffffff7 =A0 =A0 =A0 -9 >>>> esp =A0 =A0 =A0 =A0 =A0 =A00xc0d09f8c =A0 =A0 =A0 0xc0d09f8c >>>> ebp =A0 =A0 =A0 =A0 =A0 =A00x0 =A0 =A0 =A00x0 >>>> esi =A0 =A0 =A0 =A0 =A0 =A00x8061480 =A0 =A0 =A0 =A0134616192 >>>> edi =A0 =A0 =A0 =A0 =A0 =A00xc5528d00 =A0 =A0 =A0 -984445696 >>>> eip =A0 =A0 =A0 =A0 =A0 =A00xc01a1ac1 =A0 =A0 =A0 0xc01a1ac1 >>>> eflags =A0 =A0 =A0 =A0 0x286 =A0 =A0[ PF SF IF ] >>>> cs =A0 =A0 =A0 =A0 =A0 =A0 0x60 =A0 =A0 96 >>>> ss =A0 =A0 =A0 =A0 =A0 =A0 0x8061480 =A0 =A0 =A0 =A0134616192 >>>> ds =A0 =A0 =A0 =A0 =A0 =A0 0x7b =A0 =A0 123 >>>> es =A0 =A0 =A0 =A0 =A0 =A0 0x7b =A0 =A0 123 >>>> fs =A0 =A0 =A0 =A0 =A0 =A0 0x0 =A0 =A0 =A00 >>>> gs =A0 =A0 =A0 =A0 =A0 =A0 0x0 =A0 =A0 =A00 >>>> (gdb) tfind >>>> Found trace frame 2, tracepoint 1 >>>> #0 =A00xc01a1ac1 in vfs_readdir (file=3D0xc5528300, filler=3D0xc01a19e0 >>>> , >>>> =A0 buf=3D0xc6c2df90) at /home/teawater/kernel/linux-2.6/fs/readdir.c:= 23 >>>> 23 =A0 =A0 =A0in /home/teawater/kernel/linux-2.6/fs/readdir.c >>>> (gdb) >>>> Found trace frame 3, tracepoint 1 >>>> 0xc01a1ac1 =A0 =A0 =A023 =A0 =A0 =A0in /home/teawater/kernel/linux-2.6= /fs/readdir.c >>>> (gdb) >>>> Target failed to find requested trace frame. >>>> (gdb) quit >>>> A debugging session is active. >>>> >>>> =A0 =A0 =A0 Inferior 1 [Remote target] will be killed. >>>> >>>> Quit anyway? (y or n) y >>>> >>>> Thanks, >>>> Hui >>> > >