|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21573/root/usr/share/systemtap/tapset/ |
Upload File : |
// context-caller tapset
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
// <tapsetdescription>
// Provides caller and caller_addr function for context for kernel and user
// space.
// </tapsetdescription>
%{
/* caller_addr() might be user caller, so needs at least uprobes structs. */
#include "uprobes-inc.h"
%}
/**
* sfunction caller - Return name and address of calling function
*
* Description: This function returns the address and name of the
* calling function. This is equivalent to calling:
* sprintf("%s 0x%x", symname(caller_addr(), caller_addr()))
* Works only for return probes at this time.
*/
function caller:string() {
return sprintf("%s 0x%x", symname(caller_addr()), caller_addr());
}
/**
* sfunction caller_addr - Return caller address
*
* Description: This function returns the address of the calling function.
* Works only for return probes at this time.
*/
function caller_addr:long () %{ /* pure */
if (CONTEXT->probe_type == _STP_PROBE_HANDLER_KRETPROBE)
STAP_RETVALUE = (int64_t)(long)_stp_ret_addr_r(CONTEXT->ips.krp.pi);
#ifdef STAPCONF_UPROBE_GET_PC
else if (CONTEXT->probe_type == _STP_PROBE_HANDLER_URETPROBE)
STAP_RETVALUE = (int64_t)(long)_stp_ret_addr_r(CONTEXT->ips.ri);
#endif
else
STAP_RETVALUE = 0;
%}