Lines Matching defs:stack
3 * thread-stack.c: Synthesize a thread's stack using call / return events
22 #include "thread-stack.h"
40 * struct thread_stack_entry - thread stack entry.
68 * struct thread_stack - thread stack constructed from 'call' and 'return'
70 * @stack: array that holds the stack
71 * @cnt: number of entries in the stack
72 * @sz: current maximum stack size
83 * @br_stack_rb: branch stack (ring buffer)
84 * @br_stack_sz: maximum branch stack size
89 struct thread_stack_entry *stack;
111 * and therefore requires a stack for each cpu.
126 new_stack = realloc(ts->stack, sz);
130 ts->stack = new_stack;
201 if (!ts->stack &&
220 if (!ts->stack)
246 pr_warning("Out of memory: discarding thread stack\n");
251 ts->stack[ts->cnt].trace_end = trace_end;
252 ts->stack[ts->cnt++].ret_addr = ret_addr;
266 * further down the stack. If the return address is not found at all,
268 * seen for some reason) and leave the stack alone.
271 if (ts->stack[--i].ret_addr == ret_addr) {
283 if (ts->stack[--i].trace_end)
295 return ts->stack[ts->cnt - 1].cp->in_kernel;
311 tse = &ts->stack[idx];
355 pr_err("Error flushing thread stack!\n");
418 pr_warning("Out of memory: no thread stack\n");
427 * the stack might be completely invalid. Better to report nothing than
428 * to report something misleading, so flush the stack.
441 * stack.
459 * have flushed the stack) then try to make sense of the stack.
490 zfree(&ts->stack);
545 ip = ts->stack[ts->cnt - j].ret_addr;
586 ip = ts->stack[ts->cnt - j].ret_addr;
596 ip = ts->stack[ts->cnt - j].ret_addr;
675 * have subsequent addresses removed from the branch stack.
797 tse = &ts->stack[ts->cnt++];
823 struct thread_stack_entry *tse = &ts->stack[0];
830 if (ts->stack[ts->cnt - 1].ret_addr == ret_addr &&
831 !ts->stack[ts->cnt - 1].non_call) {
838 if (ts->stack[i].ret_addr != ret_addr ||
839 ts->stack[i].non_call)
925 /* If the stack is empty, push the userspace address */
939 parent = ts->stack[ts->cnt - 1].cp;
945 * At the bottom of the stack, assume the missing 'call' was
971 ts->stack[ts->cnt - 1].non_call = true;
1007 tse = &ts->stack[ts->cnt - 1];
1025 /* No point having 'trace end' on the bottom of the stack */
1026 if (!ts->cnt || (ts->cnt == 1 && ts->stack[0].ref == ref))
1029 cp = call_path__findnew(cpr, ts->stack[ts->cnt - 1].cp, NULL, 0,
1054 struct thread_stack_entry *tse = &ts->stack[ts->cnt - 1];
1064 * not itself mean anything. Here the top-of-stack is removed,
1065 * by decrementing the stack count, and then further down, the
1066 * resulting top-of-stack is replaced with the actual target.
1072 sym = ts->stack[ts->cnt - 2].cp->sym;
1091 cp = call_path__findnew(cpr, ts->stack[ts->cnt - 2].cp, tsym,
1096 /* Replace the top-of-stack with the actual target */
1097 ts->stack[ts->cnt - 1].cp = cp;
1129 /* Flush stack on exec */
1137 /* If the stack is empty, put the current symbol on the stack */
1162 cp = call_path__findnew(cpr, ts->stack[ts->cnt - 1].cp,
1185 /* Pop kernel stack */
1192 /* x86 retpoline 'return' doesn't match the stack */
1194 ts->stack[ts->cnt - 1].ret_addr != sample->addr)
1217 * it a jmp. Make that visible by recording on the stack a
1219 * when a ret pops the stack, all jmps must be popped off first.
1221 cp = call_path__findnew(cpr, ts->stack[ts->cnt - 1].cp,
1227 ts->stack[ts->cnt - 1].non_call = true;