[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 08:55:08 PST 2022

werat added a comment.

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

> I'm not sure it's a good idea to start loading DLLs when we get to this point.
> I would rather suggest calling `sys::PrintStackTraceOnErrorSignal({});` in `SBDebugger::Initialize()`. "argv0" will be auto-detected if necessary, otherwise if you can, change the `SBDebugger::Initialize()` API to pass it? It's only there so that we can find `llvm-symbolizer` next to the running executable.

Thanks for a quick review! I followed your adviced and added a call to `PrintStackTraceOnErrorSignal()` in `Debugger::Initialize()`. It's possible to change the API to accept `argv` is possible, but it we can't introduce breaking changes, so the old code will not have `argv`.

Given that now PrintStackTraceOnErrorSignal will be called twice in LLDB driver (and in general case `Initialize()` can be called many times), I modified the implementation of `PrintStackTraceOnErrorSignal` a little bit -- don't do anything if `::Argv0` is already set.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list