From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24469 invoked by alias); 14 Jun 2006 18:04:54 -0000 Received: (qmail 24462 invoked by uid 22791); 14 Jun 2006 18:04:54 -0000 X-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 14 Jun 2006 18:04:52 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k5EI4fXV021276; Wed, 14 Jun 2006 14:04:41 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k5EI4fKb010913; Wed, 14 Jun 2006 14:04:41 -0400 Received: from vpn83-144.boston.redhat.com (vpn83-144.boston.redhat.com [172.16.83.144]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id k5EI4dra006884; Wed, 14 Jun 2006 14:04:40 -0400 Subject: Re: Matching function parameters and corresponding return value From: Martin Hunt To: Li Guanglei Cc: Sylvain Fourmanoit , systemtap@sourceware.org In-Reply-To: <448F4749.6020306@cn.ibm.com> References: <448F4749.6020306@cn.ibm.com> Content-Type: text/plain Organization: Red Hat Inc. Date: Wed, 14 Jun 2006 18:04:00 -0000 Message-Id: <1150308277.3077.3.camel@dragon> Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 (2.6.2-1.fc5.5) Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q2/txt/msg00622.txt.bz2 On Wed, 2006-06-14 at 07:16 +0800, Li Guanglei wrote: > Sylvain Fourmanoit ??: > > Hi all, > > > > I would like to watch calls to a preemptible function such as sys_open(): > > ideally, I would like to know both the tentatively accessed files and > > the success (or not) of the various calls. > > > > But I don't see how to do this: of course, I can without problem > > register a jprobe and a kretprobe on sys_open(), both how do I correlate > > pairs of probe calls reliably? Or is it just the wrong approach? > > > > Any insight on how to do this, either with SystemTap or directly with > > Kprobes would be really appreciated! > > > Although some syscalls are preemptible, but you can still correlate > the pairs of entry/return of a syscall by tid(task->pid). e.g: > TID(task->pid) Syscall > 1122 sys_open.entry > (preempted by foo()) 223 foo.entry > ... > 223 foo.return > 1122 sys_open.return > So what you can do is just to search the sys_open.return with the same > tid and skip all the calls met during the search. It sounds harder than it is. For the case of just sys_open, it is just this: --- global args probe syscall.open { args[tid()] = argstr } probe syscall.open.return { printf("%s: %s(%s) = %s\n", execname(), name, args[tid()], retstr) } --- To extend that to multiple system calls, use "name" as a key: args[name, tid()] = argstr Martin