[Lldb-commits] [lldb] 6a35ee8 - [lldb] Provide a better error message for missing symbols (#89433)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 19 16:41:33 PDT 2024


Author: Adrian Prantl
Date: 2024-04-19T16:41:07-07:00
New Revision: 6a35ee8077647b32626c3c41f9d9da4dae6670fc

URL: https://github.com/llvm/llvm-project/commit/6a35ee8077647b32626c3c41f9d9da4dae6670fc
DIFF: https://github.com/llvm/llvm-project/commit/6a35ee8077647b32626c3c41f9d9da4dae6670fc.diff

LOG: [lldb] Provide a better error message for missing symbols (#89433)

This adds a hint to the missing symbols error message to make it easier
to understand what this means to users.

[Reapplies an earlier patch with a test fix.]

Added: 
    

Modified: 
    lldb/source/Expression/IRExecutionUnit.cpp
    lldb/test/API/lang/cpp/constructors/TestCppConstructors.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index cb9bee8733e15d..07df8c52a2a4f0 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -431,7 +431,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
     }
 
     m_failed_lookups.clear();
-
+    ss.PutCString(
+        "\nHint: The expression tried to call a function that is not present "
+        "in the target, perhaps because it was optimized out by the compiler.");
     error.SetErrorString(ss.GetString());
 
     return;

diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 6724bfc8ed78e0..baf06e4c59fbba 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -47,7 +47,7 @@ def test_constructors(self):
         self.expect(
             "expr ClassWithDeletedDefaultCtor().value",
             error=True,
-            substrs=["Couldn't look up symbols:"],
+            substrs=["Couldn't look up symbols:", "function", "optimized out"],
         )
 
     @skipIfWindows  # Can't find operator new.


        


More information about the lldb-commits mailing list