From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933366AbbI3NSf (ORCPT ); Wed, 30 Sep 2015 09:18:35 -0400 Received: from mail.kernel.org ([198.145.29.136]:53221 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755183AbbI3NSd (ORCPT ); Wed, 30 Sep 2015 09:18:33 -0400 Date: Wed, 30 Sep 2015 10:18:28 -0300 From: Arnaldo Carvalho de Melo To: =?utf-8?B?5bmz5p2+6ZuF5bezIC8gSElSQU1BVFXvvIxNQVNBTUk=?= Cc: David Ahern , Jiri Olsa , Wang Nan , Linux Kernel Mailing List Subject: Re: [perf probe] How to ask what variables can be collected at function return? Message-ID: <20150930131828.GG1944@kernel.org> References: <20150928145245.GG6022@kernel.org> <50399556C9727B4D88A595C8584AAB375256E050@GSjpTKYDCembx32.service.hitachi.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <50399556C9727B4D88A595C8584AAB375256E050@GSjpTKYDCembx32.service.hitachi.net> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Sep 30, 2015 at 08:05:09AM +0000, 平松雅巳 / HIRAMATU,MASAMI escreveu: > From: Arnaldo Carvalho de Melo [mailto:acme@kernel.org] > > > >How to figure out which variables can I collect at function return? > >None? > > At first, it seems the below pattern failed to get the probe point itself, > because you're specifying the return point of an inlined function, which > is nowhere. Would be really nice to have this warning emitted to the user, as well as bits and pieces of the following explanations. - Arnaldo > If you give a function which has actual instance, perf-probe may show > the variables which will be accessable in the entry of the function as below. > > $ sudo ./perf probe -V "vfs_read%return" > Available variables at vfs_read%return > @ > char* buf > loff_t* pos > size_t count > struct file* file > > However, this may not work on the arguments passed by registers, > since those may be already broken by the operations in the function. > > So, to get correct accessible variables at return, you must give an actual > line number in the function currently. > > $ sudo ./perf probe -L vfs_read > > 0 ssize_t vfs_read(struct file *file, char __user *buf, size_t count, lof > 1 { > ssize_t ret; > > 4 if (!(file->f_mode & FMODE_READ)) > 5 return -EBADF; > 6 if (!(file->f_mode & FMODE_CAN_READ)) > 7 return -EINVAL; > 8 if (unlikely(!access_ok(VERIFY_WRITE, buf, count))) > 9 return -EFAULT; > > 11 ret = rw_verify_area(READ, file, pos, count); > 12 if (ret >= 0) { > count = ret; > 14 ret = __vfs_read(file, buf, count, pos); > 15 if (ret > 0) { > 16 fsnotify_access(file); > 17 add_rchar(current, ret); > } > 19 inc_syscr(current); > } > > return ret; > 23 } > > $ sudo ./perf probe -V vfs_read:23 > Available variables at vfs_read:23 > @ > char* buf > loff_t* pos > size_t count > struct file* file > > > > > >I think we need a better error message :-) > > > >[root@zoo ~]# perf probe -V getname_flags%return Return probe must be on the head of a real function. > > It seems that perf probe said " Return probe must be on the head of a real function." > So this means it can not find the given probe point because the %return is not > put on the entry of the function which has actual instance. > > Thanks. > > > >Debuginfo analysis failed. > > Error: Failed to show vars. > >[root@zoo ~]# > > > > > >- Arnaldo