Fix dump_my_stack to handle cleanly end of unwind

This commit is contained in:
Théophile Bastian 2018-04-12 13:23:39 +02:00
parent f25093ffce
commit 0dd3ca94ce
1 changed files with 7 additions and 2 deletions

View File

@ -28,7 +28,11 @@ void dump_my_stack() {
(dl_rc && dl_inf.dli_sname) ? dl_inf.dli_sname : "(no symbol)",
cur_map_entry.pathname.c_str());
fflush(stdout);
unw_context = dw.unwind_context(unw_context);
try {
unw_context = dw.unwind_context(unw_context);
} catch(const DwarfInterpret::FirstUnwindFrame& exn) {
return;
}
}
}
@ -36,7 +40,8 @@ void fill_my_stack(int stack_depth) {
if(stack_depth == 0)
dump_my_stack();
fill_my_stack(stack_depth - 1);
else
fill_my_stack(stack_depth - 1);
}
int main(int argc, char** argv) {