[Lldb-commits] [PATCH] D91835: [lldb] Add Python bindings to print stack traces on crashes.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 25 11:10:17 PST 2020


JDevlieghere added a comment.

In D91835#2407492 <https://reviews.llvm.org/D91835#2407492>, @labath wrote:

> In D91835#2407060 <https://reviews.llvm.org/D91835#2407060>, @rupprecht wrote:
>
>> I ran manual tests for this, but I did so by introducing an intentional crash in a place that obviously can't be checked in. Does LLDB have any kind of intentional-crash-for-test mechanism that could be used for a test?
>
> We have a `reproducer xcrash` command that could be used for this purpose.

Currently the command is a noop when reproducers are off, we could consider changing that to be only the case when replaying.

> Though that does bring up the question of how will this interact with reproducers, which also mess with signal handlers. @JDevlieghere, any thoughts on that?

The signal handler mechanism in LLVM allows you to install multiple signal handlers that can be run one after the other. With reproducers enabled it will print the pretty stack trace first and then call the reproducer signal handler. However, that all happens in the driver, so none of this should matter for an SB API test. Enabling the reproducers in dotest is a pain though, because it needs to happen before the debugger is initialized, so you can't just enable it for a single test without messing with dotest or lit directly. If this would be useful more generally, maybe the `xcrash` subcommand should be part of a hidden/undocumented top level `test` command?

>> Also, I picked `SBDebugger` for this as it seems like a very global option, but I'm happy to put it somewhere else. Not sure where though?
>
> SBDebugger is probably fine. That's where we put our other global static functions...




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91835



More information about the lldb-commits mailing list