This file is indexed.

/usr/share/systemtap/tapset/ucontext-unwind.stp is in systemtap-common 1.6-1ubuntu1.

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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// User context unwind 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.

%{
#ifndef STP_NEED_UNWIND_DATA
#define STP_NEED_UNWIND_DATA 1
#endif
#ifndef STP_NEED_SYMBOL_DATA
#define STP_NEED_SYMBOL_DATA 1
#endif
%}

/**
 * sfunction print_ubacktrace - Print stack back trace for current task. EXPERIMENTAL!
 *
 * Equivalent to print_ustack(ubacktrace()), except that deeper stack
 * nesting may be supported.  Returns nothing.
 *
 * Note: To get (full) backtraces for user space applications and shared
 * shared libraries not mentioned in the current script run stap with
 * -d /path/to/exe-or-so and/or add --ldd to load all needed unwind data.
 */
function print_ubacktrace () %{
/* myproc-unprivileged */ /* pragma:uprobes */ /* pragma:vma */
  /* use task_pt_regs, CONTEXT->regs might be kernel regs, or not set. */
  if (current->mm)
    {
      struct pt_regs *uregs;
      int valid;
      if (CONTEXT->regs && (CONTEXT->regflags & _STP_REGS_USER_FLAG))
	{
	  uregs = CONTEXT->regs;
	  valid = 1;
	}
      else
	{
	  uregs = task_pt_regs(current);
	  valid = _stp_task_pt_regs_valid(current, uregs);
	}

      if (uregs)
	{
	  _stp_stack_print(uregs, _STP_SYM_FULL, CONTEXT->pi, MAXTRACE,
			   current, &CONTEXT->uwcontext, CONTEXT->ri, valid);
	  return;
	}
    }

    _stp_printf("<no ubacktrace: %s>\n", CONTEXT->probe_point);
%}

/**
 * sfunction sprint_ubacktrace - Return stack back trace for current task as string. EXPERIMENTAL!
 *
 * Returns a simple backtrace for the current task. 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_ubacktrace(). Equivalent to sprint_ustack(ubacktrace()),
 * but more efficient (no need to translate between hex strings and
 * final backtrace string).
 *
 * Note: To get (full) backtraces for user space applications and shared
 * shared libraries not mentioned in the current script run stap with
 * -d /path/to/exe-or-so and/or add --ldd to load all needed unwind data.
 */
function sprint_ubacktrace:string () %{
/* pure */ /* myproc-unprivileged */ /* pragma:uprobes */ /* pragma:vma */
  /* use task_pt_regs, CONTEXT->regs might be kernel regs, or not set. */
  if (current->mm)
    {
      struct pt_regs *uregs;
      int valid;
      if (CONTEXT->regs && (CONTEXT->regflags & _STP_REGS_USER_FLAG))
	{
	  uregs = CONTEXT->regs;
	  valid = 1;
	}
      else
	{
	  uregs = task_pt_regs(current);
	  valid = _stp_task_pt_regs_valid(current, uregs);
	}

      if (uregs)
	{
	  _stp_stack_sprint (THIS->__retvalue, MAXSTRINGLEN, _STP_SYM_SIMPLE,
			     uregs, CONTEXT->pi, MAXTRACE,
			     current, &CONTEXT->uwcontext, CONTEXT->ri, valid);
	  return;
	}
    }

    strlcpy (THIS->__retvalue, "", MAXSTRINGLEN);
%}

/**
 * sfunction print_ubacktrace_brief- Print stack back trace for current task. EXPERIMENTAL!
 *
 * Equivalent to print_ubacktrace(), but output for each symbol is
 * shorter (just name and offset, or just the hex address of no symbol
 * could be found).
 *
 * Note: To get (full) backtraces for user space applications and shared
 * shared libraries not mentioned in the current script run stap with
 * -d /path/to/exe-or-so and/or add --ldd to load all needed unwind data.
 */
function print_ubacktrace_brief () %{
/* myproc-unprivileged */ /* pragma:uprobes */ /* pragma:vma */
  /* use task_pt_regs, CONTEXT->regs might be kernel regs, or not set. */
  if (current->mm)
    {
      struct pt_regs *uregs;
      int valid;
      if (CONTEXT->regs && (CONTEXT->regflags & _STP_REGS_USER_FLAG))
	{
	  uregs = CONTEXT->regs;
	  valid = 1;
	}
      else
	{
	  uregs = task_pt_regs(current);
	  valid = _stp_task_pt_regs_valid(current, uregs);
	}

      if (uregs)
	{
	  _stp_stack_print(uregs, _STP_SYM_BRIEF, CONTEXT->pi, MAXTRACE,
			   current, &CONTEXT->uwcontext, CONTEXT->ri, valid);
	  return;
	}
    }

    _stp_printf("<no ubacktrace: %s>\n", CONTEXT->probe_point);
%}

/**
 * sfunction ubacktrace - Hex backtrace of current task stack. EXPERIMENTAL!
 *
 * Return a string of hex addresses that are a backtrace of the 
 * stack of the current task.  Output may be truncated as per maximum
 * string length. Returns empty string when current probe point cannot
 * determine user backtrace.
 *
 * Note: To get (full) backtraces for user space applications and shared
 * shared libraries not mentioned in the current script run stap with
 * -d /path/to/exe-or-so and/or add --ldd to load all needed unwind data.
 */
function ubacktrace:string () %{
/* pure */ /* myproc-unprivileged */ /* pragma:uprobes */ /* pragma:vma */
  /* use task_pt_regs, CONTEXT->regs might be kernel regs, or not set. */
  if (current->mm)
    {
      struct pt_regs *uregs;
      int valid;
      if (CONTEXT->regs && (CONTEXT->regflags & _STP_REGS_USER_FLAG))
	{
	  uregs = CONTEXT->regs;
	  valid = 1;
	}
      else
	{
	  uregs = task_pt_regs(current);
	  valid = _stp_task_pt_regs_valid(current, uregs);
	}

      if (uregs)
	{
	  _stp_stack_sprint (THIS->__retvalue, MAXSTRINGLEN, _STP_SYM_NONE,
			     uregs, CONTEXT->pi, MAXTRACE,
			     current, &CONTEXT->uwcontext, CONTEXT->ri, valid);
	  return;
	}
    }

    strlcpy (THIS->__retvalue, "", MAXSTRINGLEN);
%}