[Lldb-commits] [lldb] [lldb] Introduce ScriptedFrameProvider (PR #161870)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 3 08:59:45 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h lldb/include/lldb/Interpreter/ScriptedFrameProvider.h lldb/source/Interpreter/ScriptedFrameProvider.cpp lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.cpp lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h lldb/include/lldb/API/SBThread.h lldb/include/lldb/Interpreter/ScriptInterpreter.h lldb/include/lldb/Target/Thread.h lldb/include/lldb/lldb-forward.h lldb/source/API/SBThread.cpp lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h lldb/source/Target/Thread.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/API/SBThread.h b/lldb/include/lldb/API/SBThread.h
index 7b9122852..03fa24012 100644
--- a/lldb/include/lldb/API/SBThread.h
+++ b/lldb/include/lldb/API/SBThread.h
@@ -229,7 +229,8 @@ public:
SBValue GetSiginfo();
- void RegisterFrameProvider(const char *class_name, SBStructuredData &args_data);
+ void RegisterFrameProvider(const char *class_name,
+ SBStructuredData &args_data);
private:
friend class SBBreakpoint;
diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
index 76ade0020..47f994a53 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
@@ -537,7 +537,8 @@ public:
return {};
}
- virtual lldb::ScriptedFrameProviderInterfaceSP CreateScriptedFrameProviderInterface() {
+ virtual lldb::ScriptedFrameProviderInterfaceSP
+ CreateScriptedFrameProviderInterface() {
return {};
}
diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h
index d0c33f557..da441c810 100644
--- a/lldb/include/lldb/Target/Thread.h
+++ b/lldb/include/lldb/Target/Thread.h
@@ -1294,10 +1294,10 @@ public:
/// The PC value before execution was resumed. May not be available;
/// an empty std::optional is returned in that case.
std::optional<lldb::addr_t> GetPreviousFrameZeroPC();
-
- void SetScriptedFrameProvider(const ScriptedMetadata &scripted_metadata);
- void ClearScriptedFrameProvider();
+ void SetScriptedFrameProvider(const ScriptedMetadata &scripted_metadata);
+
+ void ClearScriptedFrameProvider();
protected:
friend class ThreadPlan;
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index a18d540f2..165af8c5c 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -1333,7 +1333,7 @@ void SBThread::RegisterFrameProvider(const char *class_name,
ThreadSP thread_sp = m_opaque_sp->GetThreadSP();
if (!thread_sp)
return;
-
+
if (!dict.IsValid() || !dict.m_impl_up)
return;
@@ -1347,7 +1347,6 @@ void SBThread::RegisterFrameProvider(const char *class_name,
if (!dict_sp || dict_sp->GetType() == lldb::eStructuredDataTypeInvalid)
return;
-
ScriptedMetadata metadata(class_name, dict_sp);
thread_sp->SetScriptedFrameProvider(metadata);
}
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 02d62aa92..be09cc59a 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -1233,10 +1233,9 @@ public:
class CommandObjectFrameProviderRegister : public CommandObjectParsed {
public:
CommandObjectFrameProviderRegister(CommandInterpreter &interpreter)
- : CommandObjectParsed(
- interpreter, "frame provider register",
- "Register frame provider into current thread.",
- nullptr, eCommandRequiresThread),
+ : CommandObjectParsed(interpreter, "frame provider register",
+ "Register frame provider into current thread.",
+ nullptr, eCommandRequiresThread),
m_class_options("frame provider", true, 'C', 'k', 'v', 0) {
m_all_options.Append(&m_class_options, LLDB_OPT_SET_1 | LLDB_OPT_SET_2,
@@ -1258,7 +1257,8 @@ public:
protected:
void DoExecute(Args &launch_args, CommandReturnObject &result) override {
- ScriptedMetadata metadata(m_class_options.GetName(), m_class_options.GetStructuredData());
+ ScriptedMetadata metadata(m_class_options.GetName(),
+ m_class_options.GetStructuredData());
Thread *thread = m_exe_ctx.GetThreadPtr();
if (!thread) {
@@ -1292,9 +1292,9 @@ protected:
result.AppendError("invalid thread");
return;
}
-
+
thread->ClearScriptedFrameProvider();
-
+
result.SetStatus(eReturnStatusSuccessFinishResult);
}
};
@@ -1306,11 +1306,11 @@ public:
interpreter, "frame provider",
"Commands for registering and viewing frame providers.",
"frame provider [<sub-command-options>] ") {
- LoadSubCommand("register", CommandObjectSP(new CommandObjectFrameProviderRegister(
- interpreter)));
LoadSubCommand(
- "clear",
- CommandObjectSP(new CommandObjectFrameProviderClear(interpreter)));
+ "register",
+ CommandObjectSP(new CommandObjectFrameProviderRegister(interpreter)));
+ LoadSubCommand("clear", CommandObjectSP(new CommandObjectFrameProviderClear(
+ interpreter)));
}
~CommandObjectFrameProvider() override = default;
@@ -1336,8 +1336,8 @@ CommandObjectMultiwordFrame::CommandObjectMultiwordFrame(
LoadSubCommand("variable",
CommandObjectSP(new CommandObjectFrameVariable(interpreter)));
#if LLDB_ENABLE_PYTHON
- LoadSubCommand("provider", CommandObjectSP(new CommandObjectFrameProvider(
- interpreter)));
+ LoadSubCommand("provider",
+ CommandObjectSP(new CommandObjectFrameProvider(interpreter)));
LoadSubCommand("recognizer", CommandObjectSP(new CommandObjectFrameRecognizer(
interpreter)));
#endif
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h
index 0b9c7eb10..b2a347951 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h
@@ -17,8 +17,8 @@
#include "OperatingSystemPythonInterface.h"
#include "ScriptedBreakpointPythonInterface.h"
-#include "ScriptedFramePythonInterface.h"
#include "ScriptedFrameProviderPythonInterface.h"
+#include "ScriptedFramePythonInterface.h"
#include "ScriptedPlatformPythonInterface.h"
#include "ScriptedProcessPythonInterface.h"
#include "ScriptedStopHookPythonInterface.h"
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h
index 202769c09..212c2dabf 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFrameProviderPythonInterface.h
@@ -22,7 +22,8 @@ class ScriptedFrameProviderPythonInterface
: public ScriptedFrameProviderInterface,
public ScriptedPythonInterface {
public:
- ScriptedFrameProviderPythonInterface(ScriptInterpreterPythonImpl &interpreter);
+ ScriptedFrameProviderPythonInterface(
+ ScriptInterpreterPythonImpl &interpreter);
llvm::Expected<StructuredData::GenericSP>
CreatePluginObject(llvm::StringRef class_name, lldb::ThreadSP thread_sp,
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
index 7f7446cc0..92b28c051 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
@@ -439,7 +439,7 @@ protected:
python::PythonObject Transform(lldb::ProcessSP arg) {
return python::SWIGBridge::ToSWIGWrapper(arg);
}
-
+
python::PythonObject Transform(lldb::ThreadSP arg) {
return python::SWIGBridge::ToSWIGWrapper(arg);
}
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index acf126a54..5ca11be6a 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -18,8 +18,8 @@
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/Property.h"
-#include "lldb/Interpreter/ScriptedFrameProvider.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Interpreter/ScriptedFrameProvider.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/DynamicLoader.h"
@@ -1460,7 +1460,8 @@ llvm::Expected<StackFrameListSP> Thread::GetScriptedFrameList() {
return m_frame_provider_sp->GetStackFrames();
}
-void Thread::SetScriptedFrameProvider(const ScriptedMetadata &scripted_metadata) {
+void Thread::SetScriptedFrameProvider(
+ const ScriptedMetadata &scripted_metadata) {
std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
Status error;
``````````
</details>
https://github.com/llvm/llvm-project/pull/161870
More information about the lldb-commits
mailing list