From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14794 invoked by alias); 4 Sep 2010 07:48:16 -0000 Received: (qmail 14775 invoked by uid 22791); 4 Sep 2010 07:48:14 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_SV 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; Sat, 04 Sep 2010 07:48:07 +0000 Received: by wwb31 with SMTP id 31so802312wwb.0 for ; Sat, 04 Sep 2010 00:48:05 -0700 (PDT) Received: by 10.216.210.206 with SMTP id u56mr1600789weo.50.1283586485157; Sat, 04 Sep 2010 00:48:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.181.213 with HTTP; Sat, 4 Sep 2010 00:47:45 -0700 (PDT) In-Reply-To: References: <1283504768.2100.43.camel@steven> From: Hui Zhu Date: Sat, 04 Sep 2010 07:48:00 -0000 Message-ID: Subject: Re: Linux Kernel GDB tracepoint module 2010-8-30 release To: Steven Cc: "gdb@sourceware.org" , linux-kernel@vger.kernel.org, Michael Snyder , Marc Khouzam , Thiago Jung Bauermann , "Frank Ch. Eigler" 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-09/txt/msg00022.txt.bz2 On Sat, Sep 4, 2010 at 11:41, Hui Zhu wrote: > Hi Steven, > > On Fri, Sep 3, 2010 at 17:06, Steven wrote: >> Dear Hui, >> >> I encountered two issue when I use your GTP. >> >> 1) Following your HOWTO, I collect the two variables jiffies_64(global), >> *file(argument), the result are as following, where you may see >> jiffies_64 =3D 4298520928, that's OK, but the members of *file are all 0. >> What's the problem? Thank you very much! >> =A0 =A0 =A0 =A0---------------------------------------------------------= ---------- >> =A0 =A0 =A0 =A0(gdb) trace vfs_readdir >> =A0 =A0 =A0 =A0Tracepoint 3 at 0xc1175690: file fs/readdir.c, line 23. >> =A0 =A0 =A0 =A0(gdb) actions >> =A0 =A0 =A0 =A0Enter actions for tracepoint 3, one per line. >> =A0 =A0 =A0 =A0End with a line saying just "end". >> =A0 =A0 =A0 =A0> collect jiffies_64 >> =A0 =A0 =A0 =A0> collect *file >> =A0 =A0 =A0 =A0> end >> =A0 =A0 =A0 =A0(gdb) tstart >> =A0 =A0 =A0 =A0(gdb) tstop >> =A0 =A0 =A0 =A0(gdb) tfind >> =A0 =A0 =A0 =A0#0 =A00xc1175691 i (file=3D0x0, filler=3D0, buf=3D0x0) at >> =A0 =A0 =A0 =A0fs/readdir.c:23 >> =A0 =A0 =A0 =A023 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0(gdb) p jiffies_64 >> =A0 =A0 =A0 =A0$7 =3D 4298520928 >> =A0 =A0 =A0 =A0(gdb) p *file >> =A0 =A0 =A0 =A0$8 =3D {f_u =3D {fu_list =3D {next =3D 0x0, prev =3D 0x0}= , fu_rcuhead =3D >> =A0 =A0 =A0 =A0{next =3D 0x0, func =3D 0}}, f_path =3D {mnt =3D 0x0, den= try =3D 0x0}, >> =A0 =A0 =A0 =A0f_op =3D 0x0, f_lock =3D {{ rlock =3D {raw_lock =3D {sloc= k =3D 0}}}}, >> =A0 =A0 =A0 =A0f_count =3D {counter =3D 0}, f_flags =3D 0, f_mode =3D 0,= f_pos =3D 0, >> =A0 =A0 =A0 =A0f_owner =3D {lock =3D {raw_lock =3D { lock =3D 0}}, pid = =3D 0x0, pid_type >> =A0 =A0 =A0 =A0=3D PIDTYPE_PID, uid =3D 0, euid =3D 0, signum =3D 0}, f_= cred =3D 0x0, >> =A0 =A0 =A0 =A0f_ra =3D {stra_pages =3D 00, f_security =3D 0x0, private_= data =3D 0x0, >> =A0 =A0 =A0 =A0f_ep_links =3D {next =3D 0x0, prev =3D 0x0}, f_mapping = =3D 0x0} >> =A0 =A0 =A0 =A0---------------------------------------------------------= ---------- >> > > It looks like a old bug that I have fixed in new version. > I try it in 20100830 version cannot reproduce this issue: > (gdb) target remote /proc/gtp > Remote debugging using /proc/gtp > 0x0000000000000000 in ?? () > (gdb) trace vfs_readdir > Tracepoint 1 at 0xffffffff81147d3c: file > /home/teawater/kernel/linux-2.6/fs/readdir.c, line 24. > (gdb) actions > Enter actions for tracepoint 1, one per line. > End with a line saying just "end". >>collect jiffies_64 >>collect *file >>end > (gdb) tstart > (gdb) sh > sharedlibrary =A0shell =A0 =A0 =A0 =A0 =A0show > (gdb) shell ls > 2 =A0 =A0 =A0block =A0 =A0firmware =A0i =A0 =A0 =A0 =A0ipc =A0 =A0 Makefi= le =A0 =A0 =A0 =A0 modules.order > scripts =A0 source =A0 =A0 =A0 =A0 =A0t~ =A0 =A0vmlinux > a.out =A0crypto =A0 fs =A0 =A0 =A0 =A0include =A0kernel =A0mm =A0 =A0 =A0= =A0 =A0 =A0 =A0 Module.symvers =A0security > System.map =A0usr vmlinux.o > arch =A0 drivers =A0gdb.txt =A0 init =A0 =A0 lib =A0 =A0 modules.builtin = =A0net > sound =A0 =A0 t =A0 =A0 =A0 =A0 =A0 =A0 =A0 virt > (gdb) tstop > (gdb) tfind > Found trace frame 0, tracepoint 1 > #0 =A00xffffffff81147d3d in vfs_readdir (file=3D0xffff88007b22bcc0, > filler=3D0xffffffff81147ba0 , buf=3D0xffff88006cc31f38) > =A0 =A0at /home/teawater/kernel/linux-2.6/fs/readdir.c:24 > 24 =A0 =A0 =A0{ > (gdb) p jiffies_64 > $1 =3D 4295113995 > (gdb) p *file > $2 =3D {f_u =3D {fu_list =3D {next =3D 0xffff88007b22b480, prev =3D > 0xffffe8ffffc86960}, fu_rcuhead =3D {next =3D 0xffff88007b22b480, > =A0 =A0 =A0func =3D 0xffffe8ffffc86960}}, f_path =3D {mnt =3D 0xffff88003= 7bd6b00, > dentry =3D 0xffff88007e15b6c0}, f_op =3D 0xffffffff81622b00, f_lock =3D {{ > =A0 =A0 =A0rlock =3D {raw_lock =3D {slock =3D 0}}}}, f_sb_list_cpu =3D 1,= f_count =3D > {counter =3D 2}, f_flags =3D 624640, f_mode =3D 29, f_pos =3D 0, f_owner = =3D { > =A0 =A0lock =3D {raw_lock =3D {lock =3D 16777216}}, pid =3D 0x0, pid_type= =3D > PIDTYPE_PID, uid =3D 0, euid =3D 0, signum =3D 0}, f_cred =3D > 0xffff88007ae6f780, > =A0f_ra =3D {start =3D 0, size =3D 0, async_size =3D 0, ra_pages =3D 32, > mmap_miss =3D 0, prev_pos =3D -1}, f_version =3D 0, f_security =3D 0x0, > =A0private_data =3D 0x0, f_ep_links =3D {next =3D 0xffff88007b22bd68, pre= v =3D > 0xffff88007b22bd68}, f_mapping =3D 0xffff880036662590} > > > Could you try the new version? =A0I think it will work OK. > > If you still meet this issue, maybe you can try with the new GDB from > http://www.gnu.org/software/gdb/download/ANNOUNCEMENT > > >> >> 2) I can not collect local variable, despite I rebuild the kernel with >> -O0 optimization option. what is the problem? Many thanks >> =A0 =A0 =A0 =A0---------------------------------------------------------= ---------- >> =A0 =A0 =A0 =A0(gdb) trace fs/readdir.c:29 >> =A0 =A0 =A0 =A0Tracepoint 2 at 0xc11756ca: file fs/readdir.c, line 29. >> =A0 =A0 =A0 =A0(gdb) actions >> =A0 =A0 =A0 =A0Enter actions for tracepoint 2, one per line. >> =A0 =A0 =A0 =A0End with a line saying just "end". >> =A0 =A0 =A0 =A0> collect res >> =A0 =A0 =A0 =A0> end >> =A0 =A0 =A0 =A0(gdb) tstart >> =A0 =A0 =A0 =A0res: don't know symbol class 20 > > This error is from GDB, I think it's a GDB bug, I will try to find out > the root cause. > > BTW, looks GCC and GDB don't want handle the optimization debug > trouble (all they want is rewrite the GCC in C++ :P). > So I think make linux kernel can close optimization is better idea, do > you know some way or some patch to do it? > > > The MIPS support that you interest is check in to the KGTP truck. =A0I > just try it with a mips32el board. > To cross-compile it, you need set the CROSS_COMPILE ,KERNELDIR and > ARCH in Makefile. Forgot 1 thing, if you want remote debug the MIPS board, you can use call netcat in board for example: nc -l -p 1234 < /proc/gtp > /proc/gtp And debug with GDB command: target remote board_ip:1234 Thanks, Hui > > Thanks, > Hui > > > > > >> =A0 =A0 =A0 =A0---------------------------------------------------------= ---------- >> >> =A0 =A0 =A0 =A0Code fragment of readdir.c >> =A0 =A0 =A0 =A0---------------------------------------------------------= ---------- >> =A0 =A0 =A0 =A0 22 int vfs_readdir(struct file *file, filldir_t filler, = void >> =A0 =A0 =A0 =A0*buf) >> =A0 =A0 =A0 =A0 23 { >> =A0 =A0 =A0 =A0 24 =A0 =A0 =A0 =A0 struct inode *inode =3D file->f_path.= dentry->d_inode; >> =A0 =A0 =A0 =A0 25 =A0 =A0 =A0 =A0 int res =3D -ENOTDIR; >> =A0 =A0 =A0 =A0 26 =A0 =A0 =A0 =A0 if (!file->f_op || !file->f_op->readd= ir) >> =A0 =A0 =A0 =A0 27 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; >> =A0 =A0 =A0 =A0 28 >> =A0 =A0 =A0 =A0 29 =A0 =A0 =A0 =A0 res =3D security_file_permission(file= , MAY_READ); >> =A0 =A0 =A0 =A0 30 =A0 =A0 =A0 =A0 if (res) >> =A0 =A0 =A0 =A0 31 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; >> =A0 =A0 =A0 =A0---------------------------------------------------------= ---------- >> >> Best Regards, >> Steven >> >> >> On Mon, 2010-08-30 at 15:00 +0800, Hui Zhu wrote: >>> http://kgtp.googlecode.com/files/kgtp_20100830.tar.bz2 >>> or >>> svn co https://kgtp.googlecode.com/svn/tags/20100830 >>> to get it. >>> >>> Fix bug in ref16, ref32, ref64 in issue >>> https://code.google.com/p/kgtp/issues/detail?id=3D2 >>> Fix bug that disable some tracepoint will make "tstart" get error. >>> >>> Support qtstatus. Then KGTP support GDB command "tstatus". >>> Add support for "make install" and "make uninstall". >>> Add support for qtro. Fix a bug about GTP_GDBRSP_REG_SIZE. >>> >>> Change gtp_list make it more efficient. >>> >>> Please goto http://code.google.com/p/kgtp/wiki/HOWTO to get more info >>> about how to use KGTP. >> >> >> >