LLDB mainline
StructuredDataDarwinLog.h
Go to the documentation of this file.
1//===-- StructuredDataDarwinLog.h -------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_STRUCTUREDDATA_DARWINLOG_STRUCTUREDDATADARWINLOG_H
10#define LLDB_SOURCE_PLUGINS_STRUCTUREDDATA_DARWINLOG_STRUCTUREDDATADARWINLOG_H
11
13
14#include <mutex>
15
16// Forward declarations
17namespace sddarwinlog_private {
18class EnableCommand;
19}
20
21namespace lldb_private {
22
25
26public:
27 // Public static API
28
29 static void Initialize();
30
31 static void Terminate();
32
33 static llvm::StringRef GetStaticPluginName() { return "darwin-log"; }
34
35 /// Return whether the DarwinLog functionality is enabled.
36 ///
37 /// The DarwinLog functionality is enabled if the user explicitly enabled
38 /// it with the enable command, or if the user has the setting set
39 /// that controls if we always enable it for newly created/attached
40 /// processes.
41 ///
42 /// \return
43 /// True if DarwinLog support is/will be enabled for existing or
44 /// newly launched/attached processes.
45 static bool IsEnabled();
46
47 // PluginInterface API
48
49 llvm::StringRef GetPluginName() override { return GetStaticPluginName(); }
50
51 // StructuredDataPlugin API
52
53 bool SupportsStructuredDataType(llvm::StringRef type_name) override;
54
56 Process &process, llvm::StringRef type_name,
57 const StructuredData::ObjectSP &object_sp) override;
58
60 lldb_private::Stream &stream) override;
61
62 bool GetEnabled(llvm::StringRef type_name) const override;
63
64 void ModulesDidLoad(Process &process, ModuleList &module_list) override;
65
66 ~StructuredDataDarwinLog() override;
67
68private:
69 // Private constructors
70
72
73 // Private static methods
74
76
77 static void DebuggerInitialize(Debugger &debugger);
78
79 static bool InitCompletionHookCallback(void *baton,
81 lldb::user_id_t break_id,
82 lldb::user_id_t break_loc_id);
83
84 static Status FilterLaunchInfo(ProcessLaunchInfo &launch_info,
85 Target *target);
86
87 // Internal helper methods used by friend classes
88 void SetEnabled(bool enabled);
89
90 void AddInitCompletionHook(Process &process);
91
92 // Private methods
93
94 void DumpTimestamp(Stream &stream, uint64_t timestamp);
95
96 size_t DumpHeader(Stream &stream, const StructuredData::Dictionary &event);
97
99 Stream &stream);
100
101 /// Call the enable command again, using whatever settings were initially
102 /// made.
103
104 void EnableNow();
105
106 // Private data
113};
114}
115
116#endif // LLDB_SOURCE_PLUGINS_STRUCTUREDDATA_DARWINLOG_STRUCTUREDDATADARWINLOG_H
A class to manage flag bits.
Definition: Debugger.h:80
A collection class for Module objects.
Definition: ModuleList.h:103
A plug-in interface definition class for debugging a process.
Definition: Process.h:343
An error handling class.
Definition: Status.h:115
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
Status GetDescription(const StructuredData::ObjectSP &object_sp, lldb_private::Stream &stream) override
Get a human-readable description of the contents of the data.
static void DebuggerInitialize(Debugger &debugger)
void DumpTimestamp(Stream &stream, uint64_t timestamp)
static bool InitCompletionHookCallback(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
size_t HandleDisplayOfEvent(const StructuredData::Dictionary &event, Stream &stream)
void HandleArrivalOfStructuredData(Process &process, llvm::StringRef type_name, const StructuredData::ObjectSP &object_sp) override
Handle the arrival of asynchronous structured data from the process.
static lldb::StructuredDataPluginSP CreateInstance(Process &process)
static Status FilterLaunchInfo(ProcessLaunchInfo &launch_info, Target *target)
void EnableNow()
Call the enable command again, using whatever settings were initially made.
size_t DumpHeader(Stream &stream, const StructuredData::Dictionary &event)
void ModulesDidLoad(Process &process, ModuleList &module_list) override
Allow the plugin to do work related to modules that loaded in the the corresponding process.
static bool IsEnabled()
Return whether the DarwinLog functionality is enabled.
bool GetEnabled(llvm::StringRef type_name) const override
Returns whether the plugin's features are enabled.
bool SupportsStructuredDataType(llvm::StringRef type_name) override
Return whether this plugin supports the given StructuredData feature.
Plugin that supports process-related structured data sent asynchronously from the debug monitor (e....
std::shared_ptr< Object > ObjectSP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StructuredDataPlugin > StructuredDataPluginSP
Definition: lldb-forward.h:438
std::weak_ptr< lldb_private::Process > ProcessWP
Definition: lldb-forward.h:392
uint64_t user_id_t
Definition: lldb-types.h:82