This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question on checking the stack


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
=--=



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]