[Lldb-commits] [PATCH] D119009: [Support] Ensure handlers are set up before printing the stacktrace

Andy Yankovsky via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 7 12:07:46 PST 2022


werat added a comment.

In D119009#3302004 <https://reviews.llvm.org/D119009#3302004>, @labath wrote:

> I don't think this is a good idea. I'm very much against libraries randomly installing signal handlers, and I think that is the reason this function is called from the main program in lldb (and elsewhere in llvm afaik). If there's no way to get a backtrace without this on windows, then it'd be better to disable the lldbassert functionality there.



In D119009#3302118 <https://reviews.llvm.org/D119009#3302118>, @aganea wrote:

> In that case @werat can you get the caller application to call `llvm::InitLLVM`? That plus the snippet in https://reviews.llvm.org/D119009#3297591 should shield from crashes if the handler isn't installed.

In my case the application doesn't link againt LLVM libraries, it only uses `liblldb.dll` (which doesn't export `llvm::InitLLVM` or `llvm::sys::PrintStackTraceOnErrorSignal`). 
It would be nice to have backtraces when using LLDB as a library, but I agree that only-main-program-install-signal-handlers policy makes a lot of sense.

I will change this patch to install a safeguard from https://reviews.llvm.org/D119009#3297591 then.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119009/new/

https://reviews.llvm.org/D119009



More information about the lldb-commits mailing list