Debian Codegraph @

tapset/linux/context-unwind.stp

raw
1 // context-unwind tapset
2 // Copyright (C) 2005-2019 Red Hat Inc.
3 // Copyright (C) 2006 Intel Corporation.
4 //
5 // This file is part of systemtap, and is free software. You can
6 // redistribute it and/or modify it under the terms of the GNU General
7 // Public License (GPL); either version 2, or (at your option) any
8 // later version.
9 // <tapsetdescription>
10 // Context functions provide additional information about where an event occurred. These functions can
11 //provide information such as a backtrace to where the event occurred and the current register values for the
12 //processor.
13 // </tapsetdescription>
14
15 /**
16 * sfunction print_backtrace - Print kernel stack back trace
17 *
18 * Description: This function is equivalent to print_stack(backtrace()),
19 * except that deeper stack nesting may be supported. See print_ubacktrace
20 * for user-space backtrace.
21 * The function does not return a value.
22 */
23 function print_backtrace () %{
24 /* pragma:unwind */ /* pragma:symbols */
25 _stp_stack_kernel_print(CONTEXT, _STP_SYM_FULL);
26 %}
27
28 /**
29 * sfunction print_backtrace_fileline - Print kernel stack back trace
30 *
31 * Description: This function is equivalent to print_backtrace(), but output
32 * for each symbol is longer including file names and line numbers.
33 * The function does not return a value.
34 */
35 function print_backtrace_fileline () %{
36 /* pragma:unwind */ /* pragma:symbols */ /* pargma:lines */
37 _stp_stack_kernel_print(CONTEXT, _STP_SYM_FULLER);
38 %}
39
40 /**
41 * sfunction sprint_backtrace - Return stack back trace as string
42 *
43 * Returns a simple (kernel) backtrace. One line per address.
44 * Includes the symbol name (or hex address if symbol
45 * couldn't be resolved) and module name (if found). Includes the
46 * offset from the start of the function if found, otherwise the
47 * offset will be added to the module (if found, between
48 * brackets). Returns the backtrace as string (each line terminated by
49 * a newline character). Note that the returned stack will be
50 * truncated to MAXSTRINGLEN, to print fuller and richer stacks use
51 * print_backtrace(). Equivalent to sprint_stack(backtrace()),
52 * but more efficient (no need to translate between hex strings and
53 * final backtrace string).
54 */
55 function sprint_backtrace:string () %{
56 /* pure */ /* pragma:unwind */ /* pragma:symbols */
57 _stp_stack_kernel_sprint (STAP_RETVALUE, MAXSTRINGLEN,
58 CONTEXT, _STP_SYM_SIMPLE);
59 %}
60
61 /**
62 * sfunction backtrace - Hex backtrace of current kernel stack
63 *
64 * Description: This function returns a string of hex addresses
65 * that are a backtrace of the kernel stack. Output may be truncated
66 * as per maximum string length (MAXSTRINGLEN). See
67 * ubacktrace() for user-space backtrace.
68 */
69 function backtrace:string () %{ /* pure */ /* pragma:unwind */
70 _stp_stack_kernel_sprint (STAP_RETVALUE, MAXSTRINGLEN,
71 CONTEXT, _STP_SYM_NONE);
72 %}
73
74 %( systemtap_v <= "1.6" %?
75 /**
76 * sfunction task_backtrace - Hex backtrace of an arbitrary task
77 * @task: pointer to task_struct
78 *
79 * Description: This function returns a string of hex addresses
80 * that are a backtrace of the stack of a particular task
81 * Output may be truncated as per maximum string length.
82 * Deprecated in SystemTap 1.6.
83 */
84 function task_backtrace:string (task:long) {
85 warn("task_backtrace unsupported")
86 }
87 %)