LLDB mainline
ScriptInterpreterRuntimeLoader.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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_HOST_SCRIPTINTERPRETERRUNTIMELOADER_H
10#define LLDB_HOST_SCRIPTINTERPRETERRUNTIMELOADER_H
11
13#include "llvm/ADT/StringRef.h"
14#include "llvm/Support/Error.h"
15
16namespace lldb_private {
17
18/// Loads a script-interpreter runtime into the current process before its
19/// plugin is dlopened. Lives outside the PluginManager because plugin
20/// registration itself depends on the runtime's symbols already being
21/// resolvable. Subclasses encode a single language's resolution policy
22/// (search order, env-var overrides, platform candidates).
24public:
26
27 /// Resolves the runtime so the script interpreter plugin's undefined
28 /// symbols can bind. The first call drives the search and subsequent
29 /// calls return the cached outcome. Returns success when the runtime
30 /// is already in the process or has been loaded.
31 virtual llvm::Error Load() = 0;
32
33 /// Absolute path of the loaded runtime, for diagnostics. The success
34 /// value is empty when the runtime was already in the process. Drives
35 /// the load on first call.
36 virtual llvm::Expected<llvm::StringRef> GetLoadedPath() = 0;
37
38 /// True if the runtime is currently mapped into the process.
39 virtual bool IsLoaded() = 0;
40
41 /// Returns the loader for \p language. Returns an Error when the
42 /// language has no dynamic loader (currently every language except
43 /// Python) or when support for it was not compiled in.
44 static llvm::Expected<ScriptInterpreterRuntimeLoader &>
45 Get(lldb::ScriptLanguage language);
46};
47
48} // namespace lldb_private
49
50#endif // LLDB_HOST_SCRIPTINTERPRETERRUNTIMELOADER_H
Loads a script-interpreter runtime into the current process before its plugin is dlopened.
static llvm::Expected< ScriptInterpreterRuntimeLoader & > Get(lldb::ScriptLanguage language)
Returns the loader for language.
virtual llvm::Error Load()=0
Resolves the runtime so the script interpreter plugin's undefined symbols can bind.
virtual bool IsLoaded()=0
True if the runtime is currently mapped into the process.
virtual llvm::Expected< llvm::StringRef > GetLoadedPath()=0
Absolute path of the loaded runtime, for diagnostics.
A class that represents a running process on the host machine.
ScriptLanguage
Script interpreter types.