Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb/Interpreter] Make Scripted*Interface base class abstract #71465

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ class ScriptedPlatformInterface : virtual public ScriptedInterface {
virtual llvm::Expected<StructuredData::GenericSP>
CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
StructuredData::DictionarySP args_sp,
StructuredData::Generic *script_obj = nullptr) {
return {llvm::make_error<UnimplementedError>()};
}
StructuredData::Generic *script_obj = nullptr) = 0;

virtual StructuredData::DictionarySP ListProcesses() { return {}; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ class ScriptedProcessInterface : virtual public ScriptedInterface {
virtual llvm::Expected<StructuredData::GenericSP>
CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
StructuredData::DictionarySP args_sp,
StructuredData::Generic *script_obj = nullptr) {
return {llvm::make_error<UnimplementedError>()};
}
StructuredData::Generic *script_obj = nullptr) = 0;

virtual StructuredData::DictionarySP GetCapabilities() { return {}; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class ScriptedThreadInterface : virtual public ScriptedInterface {
virtual llvm::Expected<StructuredData::GenericSP>
CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
StructuredData::DictionarySP args_sp,
StructuredData::Generic *script_obj = nullptr) {
return {llvm::make_error<UnimplementedError>()};
}
StructuredData::Generic *script_obj = nullptr) = 0;

virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; }

Expand Down
16 changes: 6 additions & 10 deletions lldb/include/lldb/Interpreter/ScriptInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,7 @@ class ScriptInterpreter : public PluginInterface {
eScriptReturnTypeOpaqueObject
};

ScriptInterpreter(
Debugger &debugger, lldb::ScriptLanguage script_lang,
lldb::ScriptedPlatformInterfaceUP scripted_platform_interface_up =
std::make_unique<ScriptedPlatformInterface>());
ScriptInterpreter(Debugger &debugger, lldb::ScriptLanguage script_lang);

virtual StructuredData::DictionarySP GetInterpreterInfo();

Expand Down Expand Up @@ -559,19 +556,19 @@ class ScriptInterpreter : public PluginInterface {
lldb::ScriptLanguage GetLanguage() { return m_script_lang; }

virtual lldb::ScriptedProcessInterfaceUP CreateScriptedProcessInterface() {
return std::make_unique<ScriptedProcessInterface>();
return {};
}

virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface() {
return std::make_shared<ScriptedThreadInterface>();
return {};
}

virtual lldb::OperatingSystemInterfaceSP CreateOperatingSystemInterface() {
return std::make_shared<OperatingSystemInterface>();
return {};
}

ScriptedPlatformInterface &GetScriptedPlatformInterface() {
return *m_scripted_platform_interface_up;
virtual lldb::ScriptedPlatformInterfaceUP GetScriptedPlatformInterface() {
return {};
}

virtual StructuredData::ObjectSP
Expand Down Expand Up @@ -599,7 +596,6 @@ class ScriptInterpreter : public PluginInterface {
protected:
Debugger &m_debugger;
lldb::ScriptLanguage m_script_lang;
lldb::ScriptedPlatformInterfaceUP m_scripted_platform_interface_up;
};

} // namespace lldb_private
Expand Down
9 changes: 3 additions & 6 deletions lldb/source/Interpreter/ScriptInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@
using namespace lldb;
using namespace lldb_private;

ScriptInterpreter::ScriptInterpreter(
Debugger &debugger, lldb::ScriptLanguage script_lang,
lldb::ScriptedPlatformInterfaceUP scripted_platform_interface_up)
: m_debugger(debugger), m_script_lang(script_lang),
m_scripted_platform_interface_up(
std::move(scripted_platform_interface_up)) {}
ScriptInterpreter::ScriptInterpreter(Debugger &debugger,
lldb::ScriptLanguage script_lang)
: m_debugger(debugger), m_script_lang(script_lang) {}

void ScriptInterpreter::CollectDataForBreakpointCommandCallback(
std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,6 @@ ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(Debugger &debugger)
m_active_io_handler(eIOHandlerNone), m_session_is_active(false),
m_pty_secondary_is_open(false), m_valid_session(true), m_lock_count(0),
m_command_thread_state(nullptr) {
m_scripted_platform_interface_up =
std::make_unique<ScriptedPlatformPythonInterface>(*this);

m_dictionary_name.append("_dict");
StreamString run_string;
Expand Down