This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Question on checking the stack
Bryce <philip.copeland@oracle.com> writes:
> [...]
> >>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
> >> }
> >>}
> >>[...]
> *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.
If one is stuck with the general approach of PC testing at the callee,
then one could micro-optimize the lookup a little more. For example,
one could return a numeric PC value for "stack(1)", like GCC's
__builtin_return_address(1). Such numbers would need to be converted
to symbol strings only once, since a yes/no judgement could be
memoized.
- FChE