6 #include "tests/tests.h"
8 #define STACK_SIZE 8192
10 static int sample_ustack(struct perf_sample *sample,
11 struct thread *thread, u64 *regs)
13 struct stack_dump *stack = &sample->user_stack;
18 buf = malloc(STACK_SIZE);
20 pr_debug("failed to allocate sample uregs data\n");
24 sp = (unsigned long) regs[PERF_REG_X86_SP];
26 map = map_groups__find(&thread->mg, MAP__VARIABLE, (u64) sp);
28 pr_debug("failed to get stack map\n");
33 stack_size = map->end - sp;
34 stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
36 memcpy(buf, (void *) sp, stack_size);
37 stack->data = (char *) buf;
38 stack->size = stack_size;
42 int test__arch_unwind_sample(struct perf_sample *sample,
43 struct thread *thread)
45 struct regs_dump *regs = &sample->user_regs;
48 buf = malloc(sizeof(u64) * PERF_REGS_MAX);
50 pr_debug("failed to allocate sample uregs data\n");
55 regs->abi = PERF_SAMPLE_REGS_ABI;
57 regs->mask = PERF_REGS_MASK;
59 return sample_ustack(sample, thread, buf);