llvm/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp

//===-- StructuredDataDarwinLog.cpp ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "StructuredDataDarwinLog.h"

#include <cstring>

#include <memory>
#include <sstream>

#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandObjectMultiword.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/Property.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadPlanCallOnFunctionExit.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"

#include "llvm/ADT/StringMap.h"

#define DARWIN_LOG_TYPE_VALUE

usingnamespacelldb;
usingnamespacelldb_private;

LLDB_PLUGIN_DEFINE()

#pragma mark -
#pragma mark Anonymous Namespace

// Anonymous namespace

namespace sddarwinlog_private {
const uint64_t NANOS_PER_MICRO =;
const uint64_t NANOS_PER_MILLI =;
const uint64_t NANOS_PER_SECOND =;
const uint64_t NANOS_PER_MINUTE =;
const uint64_t NANOS_PER_HOUR =;

static bool DEFAULT_FILTER_FALLTHROUGH_ACCEPTS =;

/// Global, sticky enable switch.  If true, the user has explicitly
/// run the enable command.  When a process launches or is attached to,
/// we will enable DarwinLog if either the settings for auto-enable is
/// on, or if the user had explicitly run enable at some point prior
/// to the launch/attach.
static bool s_is_explicitly_enabled;

class EnableOptions;
EnableOptionsSP;

OptionsMap;

static OptionsMap &GetGlobalOptionsMap() {}

static std::mutex &GetGlobalOptionsMapLock() {}

EnableOptionsSP GetGlobalEnableOptions(const DebuggerSP &debugger_sp) {}

void SetGlobalEnableOptions(const DebuggerSP &debugger_sp,
                            const EnableOptionsSP &options_sp) {}

#pragma mark -
#pragma mark Settings Handling

/// Code to handle the StructuredDataDarwinLog settings

#define LLDB_PROPERTIES_darwinlog
#include "StructuredDataDarwinLogProperties.inc"

enum {};

class StructuredDataDarwinLogProperties : public Properties {};

static StructuredDataDarwinLogProperties &GetGlobalProperties() {}

const char *const s_filter_attributes[] =;

static llvm::StringRef GetDarwinLogTypeName() {}

static llvm::StringRef GetLogEventType() {}

class FilterRule;
FilterRuleSP;

class FilterRule {};

FilterRules;

class RegexFilterRule : public FilterRule {};

class ExactMatchFilterRule : public FilterRule {};

static void RegisterFilterOperations() {}

// =========================================================================
// Commands
// =========================================================================

/// Provides the main on-off switch for enabling darwin logging.
///
/// It is valid to run the enable command when logging is already enabled.
/// This resets the logging with whatever settings are currently set.

static constexpr OptionDefinition g_enable_option_table[] =;

class EnableOptions : public Options {};

class EnableCommand : public CommandObjectParsed {};

/// Provides the status command.
class StatusCommand : public CommandObjectParsed {};

/// Provides the darwin-log base command
class BaseCommand : public CommandObjectMultiword {};

EnableOptionsSP ParseAutoEnableOptions(Status &error, Debugger &debugger) {}

bool RunEnableCommand(CommandInterpreter &interpreter) {}
}
usingnamespacesddarwinlog_private;

#pragma mark -
#pragma mark Public static API

// Public static API

void StructuredDataDarwinLog::Initialize() {}

void StructuredDataDarwinLog::Terminate() {}

#pragma mark -
#pragma mark StructuredDataPlugin API

// StructuredDataPlugin API

bool StructuredDataDarwinLog::SupportsStructuredDataType(
    llvm::StringRef type_name) {}

void StructuredDataDarwinLog::HandleArrivalOfStructuredData(
    Process &process, llvm::StringRef type_name,
    const StructuredData::ObjectSP &object_sp) {}

static void SetErrorWithJSON(Status &error, const char *message,
                             StructuredData::Object &object) {}

Status StructuredDataDarwinLog::GetDescription(
    const StructuredData::ObjectSP &object_sp, lldb_private::Stream &stream) {}

bool StructuredDataDarwinLog::GetEnabled(llvm::StringRef type_name) const {}

void StructuredDataDarwinLog::SetEnabled(bool enabled) {}

void StructuredDataDarwinLog::ModulesDidLoad(Process &process,
                                             ModuleList &module_list) {}

// public destructor

StructuredDataDarwinLog::~StructuredDataDarwinLog() {}

#pragma mark -
#pragma mark Private instance methods

// Private constructors

StructuredDataDarwinLog::StructuredDataDarwinLog(const ProcessWP &process_wp)
    :{}

// Private static methods

StructuredDataPluginSP
StructuredDataDarwinLog::CreateInstance(Process &process) {}

void StructuredDataDarwinLog::DebuggerInitialize(Debugger &debugger) {}

Status StructuredDataDarwinLog::FilterLaunchInfo(ProcessLaunchInfo &launch_info,
                                                 Target *target) {}

bool StructuredDataDarwinLog::InitCompletionHookCallback(
    void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
    lldb::user_id_t break_loc_id) {}

void StructuredDataDarwinLog::AddInitCompletionHook(Process &process) {}

void StructuredDataDarwinLog::DumpTimestamp(Stream &stream,
                                            uint64_t timestamp) {}

size_t
StructuredDataDarwinLog::DumpHeader(Stream &output_stream,
                                    const StructuredData::Dictionary &event) {}

size_t StructuredDataDarwinLog::HandleDisplayOfEvent(
    const StructuredData::Dictionary &event, Stream &stream) {}

void StructuredDataDarwinLog::EnableNow() {}