Skip to content

[lldb] Provide a better error message for missing symbols #89433

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

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

adrian-prantl
Copy link
Collaborator

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

@llvmbot
Copy link
Member

llvmbot commented Apr 19, 2024

@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/89433.diff

2 Files Affected:

  • (modified) lldb/source/Expression/IRExecutionUnit.cpp (+3-1)
  • (modified) lldb/test/API/lang/cpp/constructors/TestCppConstructors.py (+2-1)
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index cb9bee8733e15d..8d4e5aaf9fe7ea 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 missing from 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..d73b2af1ca077c 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -47,7 +47,8 @@ def test_constructors(self):
         self.expect(
             "expr ClassWithDeletedDefaultCtor().value",
             error=True,
-            substrs=["Couldn't look up symbols:"],
+            substrs=["Couldn't look up symbols:",
+                     "function missing"],
         )
 
     @skipIfWindows  # Can't find operator new.

@adrian-prantl adrian-prantl requested a review from jimingham April 19, 2024 18:25
Copy link

github-actions bot commented Apr 19, 2024

✅ With the latest revision this PR passed the Python code formatter.

Copy link
Contributor

@felipepiovezan felipepiovezan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM!
I like the wording in the sense that it uses a slightly less "systemy" language, and so it becomes less cryptic to a wider audience.

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT with the formatting fixed.

This adds a hint to the missing symbols error message to make it
easier to understand what this means to users.
@adrian-prantl adrian-prantl force-pushed the missing-symbols-error branch from d57f2ad to 162907c Compare April 19, 2024 20:07
@adrian-prantl adrian-prantl merged commit 08163cd into llvm:main Apr 19, 2024
adrian-prantl added a commit that referenced this pull request Apr 19, 2024
…9433)"

This reverts commit 08163cd.

I accidentally broke the test while addressing review feedback.
adrian-prantl added a commit that referenced this pull request Apr 19, 2024
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.]
adrian-prantl added a commit to adrian-prantl/llvm-project that referenced this pull request Apr 19, 2024
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.]

(cherry picked from commit 6a35ee8)
aniplcc pushed a commit to aniplcc/llvm-project that referenced this pull request Apr 21, 2024
This adds a hint to the missing symbols error message to make it easier
to understand what this means to users.
aniplcc pushed a commit to aniplcc/llvm-project that referenced this pull request Apr 21, 2024
…vm#89433)"

This reverts commit 08163cd.

I accidentally broke the test while addressing review feedback.
aniplcc pushed a commit to aniplcc/llvm-project that referenced this pull request Apr 21, 2024
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.]
adrian-prantl added a commit to swiftlang/llvm-project that referenced this pull request Apr 22, 2024
…-6.0-lldb-Provide-a-better-error-message-for-missing-symbols-89433

[Cherry-pick into swift/release/6.0] [lldb] Provide a better error message for missing symbols (llvm#89433)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants