Skip to content

Instantly share code, notes, and snippets.

@Duhemm
Created August 31, 2017 13:56
Show Gist options
  • Save Duhemm/6728e4171f365c1453c89d0ccecddbc2 to your computer and use it in GitHub Desktop.
Save Duhemm/6728e4171f365c1453c89d0ccecddbc2 to your computer and use it in GitHub Desktop.
#include <libunwind.h>
#include <stdio.h>
int fn5() {
unw_context_t context;
unw_cursor_t cursor;
unw_proc_info_t info;
unw_getcontext(&context);
unw_init_local(&cursor, &context);
int i = 0;
while (unw_step(&cursor) > 0) {
unw_get_proc_info(&cursor, &info);
printf("start: %llu\n", info.start_ip);
i += 1;
}
return i;
}
int fn4() {
return fn5();
}
int fn3() {
return fn4();
}
int fn2() {
return fn3();
}
int fn1() {
return fn2();
}
int main() {
return fn1();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment