[Lldb-commits] [lldb] [lldb][PlatformDarwin] Reword warning when locating scripting resources from dSYM (PR #185666)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 10 08:15:28 PDT 2026


https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/185666

This patch makes the warning message more concise (in my opinion). We would duplicate the file path multiple times in the message. I'm planning on factoring this logic into a standalone function, and having it rely on fewer parameters helps with that.

Before:
```
warning: the symbol file '/path/to/.dSYM/Contents/Resources/DWARF/import' contains a debug script.
However, its name '/path/to/.dSYM/Contents/Resources/DWARF/../Python/import.py' conflicts with a keyword
and as such cannot be loaded. LLDB will load '/path/to/.dSYM/Contents/Resources/DWARF/../Python/_import.py' instead.
Consider removing the file with the malformed name to eliminate this warning.
```

After:
```
warning: found a debug script '/path/to/.dSYM/Contents/Resources/DWARF/../Python/import.py'.
However, its name conflicts with a keyword and as such cannot be loaded.
LLDB will load '/path/to/.dSYM/Contents/Resources/DWARF/../Python/_import.py' instead.
Consider removing the file with the malformed name to eliminate this warning.
```

Before:
```
warning: the symbol file '/path/to/.dSYM/Contents/Resources/DWARF/import' contains a debug script.
However, its name conflicts with a keyword and as such cannot be loaded.
If you intend to have this script loaded, please rename '/path/to/.dSYM/Contents/Resources/DWARF/../Python/import.py'
to '/path/to/.dSYM/Contents/Resources/DWARF/../Python/_import.py' and retry.
```

After:
```
warning: found a debug script '/path/to/.dSYM/Contents/Resources/DWARF/../Python/import.py'.
However, its name conflicts with a keyword and as such cannot be loaded.
If you intend to have this script loaded, please rename it to /path/to/.dSYM/Contents/Resources/DWARF/../Python/_import.py'
and retry.
```

>From 2cf0f34bb08e6fab6889d030b19034b33371e2ae Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Tue, 10 Mar 2026 12:58:25 +0000
Subject: [PATCH] [lldb][PlatformDarwin] Reword warning when locating scripting
 resources from dSYM

This patch makes the warning message more concise (in my opinion). We would duplicate the file path multiple times in the message. I'm planning on factoring this logic into a standalone function, and having it rely on fewer parameters helps with that.

Before:
```
warning: the symbol file '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-o6d4yrjx/locate-scripts-from-dsym-test-77d136/.dSYM/Contents/Resources/DWARF/import' contains a debug script. However, its name '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-o6d4yrjx/locate-scripts-from-dsym-test-77d136/.dSYM/Contents/Resources/DWARF/../Python/import.py' conflicts with a keyword and as such cannot be loaded. LLDB will load '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-o6d4yrjx/locate-scripts-from-dsym-test-77d136/.dSYM/Contents/Resources/DWARF/../Python/_import.py' instead. Consider removing the file with the malformed name to eliminate this warning.
```

After:
```
warning: found a debug script '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-c2ftoatb/locate-scripts-from-dsym-test-01f130/.dSYM/Contents/Resources/DWARF/../Python/import.py'. However, its name conflicts with a keyword and as such cannot be loaded. LLDB will load '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-c2ftoatb/locate-scripts-from-dsym-test-01f130/.dSYM/Contents/Resources/DWARF/../Python/_import.py' instead. Consider removing the file with the malformed name to eliminate this warning.
```

Before:
```
warning: the symbol file '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-o6d4yrjx/locate-scripts-from-dsym-test-01765f/.dSYM/Contents/Resources/DWARF/import' contains a debug script. However, its name conflicts with a keyword and as such cannot be loaded. If you intend to have this script loaded, please rename '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-o6d4yrjx/locate-scripts-from-dsym-test-01765f/.dSYM/Contents/Resources/DWARF/../Python/import.py' to '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-o6d4yrjx/locate-scripts-from-dsym-test-01765f/.dSYM/Contents/Resources/DWARF/../Python/_import.py' and retry."
```

After:
```
warning: found a debug script '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-c2ftoatb/locate-scripts-from-dsym-test-0766c6/.dSYM/Contents/Resources/DWARF/../Python/import.py'. However, its name conflicts with a keyword and as such cannot be loaded. If you intend to have this script loaded, please rename it to '/var/folders/r8/d92r4cgj32qfg84671c1974h0000gn/T/lit-tmp-c2ftoatb/locate-scripts-from-dsym-test-0766c6/.dSYM/Contents/Resources/DWARF/../Python/_import.py' and retry.
```
---
 .../Platform/MacOSX/PlatformDarwin.cpp        | 25 ++++++++---------
 .../unittests/Platform/PlatformDarwinTest.cpp | 28 +++++++++----------
 2 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index c49bd69618227..ca3abdd88e307 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -251,23 +251,20 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResourcesFromDSYM(
                                              : "contains reserved characters";
       if (FileSystem::Instance().Exists(script_fspec))
         feedback_stream.Format(
-            "warning: the symbol file '{0}' contains a debug "
-            "script. However, its name"
-            " '{1}' {2} and as such cannot be loaded. LLDB will"
-            " load '{3}' instead. Consider removing the file with "
-            "the malformed name to"
-            " eliminate this warning.\n",
-            symfile_spec.GetPath(), original_path_string.GetString(),
-            reason_for_complaint, path_string.GetString());
+            "warning: found a debug script '{0}'. However, its name"
+            " {1} and as such cannot be loaded. LLDB will"
+            " load '{2}' instead. Consider removing the file with"
+            " the malformed name to eliminate this warning.\n",
+            original_path_string.GetString(), reason_for_complaint,
+            path_string.GetString());
       else
         feedback_stream.Format(
-            "warning: the symbol file '{0}' contains a debug "
-            "script. However, its name"
+            "warning: found a debug script '{0}'. However, its name"
             " {1} and as such cannot be loaded. If you intend"
-            " to have this script loaded, please rename '{2}' to "
-            "'{3}' and retry.\n",
-            symfile_spec.GetPath(), reason_for_complaint,
-            original_path_string.GetString(), path_string.GetString());
+            " to have this script loaded, please rename it to "
+            "'{2}' and retry.\n",
+            original_path_string.GetString(), reason_for_complaint,
+            path_string.GetString());
     }
 
     if (FileSystem::Instance().Exists(script_fspec)) {
diff --git a/lldb/unittests/Platform/PlatformDarwinTest.cpp b/lldb/unittests/Platform/PlatformDarwinTest.cpp
index 30a37f7aa2b25..da17aa980df1b 100644
--- a/lldb/unittests/Platform/PlatformDarwinTest.cpp
+++ b/lldb/unittests/Platform/PlatformDarwinTest.cpp
@@ -351,11 +351,11 @@ TEST_F(PlatformDarwinLocateTest,
   std::string fixed_script =
       (m_tmp_dsym_dwarf_dir + "/../Python/_import.py").str();
   std::string expected = llvm::formatv(
-      "warning: the symbol file '{0}' contains a debug script. However, its "
+      "warning: found a debug script '{0}'. However, its "
       "name conflicts with a keyword and as such cannot be loaded. If you "
-      "intend to have this script loaded, please rename '{1}' to '{2}' and "
+      "intend to have this script loaded, please rename it to '{1}' and "
       "retry.\n",
-      dsym_module_fpec.GetPath(), orig_script, fixed_script);
+      orig_script, fixed_script);
   EXPECT_EQ(ss.GetString(), expected);
 }
 
