unwind_test_main.c [plain text]
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include "libunwind.h"
extern int unwind_tester(void*);
extern void* unwind_tester_list[];
int main()
{
void** p;
for(p=unwind_tester_list; *p != NULL; ++p) {
if ( unwind_tester(*p) )
return 1;
}
return 0;
}
void uwind_to_main()
{
unw_cursor_t cursor;
unw_context_t uc;
unw_word_t offset;
unw_getcontext(&uc);
unw_init_local(&cursor, &uc);
if ( unw_step(&cursor) > 0 ) {
if ( unw_step(&cursor) > 0 ) {
unw_resume(&cursor);
}
}
exit(1);
}