/usr/share/systemtap/tapset/ucontext-symbols.stp is in systemtap-common 1.7-1+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | // 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. EXPERIMENTAL!
* @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(THIS->__retvalue, MAXSTRINGLEN, THIS->addr,
_STP_SYM_SYMBOL, current);
%}
/**
* sfunction usymdata - Return the symbol and module offset of an address. EXPERIMENTAL!
* @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(THIS->__retvalue, MAXSTRINGLEN, THIS->addr,
_STP_SYM_DATA, current);
%}
/**
* sfunction print_ustack - Print out stack for the current task from string. EXPERIMENTAL!
* @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 = THIS->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. EXPERIMENTAL!
* @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 = THIS->stk;
char *tok = strsep(&ptr, " ");
char *str = THIS->__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
THIS->__retvalue[MAXSTRINGLEN - 1] = '\0';
%}
|