On Tue, 5 Mar 2024 18:26:28 -0500 (EST) Vladimir Dergachev <volo...@mindspring.com> wrote:
> I use libunwind in my programs, works quite well, and simple to use. > > Happy to share the code if there is interest.. Do you mean that you use libunwind in signal handlers? An example on how to produce a backtrace without calling any async-signal-unsafe functions would indeed be greatly useful. Speaking of shared objects injected using LD_PRELOAD, I've experimented some more, and I think that none of them would work with R without additional adjustments. They install their signal handler very soon after the process starts up, and later, when R initialises, it installs its own signal handler, overwriting the previous one. For this scheme to work, either R would have to cooperate, remembering a pointer to the previous signal handler and calling it at some point (which sounds unsafe), or the injected shared object would have to override sigaction() and call R's signal handler from its own (which sounds extremely unsafe). Without that, if we want C-level backtraces, we either need to patch R to produce them (using backtrace() and limiting this to glibc systems or using libunwind and paying the dependency cost) or to use a debugger. -- Best regards, Ivan ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel