|
@@ -559,7 +559,7 @@ static unw_accessors_t accessors = {
|
|
|
};
|
|
|
|
|
|
static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
|
|
|
- void *arg)
|
|
|
+ void *arg, int max_stack)
|
|
|
{
|
|
|
unw_addr_space_t addr_space;
|
|
|
unw_cursor_t c;
|
|
@@ -575,7 +575,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
|
|
|
if (ret)
|
|
|
display_error(ret);
|
|
|
|
|
|
- while (!ret && (unw_step(&c) > 0)) {
|
|
|
+ while (!ret && (unw_step(&c) > 0) && max_stack--) {
|
|
|
unw_word_t ip;
|
|
|
|
|
|
unw_get_reg(&c, UNW_REG_IP, &ip);
|
|
@@ -588,7 +588,8 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
|
|
|
|
|
|
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
|
|
|
struct machine *machine, struct thread *thread,
|
|
|
- u64 sample_uregs, struct perf_sample *data)
|
|
|
+ u64 sample_uregs, struct perf_sample *data,
|
|
|
+ int max_stack)
|
|
|
{
|
|
|
unw_word_t ip;
|
|
|
struct unwind_info ui = {
|
|
@@ -610,5 +611,5 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
|
|
|
if (ret)
|
|
|
return -ENOMEM;
|
|
|
|
|
|
- return get_entries(&ui, cb, arg);
|
|
|
+ return get_entries(&ui, cb, arg, max_stack);
|
|
|
}
|