Skip to content

[lldb][test] Fix D lang mangling test on Windows #94196

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 2 commits into from
Jun 3, 2024

Conversation

DavidSpickett
Copy link
Collaborator

On Windows the function does not have a symbol associated with it:
Function: id = {0x000001c9}, name = "_Dfunction", range = [0x0000000140001000-0x0000000140001004)
LineEntry: <...>

Whereas it does on Linux:
Function: id = {0x00000023}, name = "_Dfunction", range = [0x0000000000000734-0x0000000000000738)
LineEntry: <...>
Symbol: id = {0x00000058}, range = [0x0000000000000734-0x0000000000000738), name="_Dfunction"

This means that frame.symbol is not valid on Windows.

However, frame.function is valid and it also has a "mangled" attribute.

So I've updated the test to check the symbol if we've got it, and the function always.

In both cases we check that mangled is empty (meaning it has not been treated as mangled) and that the display name matches the original symbol name.

@DavidSpickett DavidSpickett requested review from kastiglione and removed request for JDevlieghere June 3, 2024 09:08
@llvmbot llvmbot added the lldb label Jun 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 3, 2024

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

Changes

On Windows the function does not have a symbol associated with it:
Function: id = {0x000001c9}, name = "_Dfunction", range = [0x0000000140001000-0x0000000140001004)
LineEntry: <...>

Whereas it does on Linux:
Function: id = {0x00000023}, name = "_Dfunction", range = [0x0000000000000734-0x0000000000000738)
LineEntry: <...>
Symbol: id = {0x00000058}, range = [0x0000000000000734-0x0000000000000738), name="_Dfunction"

This means that frame.symbol is not valid on Windows.

However, frame.function is valid and it also has a "mangled" attribute.

So I've updated the test to check the symbol if we've got it, and the function always.

In both cases we check that mangled is empty (meaning it has not been treated as mangled) and that the display name matches the original symbol name.


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

1 Files Affected:

  • (modified) lldb/test/API/lang/c/non-mangled/TestCNonMangled.py (+11-2)
diff --git a/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py b/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
index c35d8a9bb9163..c16a1185acb97 100644
--- a/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
+++ b/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
@@ -12,5 +12,14 @@ def test_functions_having_dlang_mangling_prefix(self):
         """
         self.build()
         _, _, thread, _ = lldbutil.run_to_name_breakpoint(self, "_Dfunction")
-        symbol = thread.frame[0].symbol
-        self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
+        frame = thread.frame[0]
+
+        symbol = frame.symbol
+        # On Windows the function does not have an associated symbol.
+        if symbol.IsValid():
+            self.assertFalse(symbol.mangled)
+            self.assertEqual(symbol.GetDisplayName(), "_Dfunction")
+
+        function = frame.function
+        self.assertFalse(function.mangled)
+        self.assertEqual(function.GetDisplayName(), "_Dfunction")

On Windows the function does not have a symbol associated with it:
       Function: id = {0x000001c9}, name = "_Dfunction", range = [0x0000000140001000-0x0000000140001004)
      LineEntry: <...>

Whereas it does on Linux:
       Function: id = {0x00000023}, name = "_Dfunction", range = [0x0000000000000734-0x0000000000000738)
      LineEntry: <...>
         Symbol: id = {0x00000058}, range = [0x0000000000000734-0x0000000000000738), name="_Dfunction"

This means that frame.symbol is not valid on Windows.

However, frame.function is valid and it also has a "mangled" attribute.

So I've updated the test to check the symbol if we've got it, and the
function always.

In both cases we check that mangled is empty (meaning it has not been
treated as mangled) and that the display name matches the original
symbol name.
@DavidSpickett DavidSpickett merged commit 6abf361 into llvm:main Jun 3, 2024
5 checks passed
@DavidSpickett DavidSpickett deleted the dlang branch June 3, 2024 09:18
weliveindetail pushed a commit to weliveindetail/llvm-project that referenced this pull request Oct 10, 2024
On Windows the function does not have a symbol associated with it:
Function: id = {0x000001c9}, name = "_Dfunction", range =
[0x0000000140001000-0x0000000140001004)
      LineEntry: <...>

Whereas it does on Linux:
Function: id = {0x00000023}, name = "_Dfunction", range =
[0x0000000000000734-0x0000000000000738)
      LineEntry: <...>
Symbol: id = {0x00000058}, range =
[0x0000000000000734-0x0000000000000738), name="_Dfunction"

This means that frame.symbol is not valid on Windows.

However, frame.function is valid and it also has a "mangled" attribute.

So I've updated the test to check the symbol if we've got it, and the
function always.

In both cases we check that mangled is empty (meaning it has not been
treated as mangled) and that the display name matches the original
symbol name.
weliveindetail pushed a commit to weliveindetail/llvm-project that referenced this pull request Oct 16, 2024
On Windows the function does not have a symbol associated with it:
Function: id = {0x000001c9}, name = "_Dfunction", range =
[0x0000000140001000-0x0000000140001004)
      LineEntry: <...>

Whereas it does on Linux:
Function: id = {0x00000023}, name = "_Dfunction", range =
[0x0000000000000734-0x0000000000000738)
      LineEntry: <...>
Symbol: id = {0x00000058}, range =
[0x0000000000000734-0x0000000000000738), name="_Dfunction"

This means that frame.symbol is not valid on Windows.

However, frame.function is valid and it also has a "mangled" attribute.

So I've updated the test to check the symbol if we've got it, and the
function always.

In both cases we check that mangled is empty (meaning it has not been
treated as mangled) and that the display name matches the original
symbol name.
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.

3 participants