================ @@ -0,0 +1,288 @@ +//===-- ScriptedPlatform.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 "ScriptedPlatform.h" + +#include "lldb/Core/Debugger.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Host/HostInfo.h" +#include "lldb/Interpreter/ScriptInterpreter.h" +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Utility/LLDBLog.h" + +using namespace lldb; +using namespace lldb_private; + +LLDB_PLUGIN_DEFINE(ScriptedPlatform) + +static uint32_t g_initialize_count = 0; + +static constexpr lldb::ScriptLanguage g_supported_script_languages[] = { + ScriptLanguage::eScriptLanguagePython, +}; + +bool ScriptedPlatform::IsScriptLanguageSupported( + lldb::ScriptLanguage language) { + llvm::ArrayRef<lldb::ScriptLanguage> supported_languages( + g_supported_script_languages); + + return llvm::is_contained(supported_languages, language); +} + +ScriptedPlatformInterface &ScriptedPlatform::GetInterface() const { + return *m_interface_up; +} + +lldb::PlatformSP ScriptedPlatform::CreateInstance(bool force, + const ArchSpec *arch) { + Log *log = GetLog(LLDBLog::Platform); + if (log) { + const char *arch_name; + if (arch && arch->GetArchitectureName()) + arch_name = arch->GetArchitectureName(); + else + arch_name = "<null>"; + + const char *triple_cstr = + arch ? arch->GetTriple().getTriple().c_str() : "<null>"; + + LLDB_LOGF(log, "ScriptedPlatform::%s(force=%s, arch={%s,%s})", + __PRETTY_FUNCTION__, force ? "true" : "false", arch_name, + triple_cstr); + } + + return std::make_shared<ScriptedPlatform>(); +} + +ScriptedPlatform::ScriptedPlatform() : Platform(false) {} + +bool ScriptedPlatform::SetupScriptedObject(Status &error) { ---------------- medismailben wrote:
1. A Scripted Object is the class instance that we will use to make the calls to. 2. This could just return an `llvm::Error` actually. https://github.com/llvm/llvm-project/pull/99814 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits