[Lldb-commits] [lldb] Add a new affordance that the Python module in a dSYM (PR #133290)

via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 27 11:16:28 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 960615954e4cb3150ae4a479fa7f9d0d17035eea effad9525461611ed47598b53a77ee5aabb0e4cf --extensions h,c,cpp -- lldb/test/API/macosx/dsym_modules/main.c lldb/include/lldb/Interpreter/ScriptInterpreter.h lldb/source/Core/Module.cpp lldb/source/Interpreter/ScriptInterpreter.cpp lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 7b52ba08cd..53dc6fcde0 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1486,7 +1486,7 @@ bool Module::LoadScriptingResourceInTarget(Target *target, Status &error,
             LoadScriptOptions options;
             bool did_load = script_interpreter->LoadScriptingModule(
                 scripting_stream.GetData(), options, error,
-                /*module_sp*/ nullptr, /*extra_path*/ {}, 
+                /*module_sp*/ nullptr, /*extra_path*/ {},
                 target->shared_from_this());
             if (!did_load)
               return false;
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp
index 8d9655a07e..63655cc5a5 100644
--- a/lldb/source/Interpreter/ScriptInterpreter.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreter.cpp
@@ -48,12 +48,10 @@ StructuredData::DictionarySP ScriptInterpreter::GetInterpreterInfo() {
   return nullptr;
 }
 
-bool ScriptInterpreter::LoadScriptingModule(const char *filename,
-                                            const LoadScriptOptions &options,
-                                            lldb_private::Status &error,
-                                            StructuredData::ObjectSP *module_sp,
-                                            FileSpec extra_search_dir,
-                                            lldb::TargetSP loaded_into_target_sp) {
+bool ScriptInterpreter::LoadScriptingModule(
+    const char *filename, const LoadScriptOptions &options,
+    lldb_private::Status &error, StructuredData::ObjectSP *module_sp,
+    FileSpec extra_search_dir, lldb::TargetSP loaded_into_target_sp) {
   error = Status::FromErrorString(
       "This script interpreter does not support importing modules.");
   return false;
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
index 137d7c5363..504b3aa0a4 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
@@ -215,10 +215,11 @@ public:
                                            const char *session_dictionary_name,
                                            lldb::DebuggerSP debugger);
 
-  static bool LLDBSwigPythonCallModuleNewTarget(const char *python_module_name,
-                                           const char *session_dictionary_name,
-                                           lldb::TargetSP target);
-                                           
+  static bool
+  LLDBSwigPythonCallModuleNewTarget(const char *python_module_name,
+                                    const char *session_dictionary_name,
+                                    lldb::TargetSP target);
+
   static python::PythonObject
   LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
                                const char *session_dictionary_name,
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index b4bde233d3..0ed5e2a655 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2316,8 +2316,7 @@ uint64_t replace_all(std::string &str, const std::string &oldStr,
 bool ScriptInterpreterPythonImpl::LoadScriptingModule(
     const char *pathname, const LoadScriptOptions &options,
     lldb_private::Status &error, StructuredData::ObjectSP *module_sp,
-    FileSpec extra_search_dir,
-    lldb::TargetSP target_sp) {
+    FileSpec extra_search_dir, lldb::TargetSP target_sp) {
   namespace fs = llvm::sys::fs;
   namespace path = llvm::sys::path;
 
@@ -2499,8 +2498,8 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
   // Finally, if we got a target passed in, then we should tell the new module
   // about this target:
   if (target_sp) {
-    return SWIGBridge::LLDBSwigPythonCallModuleNewTarget(module_name.c_str(),
-        m_dictionary_name.c_str(), target_sp);
+    return SWIGBridge::LLDBSwigPythonCallModuleNewTarget(
+        module_name.c_str(), m_dictionary_name.c_str(), target_sp);
   }
   return true;
 }
diff --git a/lldb/test/API/macosx/dsym_modules/main.c b/lldb/test/API/macosx/dsym_modules/main.c
index df22f570bf..73305edc3a 100644
--- a/lldb/test/API/macosx/dsym_modules/main.c
+++ b/lldb/test/API/macosx/dsym_modules/main.c
@@ -2,14 +2,13 @@
 
 int global_test_var = 10;
 
-int
-main()
-{
+int main() {
   int test_var = 10;
-  printf ("Set a breakpoint here: %d.\n", test_var);
+  printf("Set a breakpoint here: %d.\n", test_var);
   //% test_var = self.frame().FindVariable("test_var")
   //% test_value = test_var.GetValueAsUnsigned()
   //% self.assertSuccess(test_var.GetError(), "Failed to fetch test_var")
-  //% self.assertEqual(test_value, 10, "Failed to get the right value for test_var")
+  //% self.assertEqual(test_value, 10, "Failed to get the right value for
+  //test_var")
   return global_test_var;
 }
diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
index ca42e9e00f..f7b5e3aeef 100644
--- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -233,10 +233,9 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallModuleInit(
 bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallModuleNewTarget(
     const char *python_module_name, const char *session_dictionary_name,
     lldb::TargetSP target) {
-  return false;   
+  return false;
 }
 
-
 python::PythonObject
 lldb_private::python::SWIGBridge::LLDBSWIGPythonCreateOSPlugin(
     const char *python_class_name, const char *session_dictionary_name,

``````````

</details>


https://github.com/llvm/llvm-project/pull/133290


More information about the lldb-commits mailing list