[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] using libunwind in signal handler for mult-thread prog
From: |
hzhang86 |
Subject: |
[Libunwind-devel] using libunwind in signal handler for mult-thread program |
Date: |
Mon, 29 Feb 2016 18:10:33 -0500 |
User-agent: |
SquirrelMail/1.4.22-4.el6 |
Hello, everyone
Did anyone have success in using libunwind in signal handler for
multi-threads program ? I found the doc says local-unwinding is
thread-safe and signal-safe, but I'm still having issues with it..
In my program, a handler is called once every certain amount of CPU
cycles(use PAPI_overflow). And the program is multi-threading. So In the
handler, I did this:
unw_cursor_t cursor;
unw_word_t ip, sp;
unw_context_t uc;
int count=0;
unw_getcontext (&uc);
if (unw_init_local (&cursor, &uc) < 0)
fprintf (stderr,"unw_init_local failed!\n");
while (unw_step(&cursor)>0) {
unw_get_reg (&cursor, UNW_REG_IP, &ip);
unw_get_reg (&cursor, UNW_REG_SP, &sp);
printf("%d 0x%lx\n", count, (unsigned long) ip);
count++;
}
This works fine for single-thread programs, and also works for small
muli-thread program, but when I tested lulesh multi-theading program, the
hanlder would go into a infinite loop, it looks like the handler was kept
invoked infinitely...Am I using libunwind right ? what should be
specifically done for multi-threads ?
Thank you !
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Libunwind-devel] using libunwind in signal handler for mult-thread program,
hzhang86 <=