Question on checking the stack

Frank Ch. Eigler fche@redhat.com
Thu Oct 13 15:46:00 GMT 2005


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



More information about the Systemtap mailing list