A quick search through perlapi led me to caller_cx. I am really not sure how to "interrogate a Perl context" structure, but perlguts seems to have some useful information in this regard. Since you're probably more familiar with the Perl-level caller function, it might just be easier to call that directly. See perlcall for help there.