|
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 : |
// User context symbols tapset
// Copyright (C) 2009-2011 Red Hat Inc.
//
// 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>
// User context symbol functions provide additional information about
// addresses from an application. These functions can provide
// information about the user space map (library) that the event occurred or
// the function symbol of an address.
// </tapsetdescription>
/**
* sfunction usymname - Return the symbol of an address in the current task.
* @addr: The address to translate.
*
* Description: Returns the (function) symbol name associated with the
* given address if known. If not known it will return the hex string
* representation of addr.
*/
function usymname:string (addr: long) %{
/* pure */ /* myproc-unprivileged */ /* pragma:vma */ /* pragma:symbols */
_stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
_STP_SYM_SYMBOL, current);
%}
/**
* sfunction usymdata - Return the symbol and module offset of an address.
* @addr: The address to translate.
*
* Description: Returns the (function) symbol name associated with the
* given address in the current task if known, the offset from the
* start and the size of the symbol, plus the module name (between
* brackets). If symbol is unknown, but module is known, the offset
* inside the module, plus the size of the module is added. If any
* element is not known it will be omitted and if the symbol name is
* unknown it will return the hex string for the given address.
*/
function usymdata:string (addr: long) %{
/* pure */ /* myproc-unprivileged */ /* pragma:vma */ /* pragma:symbols */
_stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
_STP_SYM_DATA, current);
%}
/**
* sfunction print_ustack - Print out stack for the current task from string.
* @stk: String with list of hexadecimal addresses for the current task.
*
* Perform a symbolic lookup of the addresses in the given string,
* which is assumed to be the result of a prior call to
* ubacktrace() for the current task.
*
* Print one line per address, including the address, the
* name of the function containing the address, and an estimate of
* its position within that function. Return nothing.
*/
function print_ustack(stk:string) %{
/* myproc-unprivileged */ /* pragma:vma */ /* pragma:symbols */
char *ptr = STAP_ARG_stk;
char *tok = strsep(&ptr, " ");
while (tok && *tok) {
_stp_print_addr(simple_strtol(tok, NULL, 16),
_STP_SYM_FULL, current);
tok = strsep(&ptr, " ");
}
%}
/**
* sfunction sprint_ustack - Return stack for the current task from string.
* @stk: String with list of hexadecimal addresses for the current task.
*
* Perform a symbolic lookup of the addresses in the given string,
* which is assumed to be the result of a prior call to
* ubacktrace() for the current task.
*
* Returns a simple backtrace from the given hex string. One line per
* address. Includes the symbol name (or hex address if symbol
* couldn't be resolved) and module name (if found). Includes the
* offset from the start of the function if found, otherwise the
* offset will be added to the module (if found, between
* brackets). Returns the backtrace as string (each line terminated by
* a newline character). Note that the returned stack will be
* truncated to MAXSTRINGLEN, to print fuller and richer stacks use
* print_ustack.
*/
function sprint_ustack:string(stk:string) %{ /* pure */ /* pragma:symbols */
char *ptr = STAP_ARG_stk;
char *tok = strsep(&ptr, " ");
char *str = STAP_RETVALUE;
size_t len = MAXSTRINGLEN - 1;
while (tok && *tok && len > 0) {
int s = _stp_snprint_addr(str, len,
simple_strtol(tok, NULL, 16),
_STP_SYM_SIMPLE, current);
len -= s;
str += s;
tok = strsep(&ptr, " ");
}
str--;
if (len > 0)
str[0] = '\0';
else
STAP_RETVALUE[MAXSTRINGLEN - 1] = '\0';
%}