|
LLDB mainline
|
Diagnostics are a collection of files to help investigate bugs and troubleshoot issues. More...
#include <Diagnostics.h>
Classes | |
| struct | CallbackEntry |
Public Types | |
| using | Callback = std::function<llvm::Error(const FileSpec &)> |
| using | CallbackID = uint64_t |
Public Member Functions | |
| Diagnostics () | |
| ~Diagnostics () | |
| llvm::Error | Create (const FileSpec &dir) |
| Gather diagnostics in the given directory. | |
| void | Report (llvm::StringRef message) |
| CallbackID | AddCallback (Callback callback) |
| void | RemoveCallback (CallbackID id) |
| bool | Dump (llvm::raw_ostream &stream) |
| Gather diagnostics and print a message to the given output stream. | |
| bool | Dump (llvm::raw_ostream &stream, const FileSpec &dir) |
Static Public Member Functions | |
| static Diagnostics & | Instance () |
| static bool | Enabled () |
| static void | Initialize () |
| static void | Terminate () |
| static llvm::Expected< FileSpec > | CreateUniqueDirectory () |
| Create a unique diagnostic directory. | |
Private Member Functions | |
| llvm::Error | DumpDiangosticsLog (const FileSpec &dir) const |
Static Private Member Functions | |
| static std::optional< Diagnostics > & | InstanceImpl () |
Private Attributes | |
| RotatingLogHandler | m_log_handler |
| CallbackID | m_callback_id |
| Monotonically increasing callback identifier. | |
| llvm::SmallVector< CallbackEntry, 4 > | m_callbacks |
| List of callback entries. | |
| std::mutex | m_callbacks_mutex |
| Mutex to protect callback list and callback identifier. | |
Diagnostics are a collection of files to help investigate bugs and troubleshoot issues.
Any part of the debugger can register itself with the help of a callback to emit one or more files into the diagnostic directory.
Definition at line 28 of file Diagnostics.h.
| using lldb_private::Diagnostics::Callback = std::function<llvm::Error(const FileSpec &)> |
Definition at line 44 of file Diagnostics.h.
| using lldb_private::Diagnostics::CallbackID = uint64_t |
Definition at line 45 of file Diagnostics.h.
| Diagnostics::Diagnostics | ( | ) |
Definition at line 42 of file Diagnostics.cpp.
References g_num_log_messages, and m_log_handler.
Referenced by Instance().
| Diagnostics::~Diagnostics | ( | ) |
Definition at line 44 of file Diagnostics.cpp.
| Diagnostics::CallbackID Diagnostics::AddCallback | ( | Callback | callback | ) |
Definition at line 46 of file Diagnostics.cpp.
References m_callback_id, m_callbacks, and m_callbacks_mutex.
Referenced by lldb_private::Debugger::Debugger().
Gather diagnostics in the given directory.
Definition at line 91 of file Diagnostics.cpp.
References DumpDiangosticsLog(), and m_callbacks.
Referenced by CommandObjectDiagnosticsDump::DoExecute(), and Dump().
|
static |
Create a unique diagnostic directory.
Definition at line 82 of file Diagnostics.cpp.
Referenced by Dump(), and CommandObjectDiagnosticsDump::GetDirectory().
| bool Diagnostics::Dump | ( | llvm::raw_ostream & | stream | ) |
Gather diagnostics and print a message to the given output stream.
Definition at line 59 of file Diagnostics.cpp.
References CreateUniqueDirectory(), Dump(), and lldb_private::toString().
Referenced by Dump(), and DumpDiagnostics().
Definition at line 70 of file Diagnostics.cpp.
References Create(), error(), lldb_private::FileSpec::GetPath(), and lldb_private::toString().
|
private |
Definition at line 103 of file Diagnostics.cpp.
References lldb_private::FileSpec::CopyByAppendingPathComponent(), lldb_private::FileSpec::GetPath(), and m_log_handler.
Referenced by Create().
|
static |
Definition at line 33 of file Diagnostics.cpp.
References InstanceImpl().
Referenced by lldb_private::Debugger::Clear(), lldb_private::Debugger::Debugger(), and lldb_private::Debugger::ReportDiagnosticImpl().
|
static |
Definition at line 23 of file Diagnostics.cpp.
References InstanceImpl(), and lldbassert.
Referenced by lldb_private::SystemInitializerCommon::Initialize().
|
static |
Definition at line 40 of file Diagnostics.cpp.
References Diagnostics(), and InstanceImpl().
Referenced by lldb_private::Debugger::Clear(), lldb_private::Debugger::Debugger(), CommandObjectDiagnosticsDump::DoExecute(), DumpDiagnostics(), and lldb_private::Debugger::ReportDiagnosticImpl().
|
staticprivate |
Definition at line 35 of file Diagnostics.cpp.
Referenced by Enabled(), Initialize(), Instance(), and Terminate().
| void Diagnostics::RemoveCallback | ( | CallbackID | id | ) |
Definition at line 53 of file Diagnostics.cpp.
References lldb_private::Diagnostics::CallbackEntry::id, m_callbacks, and m_callbacks_mutex.
Referenced by lldb_private::Debugger::Clear().
| void Diagnostics::Report | ( | llvm::StringRef | message | ) |
Definition at line 113 of file Diagnostics.cpp.
References m_log_handler.
Referenced by lldb_private::Debugger::ReportDiagnosticImpl().
|
static |
Definition at line 28 of file Diagnostics.cpp.
References InstanceImpl(), and lldbassert.
Referenced by lldb_private::SystemInitializerCommon::Terminate().
|
private |
Monotonically increasing callback identifier.
Unique per Diagnostic instance.
Definition at line 75 of file Diagnostics.h.
Referenced by AddCallback().
|
private |
List of callback entries.
Definition at line 78 of file Diagnostics.h.
Referenced by AddCallback(), Create(), and RemoveCallback().
|
private |
Mutex to protect callback list and callback identifier.
Definition at line 81 of file Diagnostics.h.
Referenced by AddCallback(), and RemoveCallback().
|
private |
Definition at line 64 of file Diagnostics.h.
Referenced by Diagnostics(), DumpDiangosticsLog(), and Report().