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__FUNCTION
, (u64
) sp
);
28 pr_debug("failed to get stack map\n");
32 stack_size
= map
->end
- sp
;
33 stack_size
= stack_size
> STACK_SIZE
? STACK_SIZE
: stack_size
;
35 memcpy(buf
, (void *) sp
, stack_size
);
36 stack
->data
= (char *) buf
;
37 stack
->size
= stack_size
;
41 int test__arch_unwind_sample(struct perf_sample
*sample
,
42 struct thread
*thread
)
44 struct regs_dump
*regs
= &sample
->user_regs
;
47 buf
= malloc(sizeof(u64
) * PERF_REGS_MAX
);
49 pr_debug("failed to allocate sample uregs data\n");
54 regs
->abi
= PERF_SAMPLE_REGS_ABI
;
56 regs
->mask
= PERF_REGS_MASK
;
58 return sample_ustack(sample
, thread
, buf
);
This page took 0.033854 seconds and 6 git commands to generate.