[Lldb-commits] [lldb] [lldb][test] Fix D lang mangling test on Windows (PR #94196)

2024-06-03 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett closed 
https://github.com/llvm/llvm-project/pull/94196
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Fix D lang mangling test on Windows (PR #94196)

2024-06-03 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett updated 
https://github.com/llvm/llvm-project/pull/94196

>From f45103937007bbc42fe56dc172fcbee9c37a2f34 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Mon, 3 Jun 2024 09:04:01 +
Subject: [PATCH 1/2] [lldb][test] Fix D lang mangling test on Windows

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

Whereas it does on Linux:
   Function: id = {0x0023}, name = "_Dfunction", range = 
[0x0734-0x0738)
  LineEntry: <...>
 Symbol: id = {0x0058}, range = 
[0x0734-0x0738), 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.
---
 lldb/test/API/lang/c/non-mangled/TestCNonMangled.py | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py 
b/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
index b10a3d6da30a1..78602d1b2a33c 100644
--- a/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
+++ b/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
@@ -13,5 +13,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")

>From 7157428f89a31cbe2bb06849f2578b370352b00c Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Mon, 3 Jun 2024 09:17:27 +
Subject: [PATCH 2/2] Remove Windows skip

---
 lldb/test/API/lang/c/non-mangled/TestCNonMangled.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py 
b/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
index 78602d1b2a33c..6f7ef247b063a 100644
--- a/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
+++ b/lldb/test/API/lang/c/non-mangled/TestCNonMangled.py
@@ -1,10 +1,8 @@
 import lldbsuite.test.lldbutil as lldbutil
 from lldbsuite.test.lldbtest import *
-from lldbsuite.test.decorators import skipIfWindows
 
 
 class TestCase(TestBase):
-@skipIfWindows
 def test_functions_having_dlang_mangling_prefix(self):
 """
 Ensure C functions with a '_D' prefix alone are not mistakenly treated

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Fix D lang mangling test on Windows (PR #94196)

2024-06-03 Thread Michael Buch via lldb-commits

https://github.com/Michael137 approved this pull request.


https://github.com/llvm/llvm-project/pull/94196
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Fix D lang mangling test on Windows (PR #94196)

2024-06-03 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

On Windows the function does not have a symbol associated with it:
   Function: id = {0x01c9}, name = "_Dfunction", range = 
[0x000140001000-0x000140001004)
  LineEntry: ...

Whereas it does on Linux:
   Function: id = {0x0023}, name = "_Dfunction", range = 
[0x0734-0x0738)
  LineEntry: ...
 Symbol: id = {0x0058}, range = 
[0x0734-0x0738), 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
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")

``




https://github.com/llvm/llvm-project/pull/94196
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Fix D lang mangling test on Windows (PR #94196)

2024-06-03 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/94196

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

Whereas it does on Linux:
   Function: id = {0x0023}, name = "_Dfunction", range = 
[0x0734-0x0738)
  LineEntry: <...>
 Symbol: id = {0x0058}, range = 
[0x0734-0x0738), 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.

>From 5a3b6909601f742828d02357998be1c1338613ed Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Mon, 3 Jun 2024 09:04:01 +
Subject: [PATCH] [lldb][test] Fix D lang mangling test on Windows

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

Whereas it does on Linux:
   Function: id = {0x0023}, name = "_Dfunction", range = 
[0x0734-0x0738)
  LineEntry: <...>
 Symbol: id = {0x0058}, range = 
[0x0734-0x0738), 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.
---
 lldb/test/API/lang/c/non-mangled/TestCNonMangled.py | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

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")

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits