Question on checking the stack
Bryce
philip.copeland@oracle.com
Thu Oct 13 15:58:00 GMT 2005
Frank Ch. Eigler wrote:
>Bryce <philip.copeland@oracle.com> 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
=--=
More information about the Systemtap
mailing list