mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 07:57:36 +08:00
[lldb] Add diagnostics
Around this time last year, I said on the mailing list [1] that I wanted to to transform the reproducers into something that resembles a sysdiagnose on Apple platforms: a collection of files containing a variety of information to help diagnose bugs or troubleshoot issues. This patch adds that framework. Based on lessons learned from the reproducers, I've intentionally tried to keep it small and simple. Different parts of LLDB can register callbacks (this is necessary for layering purposes) that will get called when the diagnostics should be generated. [1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html Differential revision: https://reviews.llvm.org/D134991
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/TargetList.h"
|
||||
#include "lldb/Utility/Args.h"
|
||||
#include "lldb/Utility/Diagnostics.h"
|
||||
#include "lldb/Utility/State.h"
|
||||
#include "lldb/Version/Version.h"
|
||||
|
||||
@@ -218,6 +219,16 @@ void SBDebugger::PrintStackTraceOnError() {
|
||||
llvm::sys::PrintStackTraceOnErrorSignal(executable);
|
||||
}
|
||||
|
||||
static void DumpDiagnostics(void *cookie) {
|
||||
Diagnostics::Instance().Dump(llvm::errs());
|
||||
}
|
||||
|
||||
void SBDebugger::PrintDiagnosticsOnError() {
|
||||
LLDB_INSTRUMENT();
|
||||
|
||||
llvm::sys::AddSignalHandler(&DumpDiagnostics, nullptr);
|
||||
}
|
||||
|
||||
void SBDebugger::Terminate() {
|
||||
LLDB_INSTRUMENT();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user