@@ -391,11 +391,11 @@ TEST_F(PlatformDarwinLocateTest,
   std::string fixed_script =
       (m_tmp_dsym_dwarf_dir + "/../Python/_import.py").str();
   std::string expected = llvm::formatv(
-      "warning: the symbol file '{0}' contains a debug script. However, its "
-      "name '{1}' conflicts with a keyword and as such cannot be loaded. LLDB "
-      "will load '{2}' instead. Consider removing the file with the malformed "
+      "warning: found a debug script '{0}'. However, its "
+      "name conflicts with a keyword and as such cannot be loaded. LLDB "
+      "will load '{1}' instead. Consider removing the file with the malformed "
       "name to eliminate this warning.\n",
-      dsym_module_fpec.GetPath(), orig_script, fixed_script);
+      orig_script, fixed_script);
   EXPECT_EQ(ss.GetString(), expected);
 }
 
@@ -458,11 +458,11 @@ TEST_F(
   std::string fixed_script =
       (m_tmp_dsym_dwarf_dir + "/../Python/TestModule_1_1_1.py").str();
   std::string expected = llvm::formatv(
-      "warning: the symbol file '{0}' contains a debug script. However, its "
+      "warning: found a debug script '{0}'. However, its "
       "name contains reserved characters and as such cannot be loaded. If you "
-      "intend to have this script loaded, please rename '{1}' to '{2}' and "
+      "intend to have this script loaded, please rename it to '{1}' and "
       "retry.\n",
-      dsym_module_fpec.GetPath(), orig_script, fixed_script);
+      orig_script, fixed_script);
   EXPECT_EQ(ss.GetString(), expected);
 }
 
@@ -499,11 +499,11 @@ TEST_F(
   std::string fixed_script =
       (m_tmp_dsym_dwarf_dir + "/../Python/TestModule_1_1_1.py").str();
   std::string expected = llvm::formatv(
-      "warning: the symbol file '{0}' contains a debug script. However, its "
-      "name '{1}' contains reserved characters and as such cannot be loaded. "
-      "LLDB will load '{2}' instead. Consider removing the file with the "
+      "warning: found a debug script '{0}'. However, its "
+      "name contains reserved characters and as such cannot be loaded. "
+      "LLDB will load '{1}' instead. Consider removing the file with the "
       "malformed name to eliminate this warning.\n",
-      dsym_module_fpec.GetPath(), orig_script, fixed_script);
+      orig_script, fixed_script);
   EXPECT_EQ(ss.GetString(), expected);
 }
 



More information about the lldb-commits mailing list