From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 730 invoked by alias); 13 Oct 2005 15:58:04 -0000 Mailing-List: contact systemtap-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sources.redhat.com Received: (qmail 699 invoked by uid 22791); 13 Oct 2005 15:58:01 -0000 Message-ID: <434E8410.30703@oracle.com> Date: Thu, 13 Oct 2005 15:58:00 -0000 From: Bryce User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 CC: systemtap@sources.redhat.com Subject: Re: Question on checking the stack References: <434E3AA0.9040407@oracle.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-SW-Source: 2005-q4/txt/msg00045.txt.bz2 Frank Ch. Eigler wrote: >Bryce writes: > > > >>Setting up a probe for a function is great and all but is there a way >>to test how we entered the routine? >>[...] >> >> > >Just about all the essentials are in there somewhere, just >not in a convenient-to-use form. > > > >>probe kernel.function("generic_make_request") { >> if (stack(1) == "submit_bio" ) { // where stack(1) was the last >>routine and stack(2) was 2nd last etc >> do_test/display >> } >>} >> >> > >The tapset/context.stp file would need two new functions such as these: > > caller:string(n:long) - returns the nth substring as if from backtrace() > addr2symbol:string(n:long) - address-to-symbol lookup, which is exactly > one stage of print_stack() > >- FChE > > *nod* Just Sebastiaens hack has the unfortunate problem of needing to know in advance what all the exit addresses from a routine and combing the stack looking for a string match is probably rather slow if it happens often enough. Cheers Phil =--=