On Fri, Sep 25, 2009 at 12:00 PM, Mark Rabkin <[email protected]> wrote:
> I read this: > http://lists.nongnu.org/archive/html/libunwind-devel/2009-09/msg00000.html > > But I was a little unclear on the main motivation. > > Was the motivation that the existing signal blocking mechanism didn't > prevent re-entry? If it didn't prevent it, did it cause crashes or aborted > stack traces or what was the symptom? Existing mechanism did prevent re-entry, but at a cost of lots of sigprocmask()s. We have one particular (emulated) environment, where these are quite costly. > If you're now planning to block additional signals in your own client code > ("at the top level"), We don't actually need to block them, we just need to make sure that the same thread doesn't reenter libunwind from a signal handler.... > are you removing the calls inside libunwind to ensure > it doesn't unblock them (as it does SETMASK), The remaining sigprocmask calls are following this pattern: sigprocmask (SIG_SETMASK, &unwi_full_mask, &saved_mask); ret = dl_iterate_phdr (check_callback, as); sigprocmask (SIG_SETMASK, &saved_mask, NULL); so (AFAICT) they wouldn't unblock anything that was blocked before. But I see now that I should have eliminated these remaining sigprocmasks as well. Patch attached. > or are you just removing them > for performance since they're unnecessary as your initial message implies? Yes. > Finally, I just wanted to get a clarification on the effects of linking > libunwind -- it was my impression that linking it may also affect the stack > unwinding done when, for instance, a C++ exception is thrown. Not by default. In default configuration on x86_64, I get: nm -D src/.libs/libunwind.so | grep ' T ' | grep -v ' _U' 0000000000001380 T backtrace So only calls to (glibc) backtrace would be affected. Cheers, -- Paul Pluzhnikov
commit 075d048a156b4bd5e0e7e85ad7b6b6248729e2b0 Author: Paul Pluzhnikov <[email protected]> Date: Fri Sep 25 13:07:30 2009 -0700 Make the remaining sigprocmask calls conditional on --enable-block-signals. diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c index e3ec9ad..01d91f6 100644 --- a/src/dwarf/Gfind_proc_info-lsb.c +++ b/src/dwarf/Gfind_proc_info-lsb.c @@ -728,9 +728,9 @@ dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, cb_data.di.format = -1; cb_data.di_debug.format = -1; - sigprocmask (SIG_SETMASK, &unwi_full_mask, &saved_mask); + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); ret = dl_iterate_phdr (callback, &cb_data); - sigprocmask (SIG_SETMASK, &saved_mask, NULL); + SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); if (ret <= 0) { diff --git a/src/ia64/Gtables.c b/src/ia64/Gtables.c index 63725e8..1a16a2e 100644 --- a/src/ia64/Gtables.c +++ b/src/ia64/Gtables.c @@ -622,9 +622,9 @@ validate_cache (unw_addr_space_t as) intrmask_t saved_mask; int ret; - sigprocmask (SIG_SETMASK, &unwi_full_mask, &saved_mask); + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); ret = dl_iterate_phdr (check_callback, as); - sigprocmask (SIG_SETMASK, &saved_mask, NULL); + SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); return ret; } @@ -653,9 +653,9 @@ tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, di.u.ti.segbase = ip; /* this is cheap... */ - sigprocmask (SIG_SETMASK, &unwi_full_mask, &saved_mask); + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); ret = dl_iterate_phdr (callback, &di); - sigprocmask (SIG_SETMASK, &saved_mask, NULL); + SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); if (ret <= 0) {
_______________________________________________ Libunwind-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/libunwind-devel
