[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-10 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-10 Thread Dmitry Vasilyev via lldb-commits


@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)

slydiman wrote:

I just checked the documentation for assertGreater() trying to figure out the 
purpose of round() usage in the original code. But it does not matter anymore, 
since the patch has been significantly refactored.

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-10 Thread Dmitry Vasilyev via lldb-commits


@@ -115,9 +151,10 @@ def test_launch_notifications(self):
 # binaries in batches.  Check that we got back more than 1 solib per 
event.
 # In practice on Darwin today, we get back two events for a do-nothing 
c
 # program: a.out and dyld, and then all the rest of the system 
libraries.
-# On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
-
-avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+# On Linux we get events for ld.so, [vdso], the binary and then all 
libraries,
+# but the different configurations could load a different number of 
.so modules
+# per event.
+self.assertGreaterEqual(
+len(set(max_solib_chunk_per_event).intersection(expected_solibs)),
+len(expected_solibs),

slydiman wrote:

Done.

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-10 Thread Dmitry Vasilyev via lldb-commits


@@ -1,3 +1,23 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules
+CXX_SOURCES := main.cpp
+LD_EXTRAS := -L. -lloadunload_d -lloadunload_c -lloadunload_a -lloadunload_b

slydiman wrote:

Done.

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-10 Thread Dmitry Vasilyev via lldb-commits


@@ -0,0 +1,7 @@
+extern "C" int b_function();
+
+int a_init() { return 234; }
+
+int a_global = a_init();

slydiman wrote:

Done.

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-10 Thread Dmitry Vasilyev via lldb-commits


@@ -9,22 +9,51 @@
 from lldbsuite.test import lldbutil
 
 
+@skipUnlessPlatform(["linux"] + lldbplatformutil.getDarwinOSTriples())
 class ModuleLoadedNotifysTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
 # At least DynamicLoaderDarwin and DynamicLoaderPOSIXDYLD should batch up
 # notifications about newly added/removed libraries.  Other DynamicLoaders 
may
 # not be written this way.
-@skipUnlessPlatform(["linux"] + lldbplatformutil.getDarwinOSTriples())
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
 # Find the line number to break inside main().
 self.line = line_number("main.cpp", "// breakpoint")
 
+def setup_test(self, solibs):
+if lldb.remote_platform:
+path = lldb.remote_platform.GetWorkingDirectory()
+for f in solibs:
+lldbutil.install_to_target(self, self.getBuildArtifact(f))
+else:
+path = self.getBuildDir()
+if self.dylibPath in os.environ:
+sep = self.platformContext.shlib_path_separator
+path = os.environ[self.dylibPath] + sep + path
+self.runCmd(
+"settings append target.env-vars '{}={}'".format(self.dylibPath, 
path)
+)
+self.default_path = path
+
 def test_launch_notifications(self):
 """Test that lldb broadcasts newly loaded libraries in batches."""
+
+ext = "so"
+if self.platformIsDarwin():
+ext = "dylib"

slydiman wrote:

Done.

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-10 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/94672

>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH 1/4] [lldb] Fix TestModuleLoadedNotifys API test to work
 correctly on most of Linux targets.

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.
---
 .../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index abf761fb3420b..28a1026ae4fcc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
 )
-self.assertGreater(avg_solibs_added_per_event, 1)
+self.assertGreater(avg_solibs_added_per_event, 10)

>From 0518bff0710a8f4404847e1cd28c6bcdbbb00093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 7 Jun 2024 12:36:44 +0400
Subject: [PATCH 2/4] Keep the `avg_solibs_added_per_event` name correct.

---
 .../TestModuleLoadedNotifys.py  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index 28a1026ae4fcc..ef407abce59fc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -117,7 +117,7 @@ def test_launch_notifications(self):
 # program: a.out and dyld, and then all the rest of the system 
libraries.
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
-avg_solibs_added_per_event = round(
-10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
+avg_solibs_added_per_event = float(total_solibs_added) / float(
+total_modules_added_events
 )
-self.assertGreater(avg_solibs_added_per_event, 10)
+self.assertGreater(round(10.0 * avg_solibs_added_per_event), 10)

>From 60671ecc918692bba6d937bc7590eae55fd20514 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 8 Jun 2024 12:53:06 +0400
Subject: [PATCH 3/4] Added own so modules.

---
 .../target-new-solib-notifications/Makefile   | 26 +++--
 .../TestModuleLoadedNotifys.py| 53 ---
 .../target-new-solib-notifications/a.cpp  |  7 +++
 .../target-new-solib-notifications/b.cpp  |  5 ++
 .../target-new-solib-notifications/c.cpp  |  1 +
 .../target-new-solib-notifications/d.cpp  |  5 ++
 .../target-new-solib-notifications/main.cpp   | 22 +---
 7 files changed, 102 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/d.cpp

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile 
b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
index 8b20bcb05..50169c0ae1b80 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
@@ -1,3 +1,23 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules
+CXX_SOURCES := main.cpp
+LD_EXTRAS := -L. -lloadunload_d -lloadunload_c -lloadunload_a -lloadunload_b
+
+a.out: lib_b lib_a lib_c lib_d
+
+include Makefile.rules
+
+lib_a: lib_b
+   

[Lldb-commits] [lldb] [lldb] Gracefully down TestCoroutineHandle test in case the 'coroutine' feature is missing (PR #94903)

2024-06-10 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Gracefully down TestCoroutineHandle test in case the 'coroutine' feature is missing (PR #94903)

2024-06-09 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/94903

>From 6e988bcbbd4310a09c6baa553b4cf55998e92034 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sun, 9 Jun 2024 18:33:03 +0400
Subject: [PATCH] [lldb] Gracefully down TestCoroutineHandle test in case the
 'coroutine' feature is missing

Do not let the compiler gets failed in case the target platform does not 
support the 'coroutine' C++ features. Just compile without it and let lldb know 
about missed/unsupported feature.
---
 .../generic/coroutine_handle/Makefile |  8 ++
 .../generic/coroutine_handle/main.cpp | 27 ---
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/Makefile
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/Makefile
index 6914024392cfd..3e5da0ecae669 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/Makefile
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/Makefile
@@ -1,4 +1,12 @@
 CXX_SOURCES := main.cpp
 CFLAGS_EXTRAS := -std=c++20
 
+ifeq "1" "$(USE_LIBSTDCPP)"
+  CFLAGS_EXTRAS += -DUSE_LIBSTDCPP
+endif
+
+ifeq "1" "$(USE_LIBCPP)"
+  CFLAGS_EXTRAS += -DUSE_LIBCPP
+endif
+
 include Makefile.rules
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
index 8cb81c3bc9f4c..aaf76e0d8d99a 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
@@ -1,13 +1,27 @@
+#if defined(USE_LIBSTDCPP)
+#include 
+// glibc++ >= 11 and c++20
+#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 11
 #include 
+#define HAS_CPP_COROUTINES 1
+#endif
+#endif
+
+// libc++ always has 'coroutine' feature.
+#if defined(USE_LIBCPP)
+#include 
+#define HAS_CPP_COROUTINES 1
+#endif
 
 bool is_implementation_supported() {
-#ifdef _GLIBCXX_RELEASE
-  return _GLIBCXX_RELEASE >= 11;
-#else
+#ifdef HAS_CPP_COROUTINES
   return true;
+#else
+  return false;
 #endif
 }
 
+#ifdef HAS_CPP_COROUTINES
 // `int_generator` is a stripped down, minimal coroutine generator
 // type.
 struct int_generator {
@@ -39,8 +53,11 @@ int_generator my_generator_func() { co_yield 42; }
 // a place to reliably set a breakpoint on.
 void empty_function_so_we_can_set_a_breakpoint() {}
 
+#endif // HAS_CPP_COROUTINES
+
 int main() {
   bool is_supported = is_implementation_supported();
+#ifdef HAS_CPP_COROUTINES
   int_generator gen = my_generator_func();
   std::coroutine_handle<> type_erased_hdl = gen.hdl;
   std::coroutine_handle incorrectly_typed_hdl =
@@ -48,4 +65,8 @@ int main() {
   gen.hdl.resume();// Break at initial_suspend
   gen.hdl.resume();// Break after co_yield
   empty_function_so_we_can_set_a_breakpoint(); // Break at final_suspend
+  return 0;
+#else
+  return 0; // Break at initial_suspend
+#endif // HAS_CPP_COROUTINES
 }

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


[Lldb-commits] [lldb] [lldb] Gracefully down TestCoroutineHandle test in case the 'coroutine' feature is missing (PR #94903)

2024-06-09 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/94903

Do not let the compiler gets failed in case the target platform does not 
support the 'coroutine' C++ features. Just compile without it and let lldb know 
about missed/unsupported feature.

>From b0a1c4152ebbca95f5560562c9f5605b505d353c Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sun, 9 Jun 2024 18:33:03 +0400
Subject: [PATCH] [lldb] Gracefully down TestCoroutineHandle test in case the
 'coroutine' feature is missing

Do not let the compiler gets failed in case the target platform does not 
support the 'coroutine' C++ features. Just compile without it and let lldb know 
about missed/unsupported feature.
---
 .../generic/coroutine_handle/Makefile |  8 +++
 .../generic/coroutine_handle/main.cpp | 24 ---
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/Makefile
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/Makefile
index 6914024392cfd..3e5da0ecae669 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/Makefile
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/Makefile
@@ -1,4 +1,12 @@
 CXX_SOURCES := main.cpp
 CFLAGS_EXTRAS := -std=c++20
 
+ifeq "1" "$(USE_LIBSTDCPP)"
+  CFLAGS_EXTRAS += -DUSE_LIBSTDCPP
+endif
+
+ifeq "1" "$(USE_LIBCPP)"
+  CFLAGS_EXTRAS += -DUSE_LIBCPP
+endif
+
 include Makefile.rules
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
index 8cb81c3bc9f4c..ab1bea7597cfe 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/main.cpp
@@ -1,13 +1,27 @@
+#if defined(USE_LIBSTDCPP)
+#include 
+// glibc++ >= 11 and c++20
+#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 11
 #include 
+#define HAS_CPP_COROUTINES 1
+#endif
+#endif
+
+// libc++ always has 'coroutine' feature.
+#if defined(USE_LIBCPP)
+#include 
+#define HAS_CPP_COROUTINES 1
+#endif
 
 bool is_implementation_supported() {
-#ifdef _GLIBCXX_RELEASE
-  return _GLIBCXX_RELEASE >= 11;
-#else
+#ifdef HAS_CPP_COROUTINES
   return true;
+#else
+  return false;
 #endif
 }
 
+#ifdef HAS_CPP_COROUTINES
 // `int_generator` is a stripped down, minimal coroutine generator
 // type.
 struct int_generator {
@@ -39,8 +53,11 @@ int_generator my_generator_func() { co_yield 42; }
 // a place to reliably set a breakpoint on.
 void empty_function_so_we_can_set_a_breakpoint() {}
 
+#endif // HAS_CPP_COROUTINES
+
 int main() {
   bool is_supported = is_implementation_supported();
+#ifdef HAS_CPP_COROUTINES
   int_generator gen = my_generator_func();
   std::coroutine_handle<> type_erased_hdl = gen.hdl;
   std::coroutine_handle incorrectly_typed_hdl =
@@ -48,4 +65,5 @@ int main() {
   gen.hdl.resume();// Break at initial_suspend
   gen.hdl.resume();// Break after co_yield
   empty_function_so_we_can_set_a_breakpoint(); // Break at final_suspend
+#endif // HAS_CPP_COROUTINES
 }

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-08 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/94672

>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH 1/3] [lldb] Fix TestModuleLoadedNotifys API test to work
 correctly on most of Linux targets.

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.
---
 .../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index abf761fb3420b..28a1026ae4fcc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
 )
-self.assertGreater(avg_solibs_added_per_event, 1)
+self.assertGreater(avg_solibs_added_per_event, 10)

>From 0518bff0710a8f4404847e1cd28c6bcdbbb00093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 7 Jun 2024 12:36:44 +0400
Subject: [PATCH 2/3] Keep the `avg_solibs_added_per_event` name correct.

---
 .../TestModuleLoadedNotifys.py  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index 28a1026ae4fcc..ef407abce59fc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -117,7 +117,7 @@ def test_launch_notifications(self):
 # program: a.out and dyld, and then all the rest of the system 
libraries.
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
-avg_solibs_added_per_event = round(
-10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
+avg_solibs_added_per_event = float(total_solibs_added) / float(
+total_modules_added_events
 )
-self.assertGreater(avg_solibs_added_per_event, 10)
+self.assertGreater(round(10.0 * avg_solibs_added_per_event), 10)

>From 60671ecc918692bba6d937bc7590eae55fd20514 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 8 Jun 2024 12:53:06 +0400
Subject: [PATCH 3/3] Added own so modules.

---
 .../target-new-solib-notifications/Makefile   | 26 +++--
 .../TestModuleLoadedNotifys.py| 53 ---
 .../target-new-solib-notifications/a.cpp  |  7 +++
 .../target-new-solib-notifications/b.cpp  |  5 ++
 .../target-new-solib-notifications/c.cpp  |  1 +
 .../target-new-solib-notifications/d.cpp  |  5 ++
 .../target-new-solib-notifications/main.cpp   | 22 +---
 7 files changed, 102 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/d.cpp

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile 
b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
index 8b20bcb05..50169c0ae1b80 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
@@ -1,3 +1,23 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules
+CXX_SOURCES := main.cpp
+LD_EXTRAS := -L. -lloadunload_d -lloadunload_c -lloadunload_a -lloadunload_b
+
+a.out: lib_b lib_a lib_c lib_d
+
+include Makefile.rules
+
+lib_a: lib_b
+   

[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-08 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/94672

>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH 1/3] [lldb] Fix TestModuleLoadedNotifys API test to work
 correctly on most of Linux targets.

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.
---
 .../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index abf761fb3420b..28a1026ae4fcc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
 )
-self.assertGreater(avg_solibs_added_per_event, 1)
+self.assertGreater(avg_solibs_added_per_event, 10)

>From 0518bff0710a8f4404847e1cd28c6bcdbbb00093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 7 Jun 2024 12:36:44 +0400
Subject: [PATCH 2/3] Keep the `avg_solibs_added_per_event` name correct.

---
 .../TestModuleLoadedNotifys.py  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index 28a1026ae4fcc..ef407abce59fc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -117,7 +117,7 @@ def test_launch_notifications(self):
 # program: a.out and dyld, and then all the rest of the system 
libraries.
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
-avg_solibs_added_per_event = round(
-10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
+avg_solibs_added_per_event = float(total_solibs_added) / float(
+total_modules_added_events
 )
-self.assertGreater(avg_solibs_added_per_event, 10)
+self.assertGreater(round(10.0 * avg_solibs_added_per_event), 10)

>From d7832a1181613caeb68c597db17680c3c6008de8 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 8 Jun 2024 12:53:06 +0400
Subject: [PATCH 3/3] Added own so modules.

---
 .../target-new-solib-notifications/Makefile   | 26 +++--
 .../TestModuleLoadedNotifys.py| 53 ---
 .../target-new-solib-notifications/a.cpp  |  7 +++
 .../target-new-solib-notifications/b.cpp  |  5 ++
 .../target-new-solib-notifications/c.cpp  |  1 +
 .../target-new-solib-notifications/d.cpp  |  5 ++
 .../target-new-solib-notifications/main.cpp   | 22 +---
 7 files changed, 102 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/d.cpp

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile 
b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
index 8b20bcb05..50169c0ae1b80 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
@@ -1,3 +1,23 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules
+CXX_SOURCES := main.cpp
+LD_EXTRAS := -L. -lloadunload_d -lloadunload_c -lloadunload_a -lloadunload_b
+
+a.out: lib_b lib_a lib_c lib_d
+
+include Makefile.rules
+
+lib_a: lib_b
+   

[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-08 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/94672

>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH 1/3] [lldb] Fix TestModuleLoadedNotifys API test to work
 correctly on most of Linux targets.

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.
---
 .../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index abf761fb3420b..28a1026ae4fcc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
 )
-self.assertGreater(avg_solibs_added_per_event, 1)
+self.assertGreater(avg_solibs_added_per_event, 10)

>From 0518bff0710a8f4404847e1cd28c6bcdbbb00093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 7 Jun 2024 12:36:44 +0400
Subject: [PATCH 2/3] Keep the `avg_solibs_added_per_event` name correct.

---
 .../TestModuleLoadedNotifys.py  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index 28a1026ae4fcc..ef407abce59fc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -117,7 +117,7 @@ def test_launch_notifications(self):
 # program: a.out and dyld, and then all the rest of the system 
libraries.
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
-avg_solibs_added_per_event = round(
-10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
+avg_solibs_added_per_event = float(total_solibs_added) / float(
+total_modules_added_events
 )
-self.assertGreater(avg_solibs_added_per_event, 10)
+self.assertGreater(round(10.0 * avg_solibs_added_per_event), 10)

>From 0aec72ad777be192d0dd0fc0aba5a52fd0767ada Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 8 Jun 2024 12:53:06 +0400
Subject: [PATCH 3/3] Added own so modules.

---
 .../target-new-solib-notifications/Makefile   | 26 +++--
 .../TestModuleLoadedNotifys.py| 53 ---
 .../target-new-solib-notifications/a.cpp  | 14 +
 .../target-new-solib-notifications/b.cpp  |  9 
 .../target-new-solib-notifications/c.cpp  |  5 ++
 .../target-new-solib-notifications/d.cpp  | 10 
 .../target-new-solib-notifications/main.cpp   | 23 +---
 7 files changed, 123 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/d.cpp

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile 
b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
index 8b20bcb05..50169c0ae1b80 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
@@ -1,3 +1,23 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules
+CXX_SOURCES := main.cpp
+LD_EXTRAS := -L. -lloadunload_d -lloadunload_c -lloadunload_a -lloadunload_b
+
+a.out: lib_b lib_a lib_c lib_d
+
+include Makefile.rules
+
+lib_a: lib_b
+  

[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-08 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/94672

>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH 1/3] [lldb] Fix TestModuleLoadedNotifys API test to work
 correctly on most of Linux targets.

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.
---
 .../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index abf761fb3420b..28a1026ae4fcc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
 )
-self.assertGreater(avg_solibs_added_per_event, 1)
+self.assertGreater(avg_solibs_added_per_event, 10)

>From 0518bff0710a8f4404847e1cd28c6bcdbbb00093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 7 Jun 2024 12:36:44 +0400
Subject: [PATCH 2/3] Keep the `avg_solibs_added_per_event` name correct.

---
 .../TestModuleLoadedNotifys.py  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index 28a1026ae4fcc..ef407abce59fc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -117,7 +117,7 @@ def test_launch_notifications(self):
 # program: a.out and dyld, and then all the rest of the system 
libraries.
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
-avg_solibs_added_per_event = round(
-10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
+avg_solibs_added_per_event = float(total_solibs_added) / float(
+total_modules_added_events
 )
-self.assertGreater(avg_solibs_added_per_event, 10)
+self.assertGreater(round(10.0 * avg_solibs_added_per_event), 10)

>From 2e2b3087be5763e73136b391f6b666067dea036c Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 8 Jun 2024 12:53:06 +0400
Subject: [PATCH 3/3] Added own so modules.

---
 .../target-new-solib-notifications/Makefile   | 26 +++--
 .../TestModuleLoadedNotifys.py| 53 ---
 .../target-new-solib-notifications/a.cpp  | 14 +
 .../target-new-solib-notifications/b.cpp  |  9 
 .../target-new-solib-notifications/c.cpp  |  5 ++
 .../target-new-solib-notifications/d.cpp  | 10 
 .../target-new-solib-notifications/main.cpp   | 23 +---
 7 files changed, 123 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/d.cpp

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile 
b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
index 8b20bcb05..50169c0ae1b80 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
@@ -1,3 +1,23 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules
+CXX_SOURCES := main.cpp
+LD_EXTRAS := -L. -lloadunload_d -lloadunload_c -lloadunload_a -lloadunload_b
+
+a.out: lib_b lib_a lib_c lib_d
+
+include Makefile.rules
+
+lib_a: lib_b
+  

[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-08 Thread Dmitry Vasilyev via lldb-commits


@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)

slydiman wrote:

@labath 
> So, another way to make this test be more resilient is to introduce a couple 
> of shared libraries of our own

The patch is updated this way. Please review. Thanks.

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-08 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/94672

>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH 1/3] [lldb] Fix TestModuleLoadedNotifys API test to work
 correctly on most of Linux targets.

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.
---
 .../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index abf761fb3420b..28a1026ae4fcc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
 )
-self.assertGreater(avg_solibs_added_per_event, 1)
+self.assertGreater(avg_solibs_added_per_event, 10)

>From 0518bff0710a8f4404847e1cd28c6bcdbbb00093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 7 Jun 2024 12:36:44 +0400
Subject: [PATCH 2/3] Keep the `avg_solibs_added_per_event` name correct.

---
 .../TestModuleLoadedNotifys.py  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index 28a1026ae4fcc..ef407abce59fc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -117,7 +117,7 @@ def test_launch_notifications(self):
 # program: a.out and dyld, and then all the rest of the system 
libraries.
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
-avg_solibs_added_per_event = round(
-10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
+avg_solibs_added_per_event = float(total_solibs_added) / float(
+total_modules_added_events
 )
-self.assertGreater(avg_solibs_added_per_event, 10)
+self.assertGreater(round(10.0 * avg_solibs_added_per_event), 10)

>From 6fb19a05a6a4fb4463035bcd35a53fc51e446a05 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 8 Jun 2024 12:53:06 +0400
Subject: [PATCH 3/3] Added own so modules.

---
 .../target-new-solib-notifications/Makefile   | 26 +++--
 .../TestModuleLoadedNotifys.py| 53 ---
 .../target-new-solib-notifications/a.cpp  | 14 +
 .../target-new-solib-notifications/b.cpp  |  9 
 .../target-new-solib-notifications/c.cpp  |  5 ++
 .../target-new-solib-notifications/d.cpp  | 10 
 .../target-new-solib-notifications/main.cpp   | 24 ++---
 7 files changed, 124 insertions(+), 17 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
 create mode 100644 
lldb/test/API/functionalities/target-new-solib-notifications/d.cpp

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile 
b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
index 8b20bcb05..50169c0ae1b80 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/Makefile
@@ -1,3 +1,23 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules
+CXX_SOURCES := main.cpp
+LD_EXTRAS := -L. -lloadunload_d -lloadunload_c -lloadunload_a -lloadunload_b
+
+a.out: lib_b lib_a lib_c lib_d
+
+include Makefile.rules
+
+lib_a: lib_b
+ 

[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-07 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-07 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/94672

>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH 1/2] [lldb] Fix TestModuleLoadedNotifys API test to work
 correctly on most of Linux targets.

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.
---
 .../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index abf761fb3420b..28a1026ae4fcc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
 )
-self.assertGreater(avg_solibs_added_per_event, 1)
+self.assertGreater(avg_solibs_added_per_event, 10)

>From 0518bff0710a8f4404847e1cd28c6bcdbbb00093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 7 Jun 2024 12:36:44 +0400
Subject: [PATCH 2/2] Keep the `avg_solibs_added_per_event` name correct.

---
 .../TestModuleLoadedNotifys.py  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index 28a1026ae4fcc..ef407abce59fc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -117,7 +117,7 @@ def test_launch_notifications(self):
 # program: a.out and dyld, and then all the rest of the system 
libraries.
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
-avg_solibs_added_per_event = round(
-10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
+avg_solibs_added_per_event = float(total_solibs_added) / float(
+total_modules_added_events
 )
-self.assertGreater(avg_solibs_added_per_event, 10)
+self.assertGreater(round(10.0 * avg_solibs_added_per_event), 10)

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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-07 Thread Dmitry Vasilyev via lldb-commits


@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)

slydiman wrote:

> You can't really call it "number of libraries per event" anymore if you 
> multiply by ten.

avg10_solibs_added_per_event ?

> Maybe you could just remove the round call, and compare to 1.0 

No, because assertGreater() expects int parameters.

> Also, this test is very unhermetic

Right, and it seems that the behavior on Darwin is very different. I'd just 
check `min_modules_per_event >= 1`.


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


[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

2024-06-06 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/94672

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more). As example, Linux x86_64 host shows the 
following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.

>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH] [lldb] Fix TestModuleLoadedNotifys API test to work correctly
 on most of Linux targets.

The different build configuration and target Linux system can load a different 
number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75

But Linux Aarch64 (remote target) with statically linked C++ library (clang) 
shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25

Increase precision by 1 digit to fix the test.
---
 .../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index abf761fb3420b..28a1026ae4fcc 100644
--- 
a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ 
b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
 # On Linux we get events for ld.so, [vdso], the binary and then all 
libraries.
 
 avg_solibs_added_per_event = round(
-float(total_solibs_added) / float(total_modules_added_events)
+10.0 * float(total_solibs_added) / 
float(total_modules_added_events)
 )
-self.assertGreater(avg_solibs_added_per_event, 1)
+self.assertGreater(avg_solibs_added_per_event, 10)

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


[Lldb-commits] [lldb] [lldb] Disable TestPtyServer API test when remote testing (PR #94587)

2024-06-06 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/94587

The local PTY is not available for the remotely executed lldb-server to pass 
the test. Also, in general, we cannot execute the local lldb-server instance 
because it could be compiled for the different system/cpu target.

>From 9288b9a59290a4ded37928f2f553f4c334ebacad Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 6 Jun 2024 11:32:13 +0400
Subject: [PATCH] [lldb] Disable TestPtyServer API test when remote testing

The local PTY is not available for the remotely executed lldb-server to pass 
the test. Also, in general, we cannot execute the local lldb-server instance 
because it could be compiled for the different system/cpu target.
---
 lldb/test/API/tools/lldb-server/TestPtyServer.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/test/API/tools/lldb-server/TestPtyServer.py 
b/lldb/test/API/tools/lldb-server/TestPtyServer.py
index 4bfcf70bfa01b..345f68f6d87d3 100644
--- a/lldb/test/API/tools/lldb-server/TestPtyServer.py
+++ b/lldb/test/API/tools/lldb-server/TestPtyServer.py
@@ -7,6 +7,7 @@
 import xml.etree.ElementTree as ET
 
 
+@skipIfRemote
 @skipIf(hostoslist=["windows"])
 class PtyServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):
 def setUp(self):

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


[Lldb-commits] [lldb] [lldb] Fixed TestEchoCommands.test running on a remote target (PR #94127)

2024-06-03 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Disable find-module.test in case of a remote target (PR #94165)

2024-06-03 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed TestEchoCommands.test running on a remote target (PR #94127)

2024-06-03 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

Note `EchoCommandsQuiet.out` expects that `TestEchoCommands.test.tmp.file` will 
be 
```
start
done
```
But in case of a remote target it will be something like
```
start
  Platform: remote-linux
 Connected: no
  Platform: remote-linux
Triple: aarch64-unknown-linux-gnu
OS Version: 5.10.192 (5.10.192-tegra)
  Hostname: jetson-orin-1795
 Connected: yes
WorkingDir: /home/ubuntu
Kernel: #1 SMP PREEMPT Mon Feb 19 20:19:53 PST 2024
done
```

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


[Lldb-commits] [lldb] [lldb] Fixed TestEchoCommands.test running on a remote target (PR #94127)

2024-06-03 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

> How can I configure my build to run this sort of thing?

The simplest way is to use the same arch target, e. g. x86_64 Linux host and 
x86_64 Linux target. You do not need a cross compiler in this case. To run 
Shell tests with a remote target it is necesasry 
- define LLVM_TARGET_TRIPLE=x86_64-unknown-linux-gnu 
- define LLDB_PLATFORM_URL=connect://:1234
- run lldv-server on the target `sudo //lldb-server p --listen '*:1234' 
--server --log-channels 'lldb all' --min-gdbserver-port 1240 
--max-gdbserver-port 1250`
- run `cmake --build . --target check-lldb-shell` from a build dir

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


[Lldb-commits] [lldb] [lldb] Fixed TestEchoCommands.test running on a remote target (PR #94127)

2024-06-03 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

> we support running (all?) shell tests on a remote system?

We have configured buildbots with Windows x86_64, Linux x86_64 hosts and Linux 
Aarch64 targets. Currently we got 2 failed Shell tests on Windows host and 2 
failed test on Linux hosts. This test failed on both hosts. 

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


[Lldb-commits] [lldb] [lldb] Disable find-module.test in case of a remote target (PR #94165)

2024-06-02 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/94165

The target arch is `i386-pc-windows` after loading the dump. It updates to 
`i386-pc-windows-msvc` or `i386-pc-windows-gnu` in 
lldb\source\Plugins\Process\minidump\ProcessMinidump.cpp, line 218
```
GetTarget().MergeArchitecture(module->GetArchitecture());
```
But in case of the remote target (`remote-linux`) and the `Windows host` lldb 
executed the following commands at the beginning
```
platform select remote-linux
platform connect connect://:
```
and then the target arch is `i386-pc-windows-msvc` immediately after loading 
the dump. GetTarget().MergeArchitecture(module->GetArchitecture()) does not 
update it to `i386-pc-windows-gnu` when the module arch is 
`i386-pc-windows-gnu`.

>From f2064da30ae1d4dae4f04587e97ee0fdc82eb734 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sun, 2 Jun 2024 21:38:12 +0400
Subject: [PATCH] [lldb] Disable find-module.test in case of a remote target

The target arch is `i386-pc-windows` after loading the dump. It updates to 
`i386-pc-windows-msvc` or `i386-pc-windows-gnu` in 
lldb\source\Plugins\Process\minidump\ProcessMinidump.cpp, line 218
```
GetTarget().MergeArchitecture(module->GetArchitecture());
```
But in case of the remote target (`remote-linux`) and the `Windows host` lldb 
executed the following commands at the beginning
```
platform select remote-linux
platform connect connect://:
```
and then the target arch is `i386-pc-windows-msvc` immediately after loading 
the dump.
GetTarget().MergeArchitecture(module->GetArchitecture()) does not update it to 
`i386-pc-windows-gnu` when the module arch is `i386-pc-windows-gnu`.
---
 lldb/test/Shell/Minidump/Windows/find-module.test | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lldb/test/Shell/Minidump/Windows/find-module.test 
b/lldb/test/Shell/Minidump/Windows/find-module.test
index 7ac2f74f8039b..b3a7ec36520f0 100644
--- a/lldb/test/Shell/Minidump/Windows/find-module.test
+++ b/lldb/test/Shell/Minidump/Windows/find-module.test
@@ -1,6 +1,8 @@
 Test that we correctly find a PE/COFF file in our executable search path, and
 use it when opening minidumps.
 
+UNSUPPORTED: remote{{.*}}
+
 RUN: yaml2obj %S/Inputs/find-module.exe.yaml -o %T/find-module.exe
 RUN: yaml2obj %S/Inputs/find-module.dmp.yaml -o %T/find-module.dmp
 RUN: %lldb -O "settings set target.exec-search-paths %T" \

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


[Lldb-commits] [lldb] [lldb] Fixed TestEchoCommands.test running on a remote target (PR #94127)

2024-06-01 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/94127

EchoCommandsQuiet.out failed in case of a remote target because the platform 
selection and connection messages.

>From f27a61721ed817a4be73c78485b842c2dcb93e18 Mon Sep 17 00:00:00 2001
From: Dmitry Vassiliev 
Date: Sun, 2 Jun 2024 02:15:02 +0400
Subject: [PATCH] [lldb] Fixed TestEchoCommands.test running on a remote target

EchoCommandsQuiet.out failed in case of a remote target because the platform 
selection and connection messages.
---
 lldb/test/Shell/Settings/TestEchoCommands.test | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lldb/test/Shell/Settings/TestEchoCommands.test 
b/lldb/test/Shell/Settings/TestEchoCommands.test
index 234b9742bfa2a..ce78f91e1cbd4 100644
--- a/lldb/test/Shell/Settings/TestEchoCommands.test
+++ b/lldb/test/Shell/Settings/TestEchoCommands.test
@@ -2,6 +2,8 @@
 # RUN: %lldb -x -b -o 'settings set interpreter.echo-comment-commands false' 
-s %S/Inputs/EchoCommandsTest.in | FileCheck 
%S/Inputs/EchoCommandsNoComments.out
 # RUN: %lldb -x -b -o 'settings set interpreter.echo-commands false' 
-s %S/Inputs/EchoCommandsTest.in | FileCheck %S/Inputs/EchoCommandsNone.out
 
+XFAIL: remote{{.*}}
+
 RUN: echo start >%t.file
 RUN: %lldb -x -b --source-quietly -s %S/Inputs/EchoCommandsTest.in >>%t.file
 RUN: echo done >>%t.file

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


[Lldb-commits] [lldb] [lldb] Fixed the TestGdbRemotePlatformFile test running on a remote target (PR #93832)

2024-05-30 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test running on a remote target (PR #93829)

2024-05-30 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestGdbRemoteLibrariesSvr4Support test running on a remote target (PR #93825)

2024-05-30 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestGdbRemotePlatformFile test running on a remote target (PR #93832)

2024-05-30 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/93832

Skip checking of few stat fields like st_dev (ID of device containing file) in 
case of a remote target.

>From 31ad2c39b2c5ff31ac1a0109cf91a7e59e66ca26 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 30 May 2024 18:44:19 +0400
Subject: [PATCH] [lldb] Fixed the TestGdbRemotePlatformFile test running on a
 remote target

Skip checking of few stat fields like st_dev (ID of device containing file) in 
case of a remote target.
---
 .../lldb-server/TestGdbRemotePlatformFile.py  | 25 ---
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py 
b/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
index 2e1c72ee56d7a..76b0b204123dd 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py
@@ -308,19 +308,26 @@ def test_platform_file_fstat(self):
 )
 sys_stat = os.fstat(temp_file.fileno())
 
-self.assertEqual(gdb_stat.st_dev, uint32_or_zero(sys_stat.st_dev))
-self.assertEqual(gdb_stat.st_ino, uint32_or_zero(sys_stat.st_ino))
 self.assertEqual(gdb_stat.st_mode, uint32_trunc(sys_stat.st_mode))
 self.assertEqual(gdb_stat.st_nlink, 
uint32_or_max(sys_stat.st_nlink))
-self.assertEqual(gdb_stat.st_uid, uint32_or_zero(sys_stat.st_uid))
-self.assertEqual(gdb_stat.st_gid, uint32_or_zero(sys_stat.st_gid))
 self.assertEqual(gdb_stat.st_rdev, 
uint32_or_zero(sys_stat.st_rdev))
 self.assertEqual(gdb_stat.st_size, sys_stat.st_size)
-self.assertEqual(gdb_stat.st_blksize, sys_stat.st_blksize)
-self.assertEqual(gdb_stat.st_blocks, sys_stat.st_blocks)
-self.assertEqual(gdb_stat.st_atime, 
uint32_or_zero(int(sys_stat.st_atime)))
-self.assertEqual(gdb_stat.st_mtime, 
uint32_or_zero(int(sys_stat.st_mtime)))
-self.assertEqual(gdb_stat.st_ctime, 
uint32_or_zero(int(sys_stat.st_ctime)))
+if not lldb.remote_platform:
+self.assertEqual(gdb_stat.st_dev, 
uint32_or_zero(sys_stat.st_dev))
+self.assertEqual(gdb_stat.st_ino, 
uint32_or_zero(sys_stat.st_ino))
+self.assertEqual(gdb_stat.st_uid, 
uint32_or_zero(sys_stat.st_uid))
+self.assertEqual(gdb_stat.st_gid, 
uint32_or_zero(sys_stat.st_gid))
+self.assertEqual(gdb_stat.st_blksize, sys_stat.st_blksize)
+self.assertEqual(gdb_stat.st_blocks, sys_stat.st_blocks)
+self.assertEqual(
+gdb_stat.st_atime, uint32_or_zero(int(sys_stat.st_atime))
+)
+self.assertEqual(
+gdb_stat.st_mtime, uint32_or_zero(int(sys_stat.st_mtime))
+)
+self.assertEqual(
+gdb_stat.st_ctime, uint32_or_zero(int(sys_stat.st_ctime))
+)
 
 self.reset_test_sequence()
 self.test_sequence.add_log_lines(

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test running on a remote target (PR #93829)

2024-05-30 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/93829

Recently we have disabled this test for Windows host and Linux target. Now we 
faced the same issue #92419 in case of Linux x86_64 host and Linux Aarch64 
target.

>From f932af998824b633e91460c6b03d66014ecca799 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 30 May 2024 18:33:19 +0400
Subject: [PATCH] [lldb] Fixed the TestDebuggerAPI test running on a remote
 target

Recently we have disabled this test for Windows host and Linux target. Now we 
faced the same issue #92419 in case of Linux x86_64 host and Linux Aarch64 
target.
---
 lldb/test/API/python_api/debugger/TestDebuggerAPI.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py 
b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
index a007a87ca93e9..646ccce36530d 100644
--- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
+++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
@@ -92,7 +92,6 @@ def get_cache_line_size():
 self.assertEqual(get_cache_line_size(), new_cache_line_size)
 
 @expectedFailureAll(
-hostoslist=["windows"],
 remote=True,
 bugnumber="github.com/llvm/llvm-project/issues/92419",
 )

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


[Lldb-commits] [lldb] [lldb] Fixed the TestGdbRemoteLibrariesSvr4Support test running on a remote target (PR #93825)

2024-05-30 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/93825

The TestGdbRemoteLibrariesSvr4Support test failed in case of Linux x86_64 host 
and Linux Aarch64 target. Installing libraries to the remote target is not 
enough. This test actively uses self.getBuildDir() and os.path.realpath() which 
does not work in case of the remote target. So, disable this test for remote 
target now.

>From 559ccdabf96071c5d9f066ebd67424713c8e1b7a Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 30 May 2024 18:04:13 +0400
Subject: [PATCH] [lldb] Fixed the TestGdbRemoteLibrariesSvr4Support test
 running on a remote target

The TestGdbRemoteLibrariesSvr4Support test failed in case of Linux x86_64 host 
and Linux Aarch64 target.
Installing libraries to the remote target is not enough. This test actively 
uses self.getBuildDir() and os.path.realpath() which does not work in case of 
the remote target. So, disable this test for remote target now.
---
 .../libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
 
b/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
index 02c9d318525fb..76173a095da93 100644
--- 
a/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
+++ 
b/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
@@ -6,6 +6,7 @@
 
 # Windows does not allow quotes in file names.
 @skipIf(hostoslist=["windows"])
+@skipIfRemote
 class 
TestGdbRemoteLibrariesSvr4Support(gdbremote_testcase.GdbRemoteTestCaseBase):
 FEATURE_NAME = "qXfer:libraries-svr4:read"
 

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


[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)

2024-05-27 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/93345

>From 8701bfc715168168ca04d86f134ef362d5e89173 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 25 May 2024 00:39:05 +0400
Subject: [PATCH] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the
 Windows host

Do not denormalize the path. This patch fixes #93092.

BTW, it would be great to be able to pass the style or triple to SBFileSpec. 
Currently it is impossible to create a posix FileSpec on the Windows host.
---
 lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp 
b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index b4f1b76c39dbe..588b19dac6165 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -678,8 +678,8 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process 
*process,
 loaded_image->Clear();
 
   std::string path;
-  path = remote_file.GetPath();
-  
+  path = remote_file.GetPath(false);
+
   ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread();
   if (!thread_sp) {
 error.SetErrorString("dlopen error: no thread available to call dlopen.");

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


[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test on the Linux AArch64 target (PR #93345)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/93345

>From 76a35a6ca5302aef5033d5ae297667e416921d7d Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 25 May 2024 00:39:05 +0400
Subject: [PATCH] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the
 Windows host

Do not denormalize the path. This patch fixes #93092.

BTW, it would be great to be able to pass the style or triple to SBFileSpec. 
Currently it is impossible to create a posix FileSpec on the Windows host.
---
 lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp 
b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index b4f1b76c39dbe..edad606e2e105 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -678,7 +678,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process 
*process,
 loaded_image->Clear();
 
   std::string path;
-  path = remote_file.GetPath();
+  path = remote_file.GetPath(false);
   
   ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread();
   if (!thread_sp) {

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


[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test on the Linux AArch64 target (PR #93345)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/93345

PlatformPOSIX::DoLoadImage() failed on the Linux AArch64 target. It is related 
to the issue #93092. Disable the TestCompletion.test_process_unload test for 
now.

>From 3dcd6665052b1090cb5365732a92aef0b7fa0915 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sat, 25 May 2024 00:39:05 +0400
Subject: [PATCH] [lldb] Fixed the TestCompletion test on the Linux AArch64
 target

PlatformPOSIX::DoLoadImage() failed on the Linux AArch64 target. It is related 
to the issue #93092. Disable the TestCompletion.test_process_unload test for 
now.
---
 lldb/test/API/functionalities/completion/TestCompletion.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py 
b/lldb/test/API/functionalities/completion/TestCompletion.py
index 15aeaf8d0e897..eadb510a3df26 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -97,6 +97,9 @@ def test_process_load(self):
 self.complete_from_to("process load Makef", "process load Makefile")
 
 @skipUnlessPlatform(["linux"])
+@expectedFailureAll(
+archs=["aarch64"], 
bugnumber="github.com/llvm/llvm-project/issues/93092"
+)
 def test_process_unload(self):
 """Test the completion for "process unload " """
 # This tab completion should not work without a running process.

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (PR #90580)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDAP_repl_mode_detection test in case of a remote target (PR #93165)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

Replaced by #93169.

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDAP_repl_mode_detection test in case of a remote target (PR #93165)

2024-05-24 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Automatically skip lldb-dap tests for remote platforms (PR #93169)

2024-05-23 Thread Dmitry Vasilyev via lldb-commits

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

LGTM, thanks!

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDAP_repl_mode_detection test in case of a remote target (PR #93165)

2024-05-23 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/93165

This test is based on dap_server which runs locally. This test failed in case 
of Windows host and Linux target.

>From 2243749477714852ada7a00bb849514283655464 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 23 May 2024 14:21:23 +0400
Subject: [PATCH] [lldb] Fixed the TestDAP_repl_mode_detection test in case of
 a remote target

This test is based on dap_server which runs locally. This test failed in case 
of Windows host and Linux target.
---
 .../API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py 
b/lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py
index 7c77fc8541b93..705ae13e349dc 100644
--- a/lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py
+++ b/lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py
@@ -18,6 +18,7 @@ def assertEvaluate(self, expression, regex):
 regex,
 )
 
+@skipIfRemote
 def test_completions(self):
 program = self.getBuildArtifact("a.out")
 self.build_and_launch(program)

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


[Lldb-commits] [lldb] [lldb] Fixed the TestExitDuringExpression test in case of a remote target (PR #93119)

2024-05-23 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the TestBreakpointCommand test (PR #93122)

2024-05-23 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the TestBreakpointCommand test (PR #93122)

2024-05-22 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/93122

The TestBreakpointCommand test is incorrectly disabled for Windows target. We 
can disable it for Windows host instead or just fix the issue. This patch fixes 
the path separator in BreakpointResolverFileLine::DeduceSourceMapping() and the 
Windows specific absolute path in the test in case of the Windows host.

>From 4220b6d0dcc32e26a6916608ad2b2cf873bee212 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 23 May 2024 05:30:39 +0400
Subject: [PATCH] [lldb] Fixed the TestBreakpointCommand test

The TestBreakpointCommand test is incorrectly disabled for Windows target. We 
can disable it for Windows host instead or just fix the issue. This patch fixes 
the path separator in BreakpointResolverFileLine::DeduceSourceMapping() and the 
Windows specific absolute path in the test in case of the Windows host.
---
 .../Breakpoint/BreakpointResolverFileLine.cpp  | 10 +-
 .../TestBreakpointCommand.py   | 18 +-
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp 
b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index d7d8c714867e3..16c4ee1b88d16 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -198,16 +198,16 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
 return;
 
   Log *log = GetLog(LLDBLog::Breakpoints);
-  const llvm::StringRef path_separator = llvm::sys::path::get_separator(
-  m_location_spec.GetFileSpec().GetPathStyle());
   // Check if "b" is a suffix of "a".
   // And return std::nullopt if not or the new path
   // of "a" after consuming "b" from the back.
   auto check_suffix =
-  [path_separator](llvm::StringRef a, llvm::StringRef b,
-   bool case_sensitive) -> std::optional {
+  [](llvm::StringRef a, llvm::StringRef b,
+ bool case_sensitive) -> std::optional {
 if (case_sensitive ? a.consume_back(b) : a.consume_back_insensitive(b)) {
-  if (a.empty() || a.ends_with(path_separator)) {
+  // Note sc_file_dir and request_file_dir below are normalized
+  // and always contain the path separator '/'.
+  if (a.empty() || a.ends_with("/")) {
 return a;
   }
 }
diff --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index c219a4ee5bd9c..605561c757372 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -6,7 +6,7 @@
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
+from lldbsuite.test import lldbutil, lldbplatformutil
 import json
 import os
 import side_effect
@@ -581,7 +581,6 @@ def verify_source_map_deduce_statistics(self, target, 
expected_count):
 self.assertNotEqual(target_stats, None)
 self.assertEqual(target_stats["sourceMapDeduceCount"], expected_count)
 
-@skipIf(oslist=["windows"])
 @no_debug_info_test
 def test_breakpoints_auto_source_map_relative(self):
 """
@@ -612,8 +611,13 @@ def test_breakpoints_auto_source_map_relative(self):
 self.verify_source_map_deduce_statistics(target, 0)
 
 # Verify auto deduced source map when file path in debug info
-# is a suffix of request breakpoint file path
-path = "/x/y/a/b/c/main.cpp"
+# is a suffix of request breakpoint file path.
+# Note the path must be absolute.
+path = (
+"/x/y/a/b/c/main.cpp"
+if lldbplatformutil.getHostPlatform() != "windows"
+else r"C:\x\y\a\b\c\main.cpp"
+)
 bp = target.BreakpointCreateByLocation(path, 2)
 self.assertGreater(
 bp.GetNumLocations(),
@@ -625,7 +629,11 @@ def test_breakpoints_auto_source_map_relative(self):
 
 source_map_json = self.get_source_map_json()
 self.assertEqual(len(source_map_json), 1, "source map should not be 
empty")
-self.verify_source_map_entry_pair(source_map_json[0], ".", "/x/y")
+self.verify_source_map_entry_pair(
+source_map_json[0],
+".",
+"/x/y" if lldbplatformutil.getHostPlatform() != "windows" else 
r"C:\x\y",
+)
 self.verify_source_map_deduce_statistics(target, 1)
 
 # Reset source map.

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


[Lldb-commits] [lldb] [lldb] Fixed the TestExitDuringExpression test in case of a remote target (PR #93119)

2024-05-22 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/93119

Sometimes this test failed on the assert `The thread exited` in case of a 
remote target. Increase the timeout to 1 second to avoid a racing condition.

>From c51c200295425167d664197bc4c15d02ec91ed09 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 23 May 2024 04:56:26 +0400
Subject: [PATCH] [lldb] Fixed the TestExitDuringExpression test in case of a
 remote target

Sometimes this test failed on the assert `The thread exited` in case of a 
remote target. Increase the timeout to 1 second to avoid a racing condition.
---
 .../API/functionalities/thread/exit_during_expression/main.c| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/API/functionalities/thread/exit_during_expression/main.c 
b/lldb/test/API/functionalities/thread/exit_during_expression/main.c
index eb6d17520986c..f633632e96cc4 100644
--- a/lldb/test/API/functionalities/thread/exit_during_expression/main.c
+++ b/lldb/test/API/functionalities/thread/exit_during_expression/main.c
@@ -3,7 +3,7 @@
 #include 
 #include 
 
-static unsigned int g_timeout = 10;
+static unsigned int g_timeout = 100;
 
 extern int usleep(unsigned int);
 

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (PR #90580)

2024-05-22 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (PR #90580)

2024-05-21 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

We are almost done with configuring the buildbot for cross lldb (Windows x86_64 
host and Linux Aarch64 target). We are trying to get it green with minimal 
local patches.

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


[Lldb-commits] [lldb] [lldb][Windows] Skip the TestDataFormatterLibcxxChrono test to avoid python crash (PR #92575)

2024-05-20 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed LibcxxChronoTimePointSecondsSummaryProvider() (PR #92701)

2024-05-20 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed LibcxxChronoTimePointSecondsSummaryProvider() (PR #92701)

2024-05-19 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/92701

>From 7d455ee2dabe3adc851b0c7989e9cef53eb24e6e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sun, 19 May 2024 21:50:21 +0400
Subject: [PATCH] [lldb][Windows] Fixed
 LibcxxChronoTimePointSecondsSummaryProvider()

This patch fixes #92574. It is a replacement for #92575.
---
 .../Plugins/Language/CPlusPlus/LibCxx.cpp | 11 
 .../chrono/TestDataFormatterLibcxxChrono.py   | 57 ---
 2 files changed, 60 insertions(+), 8 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index e160fd0763939..b0e6fb7d6f5af 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -1098,6 +1098,7 @@ LibcxxChronoTimePointSecondsSummaryProvider(ValueObject 
, Stream ,
   if (!ptr_sp)
 return false;
 
+#ifndef _WIN32
   // The date time in the chrono library is valid in the range
   // [-32767-01-01T00:00:00Z, 32767-12-31T23:59:59Z]. A 64-bit time_t has a
   // larger range, the function strftime is not able to format the entire range
@@ -1107,6 +1108,11 @@ LibcxxChronoTimePointSecondsSummaryProvider(ValueObject 
, Stream ,
   -1'096'193'779'200; // -32767-01-01T00:00:00Z
   const std::time_t chrono_timestamp_max =
   971'890'963'199; // 32767-12-31T23:59:59Z
+#else
+  const std::time_t chrono_timestamp_min = -43'200; // 1969-12-31T12:00:00Z
+  const std::time_t chrono_timestamp_max =
+  32'536'850'399; // 3001-01-19T21:59:59
+#endif
 
   const std::time_t seconds = ptr_sp->GetValueAsSigned(0);
   if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max)
@@ -1148,12 +1154,17 @@ LibcxxChronoTimepointDaysSummaryProvider(ValueObject 
, Stream ,
   if (!ptr_sp)
 return false;
 
+#ifndef _WIN32
   // The date time in the chrono library is valid in the range
   // [-32767-01-01Z, 32767-12-31Z]. A 32-bit time_t has a larger range, the
   // function strftime is not able to format the entire range of time_t. The
   // exact point has not been investigated; it's limited to chrono's range.
   const int chrono_timestamp_min = -12'687'428; // -32767-01-01Z
   const int chrono_timestamp_max = 11'248'737;  // 32767-12-31Z
+#else
+  const int chrono_timestamp_min = 0;   // 1970-01-01Z
+  const int chrono_timestamp_max = 376'583; // 3001-01-19Z
+#endif
 
   const int days = ptr_sp->GetValueAsSigned(0);
   if (days < chrono_timestamp_min || days > chrono_timestamp_max)
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
index fb35481d55514..0737a5bc7e6eb 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
@@ -14,6 +14,7 @@ class LibcxxChronoDataFormatterTestCase(TestBase):
 @skipIf(compiler="clang", compiler_version=["<", "17.0"])
 def test_with_run_command(self):
 """Test that that file and class static variables display correctly."""
+isNotWindowsHost = lldbplatformutil.getHostPlatform() != "windows"
 self.build()
 (self.target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(
 self, "break here", lldb.SBFileSpec("main.cpp", False)
@@ -57,7 +58,11 @@ def test_with_run_command(self):
 self.expect(
 "frame variable ss_neg_date_time",
 substrs=[
-"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z 
timestamp=-1096193779200 s"
+(
+"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z 
timestamp=-1096193779200 s"
+if isNotWindowsHost
+else "ss_neg_date_time = timestamp=-1096193779200 s"
+)
 ],
 )
 self.expect(
@@ -68,7 +73,11 @@ def test_with_run_command(self):
 self.expect(
 "frame variable ss_pos_date_time",
 substrs=[
-"ss_pos_date_time = date/time=32767-12-31T23:59:59Z 
timestamp=971890963199 s"
+(
+"ss_pos_date_time = date/time=32767-12-31T23:59:59Z 
timestamp=971890963199 s"
+if isNotWindowsHost
+else "ss_pos_date_time = timestamp=971890963199 s"
+)
 ],
 )
 self.expect(
@@ -103,7 +112,13 @@ def test_with_run_command(self):
 )
 self.expect(
 "frame variable sd_neg_date",
-substrs=["sd_neg_date = date=-32767-01-01Z timestamp=-12687428 
days"],
+substrs=[
+(
+"sd_neg_date = date=-32767-01-01Z 

[Lldb-commits] [lldb] [lldb][Windows] Skip the TestDataFormatterLibcxxChrono test to avoid python crash (PR #92575)

2024-05-19 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

@Michael137 
> I think we should just fix #92574 since it seems pretty trivial

Please look at #92701.

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed LibcxxChronoTimePointSecondsSummaryProvider() (PR #92701)

2024-05-19 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92701

This patch fixes #92574. It is a replacement for #92575.

>From 2dfbb8663a4661255cd90269b9f527dfac8fb21b Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Sun, 19 May 2024 21:50:21 +0400
Subject: [PATCH] [lldb][Windows] Fixed
 LibcxxChronoTimePointSecondsSummaryProvider()

This patch fixes #92574. It is a replacement for #92575.
---
 .../Plugins/Language/CPlusPlus/LibCxx.cpp | 11 
 .../chrono/TestDataFormatterLibcxxChrono.py   | 57 ---
 2 files changed, 60 insertions(+), 8 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index e160fd0763939..da05ba7b40d32 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -1098,6 +1098,7 @@ LibcxxChronoTimePointSecondsSummaryProvider(ValueObject 
, Stream ,
   if (!ptr_sp)
 return false;
 
+#ifndef _WIN32
   // The date time in the chrono library is valid in the range
   // [-32767-01-01T00:00:00Z, 32767-12-31T23:59:59Z]. A 64-bit time_t has a
   // larger range, the function strftime is not able to format the entire range
@@ -1107,6 +1108,11 @@ LibcxxChronoTimePointSecondsSummaryProvider(ValueObject 
, Stream ,
   -1'096'193'779'200; // -32767-01-01T00:00:00Z
   const std::time_t chrono_timestamp_max =
   971'890'963'199; // 32767-12-31T23:59:59Z
+#else
+  const std::time_t chrono_timestamp_min = -43'200; // 1969-12-31T12:00:00Z
+  const std::time_t chrono_timestamp_max =
+  32'536'850'399; // 3001-01-19T21:59:59
+#endif
 
   const std::time_t seconds = ptr_sp->GetValueAsSigned(0);
   if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max)
@@ -1148,12 +1154,17 @@ LibcxxChronoTimepointDaysSummaryProvider(ValueObject 
, Stream ,
   if (!ptr_sp)
 return false;
 
+#ifndef _WIN32
   // The date time in the chrono library is valid in the range
   // [-32767-01-01Z, 32767-12-31Z]. A 32-bit time_t has a larger range, the
   // function strftime is not able to format the entire range of time_t. The
   // exact point has not been investigated; it's limited to chrono's range.
   const int chrono_timestamp_min = -12'687'428; // -32767-01-01Z
   const int chrono_timestamp_max = 11'248'737;  // 32767-12-31Z
+#else
+  const int chrono_timestamp_min = 0; // 1970-01-01Z
+  const int chrono_timestamp_max = 376'583; // 3001-01-19Z
+#endif
 
   const int days = ptr_sp->GetValueAsSigned(0);
   if (days < chrono_timestamp_min || days > chrono_timestamp_max)
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
index fb35481d55514..0737a5bc7e6eb 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
@@ -14,6 +14,7 @@ class LibcxxChronoDataFormatterTestCase(TestBase):
 @skipIf(compiler="clang", compiler_version=["<", "17.0"])
 def test_with_run_command(self):
 """Test that that file and class static variables display correctly."""
+isNotWindowsHost = lldbplatformutil.getHostPlatform() != "windows"
 self.build()
 (self.target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(
 self, "break here", lldb.SBFileSpec("main.cpp", False)
@@ -57,7 +58,11 @@ def test_with_run_command(self):
 self.expect(
 "frame variable ss_neg_date_time",
 substrs=[
-"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z 
timestamp=-1096193779200 s"
+(
+"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z 
timestamp=-1096193779200 s"
+if isNotWindowsHost
+else "ss_neg_date_time = timestamp=-1096193779200 s"
+)
 ],
 )
 self.expect(
@@ -68,7 +73,11 @@ def test_with_run_command(self):
 self.expect(
 "frame variable ss_pos_date_time",
 substrs=[
-"ss_pos_date_time = date/time=32767-12-31T23:59:59Z 
timestamp=971890963199 s"
+(
+"ss_pos_date_time = date/time=32767-12-31T23:59:59Z 
timestamp=971890963199 s"
+if isNotWindowsHost
+else "ss_pos_date_time = timestamp=971890963199 s"
+)
 ],
 )
 self.expect(
@@ -103,7 +112,13 @@ def test_with_run_command(self):
 )
 self.expect(
 "frame variable sd_neg_date",
-substrs=["sd_neg_date = date=-32767-01-01Z timestamp=-12687428 
days"],
+substrs=[
+(
+

[Lldb-commits] [lldb] [lldb][Windows] Skip the TestDataFormatterLibcxxChrono test to avoid python crash (PR #92575)

2024-05-17 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92575

The python crashed with the exit code 0xC409 (STATUS_STACK_BUFFER_OVERRUN) 
on the command `frame variable ss_neg_seconds` running on Windows x86_64. See 
this issue for details https://github.com/llvm/llvm-project/issues/92574

>From 019dcbd636a4cee19700b8d34279d45ec715b67c Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 17 May 2024 20:46:18 +0400
Subject: [PATCH] [lldb][Windows] Skip the TestDataFormatterLibcxxChrono test
 to avoid python crash

The python crashed with the exit code 0xC409 (STATUS_STACK_BUFFER_OVERRUN) 
on the command `frame variable ss_neg_seconds` running on Windows x86_64. See 
this issue for details https://github.com/llvm/llvm-project/issues/92574
---
 .../libcxx/chrono/TestDataFormatterLibcxxChrono.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
index fb35481d55514..bb7310bc1a8c1 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
@@ -12,6 +12,9 @@
 class LibcxxChronoDataFormatterTestCase(TestBase):
 @add_test_categories(["libc++"])
 @skipIf(compiler="clang", compiler_version=["<", "17.0"])
+@skipIf(
+hostoslist=["windows"], 
bugnumber="github.com/llvm/llvm-project/issues/92574"
+)
 def test_with_run_command(self):
 """Test that that file and class static variables display correctly."""
 self.build()

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


[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)

2024-05-17 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)

2024-05-17 Thread Dmitry Vasilyev via lldb-commits


@@ -52,6 +52,9 @@ def test_attach_with_vAttachWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
+if self._run_args:
+self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])

slydiman wrote:

I have updated the patch. Thanks.

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


[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)

2024-05-17 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/92413

>From d88cc6d992e1f753066aa5dccaa510d8a0a35b94 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 19:18:21 +0400
Subject: [PATCH 1/2] [lldb] Fixed the test TestGdbRemoteAttachWait running on
 a remote target

Install `_exe_to_attach` to a remote target if necessary.
---
 .../lldb-server/attach-wait/TestGdbRemoteAttachWait.py   | 9 +
 1 file changed, 9 insertions(+)

diff --git 
a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py 
b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
index f4c31fe2f5c07..a8333210a72b1 100644
--- a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
+++ b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
@@ -52,6 +52,9 @@ def test_attach_with_vAttachWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
+if self._run_args:
+self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
+
 # Launch the first inferior (we shouldn't attach to this one).
 self._launch_and_wait_for_init()
 
@@ -101,6 +104,9 @@ def test_launch_before_attach_with_vAttachOrWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
+if self._run_args:
+self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
+
 inferior = self._launch_and_wait_for_init()
 
 # Add attach packets.
@@ -141,6 +147,9 @@ def test_launch_after_attach_with_vAttachOrWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
+if self._run_args:
+self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
+
 
self.test_sequence.add_log_lines([self._attach_packet("vAttachOrWait")], True)
 # Run the stream until attachWait.
 context = self.expect_gdbremote_sequence()

>From 1f329275f90c0be3ecf73f3e9e3c816439596116 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Fri, 17 May 2024 16:26:57 +0400
Subject: [PATCH 2/2] Moved install_to_target() to _set_up_inferior().

---
 .../attach-wait/TestGdbRemoteAttachWait.py | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git 
a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py 
b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
index a8333210a72b1..84aab9c969aa4 100644
--- a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
+++ b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
@@ -17,7 +17,10 @@ def _set_up_inferior(self):
 # Use a shim to ensure that the process is ready to be attached 
from
 # the get-go.
 self._exe_to_run = "shim"
-self._run_args = [self.getBuildArtifact(self._exe_to_attach)]
+self._exe_to_attach = lldbutil.install_to_target(
+self, self.getBuildArtifact(self._exe_to_attach)
+)
+self._run_args = [self._exe_to_attach]
 self.build(dictionary={"EXE": self._exe_to_run, "CXX_SOURCES": 
"shim.cpp"})
 else:
 self._exe_to_run = self._exe_to_attach
@@ -52,9 +55,6 @@ def test_attach_with_vAttachWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
-if self._run_args:
-self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
-
 # Launch the first inferior (we shouldn't attach to this one).
 self._launch_and_wait_for_init()
 
@@ -104,9 +104,6 @@ def test_launch_before_attach_with_vAttachOrWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
-if self._run_args:
-self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
-
 inferior = self._launch_and_wait_for_init()
 
 # Add attach packets.
@@ -147,9 +144,6 @@ def test_launch_after_attach_with_vAttachOrWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
-if self._run_args:
-self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
-
 
self.test_sequence.add_log_lines([self._attach_packet("vAttachOrWait")], True)
 # Run the stream until attachWait.
 context = self.expect_gdbremote_sequence()

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


[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (PR #90580)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the DAP tests in case of a remote target (PR #92416)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed unresolved test lldb-api python_api/debugger/TestDebuggerAPI.py on x86_64 host (PR #90580)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

I have added [the issuee](https://github.com/llvm/llvm-project/issues/92419)  
and updated the test with @expectedFailureAll and the bugnumber.

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


[Lldb-commits] [lldb] [lldb] Fixed unresolved test lldb-api python_api/debugger/TestDebuggerAPI.py on x86_64 host (PR #90580)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/90580

>From 0d6ff964ed83e06ed3947d709884ed6dd43e90b5 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Tue, 30 Apr 2024 13:42:45 +0400
Subject: [PATCH 1/2] [lldb][Windows] Fixed unresolved test lldb-api
 python_api/debugger/TestDebuggerAPI.py

It is necessary to select the expected platform at the beginning.
In case of `Windows` host platform1.GetName() returned `host`. 
platform2.GetName() returned `remote-linux`, but 
platform2.GetWorkingDirectory() was None and finally
```
  File "llvm-project\lldb\test\API\python_api\debugger\TestDebuggerAPI.py", 
line 108, in test_CreateTarget_platform
platform2.GetWorkingDirectory().endswith("bar"),
AttributeError: 'NoneType' object has no attribute 'endswith'
```
---
 lldb/test/API/python_api/debugger/TestDebuggerAPI.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py 
b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
index 522de2466012e..3d6484e5c9fbc 100644
--- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
+++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
@@ -95,6 +95,7 @@ def test_CreateTarget_platform(self):
 exe = self.getBuildArtifact("a.out")
 self.yaml2obj("elf.yaml", exe)
 error = lldb.SBError()
+self.dbg.SetSelectedPlatform(lldb.SBPlatform("remote-linux"))
 target1 = self.dbg.CreateTarget(exe, None, "remote-linux", False, 
error)
 self.assertSuccess(error)
 platform1 = target1.GetPlatform()

>From 012d95b3ed4c83c9d439cae1e2b53cbea5dcb441 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 21:25:51 +0400
Subject: [PATCH 2/2] Updated to use @expectedFailureAll with a bugnumber.

---
 lldb/test/API/python_api/debugger/TestDebuggerAPI.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py 
b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
index 3d6484e5c9fbc..55071d6da8f8a 100644
--- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
+++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
@@ -91,11 +91,15 @@ def get_cache_line_size():
 # Test the local property again, is it set to new_cache_line_size?
 self.assertEqual(get_cache_line_size(), new_cache_line_size)
 
+@expectedFailureAll(
+hostoslist=["windows"],
+remote=True,
+bugnumber="github.com/llvm/llvm-project/issues/92419",
+)
 def test_CreateTarget_platform(self):
 exe = self.getBuildArtifact("a.out")
 self.yaml2obj("elf.yaml", exe)
 error = lldb.SBError()
-self.dbg.SetSelectedPlatform(lldb.SBPlatform("remote-linux"))
 target1 = self.dbg.CreateTarget(exe, None, "remote-linux", False, 
error)
 self.assertSuccess(error)
 platform1 = target1.GetPlatform()

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


[Lldb-commits] [lldb] [lldb] Fixed the DAP tests in case of a remote target (PR #92416)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92416

These tests are based on dap_server which runs locally. These tests failed in 
case of Windows host and Linux target.

>From 1760995804d1a37e144fc778fcda7de23903e337 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 19:42:17 +0400
Subject: [PATCH] [lldb] Fixed the DAP tests in case of a remote target

These tests are based on dap_server which runs locally. These tests failed in 
case of Windows host and Linux target.
---
 lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py | 1 +
 lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py 
b/lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py
index 2b3ec656c107a..3250a5093cac4 100644
--- a/lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py
+++ b/lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py
@@ -19,6 +19,7 @@ def verify_completions(self, actual_list, expected_list, 
not_expected_list=[]):
 self.assertNotIn(not_expected_item, actual_list)
 
 @skipIfWindows
+@skipIfRemote
 @skipIf(compiler="clang", compiler_version=["<", "17.0"])
 def test_completions(self):
 """
diff --git a/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py 
b/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py
index 8c2c0154ba65c..58a67d8164368 100644
--- a/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py
+++ b/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py
@@ -9,6 +9,7 @@
 
 
 class TestDAP_exception(lldbdap_testcase.DAPTestCaseBase):
+@skipIfRemote
 @skipIfWindows
 def test_stopped_description(self):
 """

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


[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92413

Install `_exe_to_attach` to a remote target if necessary.

>From d88cc6d992e1f753066aa5dccaa510d8a0a35b94 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 19:18:21 +0400
Subject: [PATCH] [lldb] Fixed the test TestGdbRemoteAttachWait running on a
 remote target

Install `_exe_to_attach` to a remote target if necessary.
---
 .../lldb-server/attach-wait/TestGdbRemoteAttachWait.py   | 9 +
 1 file changed, 9 insertions(+)

diff --git 
a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py 
b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
index f4c31fe2f5c07..a8333210a72b1 100644
--- a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
+++ b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py
@@ -52,6 +52,9 @@ def test_attach_with_vAttachWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
+if self._run_args:
+self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
+
 # Launch the first inferior (we shouldn't attach to this one).
 self._launch_and_wait_for_init()
 
@@ -101,6 +104,9 @@ def test_launch_before_attach_with_vAttachOrWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
+if self._run_args:
+self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
+
 inferior = self._launch_and_wait_for_init()
 
 # Add attach packets.
@@ -141,6 +147,9 @@ def test_launch_after_attach_with_vAttachOrWait(self):
 server = self.connect_to_debug_monitor()
 self.do_handshake()
 
+if self._run_args:
+self._run_args[0] = lldbutil.install_to_target(self, 
self._run_args[0])
+
 
self.test_sequence.add_log_lines([self._attach_packet("vAttachOrWait")], True)
 # Run the stream until attachWait.
 context = self.expect_gdbremote_sequence()

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


[Lldb-commits] [lldb] [lldb] Fixed the DAP tests in case of a remote target (PR #92398)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed an invalid error message in the DAP disconnect response (PR #92345)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the DAP tests in case of a remote target (PR #92398)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92398

These tests failed in case of Windows host and Linux target, because dap_server 
tried to run ELF file on Windows.

>From 74fd3f5b36c5a91a2269bff8261ba494ae6553cc Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 17:23:08 +0400
Subject: [PATCH] [lldb] Fixed the DAP tests in case of a remote target

These tests failed in case of Windows host and Linux target, because dap_server 
tried to run ELF file on Windows.
---
 lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py   | 2 ++
 .../API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py | 1 +
 2 files changed, 3 insertions(+)

diff --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py 
b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
index 226b9385fe719..bfdf9ef2897b2 100644
--- a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
+++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
@@ -7,6 +7,7 @@
 
 
 class TestDAP_commands(lldbdap_testcase.DAPTestCaseBase):
+@skipIfRemote
 def test_command_directive_quiet_on_success(self):
 program = self.getBuildArtifact("a.out")
 command_quiet = (
@@ -60,6 +61,7 @@ def 
test_command_directive_abort_on_error_launch_commands(self):
 def test_command_directive_abort_on_error_pre_run_commands(self):
 self.do_test_abort_on_error(use_pre_run_commands=True)
 
+@skipIfRemote
 def test_command_directive_abort_on_error_post_run_commands(self):
 self.do_test_abort_on_error(use_post_run_commands=True)
 
diff --git 
a/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py 
b/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py
index fd48e69cae5e2..7700c65f862dc 100644
--- a/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py
+++ b/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py
@@ -11,6 +11,7 @@
 
 
 class TestDAP_startDebugging(lldbdap_testcase.DAPTestCaseBase):
+@skipIfRemote
 def test_startDebugging(self):
 """
 Tests the "startDebugging" reverse request. It makes sure that the IDE 
can

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


[Lldb-commits] [lldb] [lldb] Fixed an invalid error message in the DAP disconnect response (PR #92345)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits


@@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object ) {
 g_dap.debugger.SetAsync(false);
 lldb::SBError error = terminateDebuggee ? process.Kill() : 
process.Detach();
 if (!error.Success())
-  response.try_emplace("error", error.GetCString());
+  response.try_emplace("error", std::string(error.GetCString()));

slydiman wrote:

I have updated the patch. Thanks.

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


[Lldb-commits] [lldb] [lldb] Fixed an invalid error message in the DAP disconnect response (PR #92345)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/92345

>From 95336abaa000fa889888ce0f17af8098dfaeb8ea Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 08:09:19 +0400
Subject: [PATCH 1/2] [lldb] Fixed an invalid error message in the DAP
 disconnect response

The `disconnect` response contains the `error` message with invalid characters 
(a junk data).
To reproduce this issue it is enough to run the TestDAP_commands test on 
Windows host and Linux target. The test will fail to run ELF file on Windows 
and dap_server will be disconnected unexpectedly.

Note dap_server hangs if read_packet() cannot decode JSON with invalid 
characters. read_packet() must return None in this case instead of an 
exception. But dap_server does not require any fix after this patch.
---
 lldb/tools/lldb-dap/lldb-dap.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 96da458be21d1..e9810f83678eb 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object ) {
 g_dap.debugger.SetAsync(false);
 lldb::SBError error = terminateDebuggee ? process.Kill() : 
process.Detach();
 if (!error.Success())
-  response.try_emplace("error", error.GetCString());
+  response.try_emplace("error", std::string(error.GetCString()));
 g_dap.debugger.SetAsync(true);
 break;
   }

>From 6528ad5c4e21f5cecaafb7a3b06285936e8dc1b3 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 17:06:58 +0400
Subject: [PATCH 2/2] Replaced with EmplaceSafeString().

---
 lldb/tools/lldb-dap/lldb-dap.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index e9810f83678eb..170fa88f1e8b8 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object ) {
 g_dap.debugger.SetAsync(false);
 lldb::SBError error = terminateDebuggee ? process.Kill() : 
process.Detach();
 if (!error.Success())
-  response.try_emplace("error", std::string(error.GetCString()));
+  EmplaceSafeString(response, "error", error.GetCString());
 g_dap.debugger.SetAsync(true);
 break;
   }

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


[Lldb-commits] [lldb] [lldb] Move TestBase.runCmd() to the Base class (PR #92252)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Windows] Disable the TestGdbRemoteLibrariesSvr4Support test for Windows host (PR #92341)

2024-05-16 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed an invalid error message in the DAP disconnect response (PR #92345)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92345

The `disconnect` response contains the `error` message with invalid characters 
(a junk data). To reproduce this issue it is enough to run the 
`TestDAP_commands` test on Windows host and Linux target. The test will fail to 
run ELF file on Windows and dap_server will be disconnected unexpectedly.

Note dap_server hangs if read_packet() cannot decode JSON with invalid 
characters. read_packet() must return None in this case instead of an 
exception. But dap_server does not require any fix after this patch.

>From 95336abaa000fa889888ce0f17af8098dfaeb8ea Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 08:09:19 +0400
Subject: [PATCH] [lldb] Fixed an invalid error message in the DAP disconnect
 response

The `disconnect` response contains the `error` message with invalid characters 
(a junk data).
To reproduce this issue it is enough to run the TestDAP_commands test on 
Windows host and Linux target. The test will fail to run ELF file on Windows 
and dap_server will be disconnected unexpectedly.

Note dap_server hangs if read_packet() cannot decode JSON with invalid 
characters. read_packet() must return None in this case instead of an 
exception. But dap_server does not require any fix after this patch.
---
 lldb/tools/lldb-dap/lldb-dap.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 96da458be21d1..e9810f83678eb 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object ) {
 g_dap.debugger.SetAsync(false);
 lldb::SBError error = terminateDebuggee ? process.Kill() : 
process.Detach();
 if (!error.Success())
-  response.try_emplace("error", error.GetCString());
+  response.try_emplace("error", std::string(error.GetCString()));
 g_dap.debugger.SetAsync(true);
 break;
   }

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


[Lldb-commits] [lldb] [lldb] Fixed the TestFdLeak test (PR #92273)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Windows] Disable the TestGdbRemoteLibrariesSvr4Support test for Windows host (PR #92341)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92341

Windows does not allow quotes in file names. So it is impossible to build 
`libsvr4lib_b".so` on Windows.

>From d1c9b46114621ca3c739b50a45d4aad9c20a2df1 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 07:37:33 +0400
Subject: [PATCH] [lldb][Windows] Disable the TestGdbRemoteLibrariesSvr4Support
 test for Windows host

Windows does not allow quotes in file names. So it is impossible to build 
`libsvr4lib_b".so` on Windows.
---
 .../libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
 
b/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
index 846adade34402..02c9d318525fb 100644
--- 
a/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
+++ 
b/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
@@ -4,6 +4,8 @@
 from lldbsuite.test.lldbtest import *
 
 
+# Windows does not allow quotes in file names.
+@skipIf(hostoslist=["windows"])
 class 
TestGdbRemoteLibrariesSvr4Support(gdbremote_testcase.GdbRemoteTestCaseBase):
 FEATURE_NAME = "qXfer:libraries-svr4:read"
 

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


[Lldb-commits] [lldb] [lldb] Fixed the TestFdLeak test (PR #92273)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

> Could this use `os.devnull`

Sure. It is much better. I have updated the patch. Thanks.

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


[Lldb-commits] [lldb] [lldb] Fixed the TestFdLeak test (PR #92273)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/92273

>From 6341c038d41ac3b533314568187b8d5d390dc861 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 18:38:16 +0400
Subject: [PATCH 1/2] [lldb] Fixed the TestFdLeak test

Use `NUL` instead of `/dev/null` in case of the Windows host.
---
 lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py 
b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
index e4f5cd3a03f86..e292885ec390d 100644
--- a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
+++ b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
@@ -26,7 +26,10 @@ def test_fd_leak_basic(self):
 @skipIfTargetAndroid()  # Android have some other file descriptors open by 
the shell
 @skipIfDarwinEmbedded  #   # debugserver on ios 
has an extra fd open on launch
 def test_fd_leak_log(self):
-self.do_test(["log enable -f '/dev/null' lldb commands"])
+if lldbplatformutil.getHostPlatform() == "windows":
+self.do_test(["log enable -f 'NUL' lldb commands"])
+else:
+self.do_test(["log enable -f '/dev/null' lldb commands"])
 
 def do_test(self, commands):
 self.build()

>From bace750680865ff5edd0314c3c11418f45f96439 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 16 May 2024 02:10:23 +0400
Subject: [PATCH 2/2] Updated to use os.devnull

---
 lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py 
b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
index e292885ec390d..c840d38df5c76 100644
--- a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
+++ b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
@@ -26,10 +26,7 @@ def test_fd_leak_basic(self):
 @skipIfTargetAndroid()  # Android have some other file descriptors open by 
the shell
 @skipIfDarwinEmbedded  #   # debugserver on ios 
has an extra fd open on launch
 def test_fd_leak_log(self):
-if lldbplatformutil.getHostPlatform() == "windows":
-self.do_test(["log enable -f 'NUL' lldb commands"])
-else:
-self.do_test(["log enable -f '/dev/null' lldb commands"])
+self.do_test(["log enable -f '{}' lldb commands".format(os.devnull)])
 
 def do_test(self, commands):
 self.build()

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the TestIOHandlerResizeNoEditline test (PR #92286)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestNetBSDCore test (PR #92285)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestNetBSDCore test (PR #92285)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits


@@ -147,12 +147,12 @@ def check_stack(self, process, pid, filename):
 self.check_backtrace(thread, filename, backtrace)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64(self):
+def test_aarch64_A(self):

slydiman wrote:

Sure. I have renamed them to suggested names. Thanks.

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


[Lldb-commits] [lldb] [lldb] Fixed the TestNetBSDCore test (PR #92285)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/92285

>From cd181f2b87008ae86c4195a74e9405b8a6e78da2 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 19:39:05 +0400
Subject: [PATCH 1/2] [lldb] Fixed the TestNetBSDCore test

TestNetBSDCore.py contains 3 classes with the same test names test_aarch64 and 
test_amd64. It causes conflicts because the same build dir. Add suffixes to 
avoid conflicts.

The error message on the Windows host running with `-j 2` is the following:
```
PermissionError: [WinError 32] The process cannot access the file because it is 
being used by another process: 
'E:\\projects\\lldb\\build-lldb\\lldb-test-build.noindex\\functionalities\\postmortem\\netbsd-core\\TestNetBSDCore.test_aarch64\\Incomplete.log'
```
---
 .../postmortem/netbsd-core/TestNetBSDCore.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py 
b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
index 756f4d1e81caa..d56b38eb513e9 100644
--- a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
+++ b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
@@ -147,12 +147,12 @@ def check_stack(self, process, pid, filename):
 self.check_backtrace(thread, filename, backtrace)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64(self):
+def test_aarch64_A(self):
 """Test single-threaded aarch64 core dump."""
 self.do_test("1lwp_SIGSEGV.aarch64", pid=8339, region_count=32)
 
 @skipIfLLVMTargetMissing("X86")
-def test_amd64(self):
+def test_amd64_A(self):
 """Test single-threaded amd64 core dump."""
 self.do_test("1lwp_SIGSEGV.amd64", pid=693, region_count=21)
 
@@ -177,12 +177,12 @@ def check_stack(self, process, pid, filename):
 self.assertEqual(thread.GetStopReasonDataAtIndex(0), 0)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64(self):
+def test_aarch64_B(self):
 """Test double-threaded aarch64 core dump where thread 2 is 
signalled."""
 self.do_test("2lwp_t2_SIGSEGV.aarch64", pid=14142, region_count=31)
 
 @skipIfLLVMTargetMissing("X86")
-def test_amd64(self):
+def test_amd64_B(self):
 """Test double-threaded amd64 core dump where thread 2 is signalled."""
 self.do_test("2lwp_t2_SIGSEGV.amd64", pid=622, region_count=24)
 
@@ -207,11 +207,11 @@ def check_stack(self, process, pid, filename):
 self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64(self):
+def test_aarch64_C(self):
 """Test double-threaded aarch64 core dump where process is 
signalled."""
 self.do_test("2lwp_process_SIGSEGV.aarch64", pid=1403, region_count=30)
 
 @skipIfLLVMTargetMissing("X86")
-def test_amd64(self):
+def test_amd64_C(self):
 """Test double-threaded amd64 core dump where process is signalled."""
 self.do_test("2lwp_process_SIGSEGV.amd64", pid=665, region_count=24)

>From 9032144a256cf8ba2838e935dfc3fc79fddff9ce Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 21:00:30 +0400
Subject: [PATCH 2/2] Renamed to more meaningful names.

---
 .../postmortem/netbsd-core/TestNetBSDCore.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py 
b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
index d56b38eb513e9..ff1ef21e02e31 100644
--- a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
+++ b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
@@ -147,12 +147,12 @@ def check_stack(self, process, pid, filename):
 self.check_backtrace(thread, filename, backtrace)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64_A(self):
+def test_aarch64_single_threaded(self):
 """Test single-threaded aarch64 core dump."""
 self.do_test("1lwp_SIGSEGV.aarch64", pid=8339, region_count=32)
 
 @skipIfLLVMTargetMissing("X86")
-def test_amd64_A(self):
+def test_amd64_single_threaded(self):
 """Test single-threaded amd64 core dump."""
 self.do_test("1lwp_SIGSEGV.amd64", pid=693, region_count=21)
 
@@ -177,12 +177,12 @@ def check_stack(self, process, pid, filename):
 self.assertEqual(thread.GetStopReasonDataAtIndex(0), 0)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64_B(self):
+def test_aarch64_thread_signaled(self):
 """Test double-threaded aarch64 core dump where thread 2 is 
signalled."""
 self.do_test("2lwp_t2_SIGSEGV.aarch64", pid=14142, region_count=31)
 
 @skipIfLLVMTargetMissing("X86")
-def test_amd64_B(self):
+def test_amd64_thread_signaled(self):
 """Test 

[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestGdbRemoteCompletion test (PR #92268)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits


@@ -107,9 +107,20 @@ def test_process_unload(self):
 self, "// Break here", lldb.SBFileSpec("main.cpp")
 )
 err = lldb.SBError()
-self.process().LoadImage(
-lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), err
-)
+if lldb.remote_platform:
+self.process().LoadImage(
+lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+lldb.SBFileSpec(
+lldbutil.append_to_process_working_directory(self, 
"libshared.so"),
+False,
+),
+err,
+)
+else:
+self.process().LoadImage(
+lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+err,
+)

slydiman wrote:

I have updated the patch. Thanks.

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


[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/92281

>From f2badfe871dc3d17d4053be1c25f9abdf8d10a0c Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 19:21:25 +0400
Subject: [PATCH 1/2] [lldb] Fixed the TestCompletion test running on a remote
 target

Install the image to the remote target if necessary. Platform::LoadImage() uses 
the following logic before DoLoadImage()
```
if (IsRemote() || local_file != remote_file) {
  error = Install(local_file, remote_file);
  ...
}
```
The FileSpec for the local path may be resolved, so it is necessary to use the 
condition `if lldb.remote_platform:`.
---
 .../completion/TestCompletion.py| 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py 
b/lldb/test/API/functionalities/completion/TestCompletion.py
index 0d6907e0c3d22..9959c7363aa2b 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -107,9 +107,20 @@ def test_process_unload(self):
 self, "// Break here", lldb.SBFileSpec("main.cpp")
 )
 err = lldb.SBError()
-self.process().LoadImage(
-lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), err
-)
+if lldb.remote_platform:
+self.process().LoadImage(
+lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+lldb.SBFileSpec(
+lldbutil.append_to_process_working_directory(self, 
"libshared.so"),
+False,
+),
+err,
+)
+else:
+self.process().LoadImage(
+lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+err,
+)
 self.assertSuccess(err)
 
 self.complete_from_to("process unload ", "process unload 0")

>From 3661437dd9df68210b5f92b03ac53abc65922189 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 20:43:42 +0400
Subject: [PATCH 2/2] Optimized.

---
 .../completion/TestCompletion.py  | 24 ---
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py 
b/lldb/test/API/functionalities/completion/TestCompletion.py
index 9959c7363aa2b..63842487fc338 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -107,20 +107,16 @@ def test_process_unload(self):
 self, "// Break here", lldb.SBFileSpec("main.cpp")
 )
 err = lldb.SBError()
-if lldb.remote_platform:
-self.process().LoadImage(
-lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
-lldb.SBFileSpec(
-lldbutil.append_to_process_working_directory(self, 
"libshared.so"),
-False,
-),
-err,
-)
-else:
-self.process().LoadImage(
-lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
-err,
+local_spec = lldb.SBFileSpec(self.getBuildArtifact("libshared.so"))
+remote_spec = (
+lldb.SBFileSpec(
+lldbutil.append_to_process_working_directory(self, 
"libshared.so"),
+False,
 )
+if lldb.remote_platform
+else lldb.SBFileSpec()
+)
+self.process().LoadImage(local_spec, remote_spec, err)
 self.assertSuccess(err)
 
 self.complete_from_to("process unload ", "process unload 0")
@@ -484,7 +480,7 @@ def test_custom_command_completion(self):
 self.complete_from_to("my_test_cmd main.cp", ["main.cpp"])
 self.expect("my_test_cmd main.cpp", substrs=["main.cpp"])
 
-@skipIfWindows
+@skipIf(hostoslist=["windows"])
 def test_completion_target_create_from_root_dir(self):
 """Tests source file completion by completing ."""
 root_dir = os.path.abspath(os.sep)

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the TestIOHandlerResizeNoEditline test (PR #92286)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92286

This test caused python crash on Windows x86_64 host with the exit code 
0xC409 (STATUS_STACK_BUFFER_OVERRUN). Close the input stream before exit to 
avoid this crash.

>From b6d9b129dc92eea0bd7347ea6ae2a305178dbd46 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 19:47:48 +0400
Subject: [PATCH] [lldb][Windows] Fixed the TestIOHandlerResizeNoEditline test

This test caused python crash on Windows x86_64 host with the exit code 
0xC409 (STATUS_STACK_BUFFER_OVERRUN).
Close the input stream before exit to avoid this crash.
---
 lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py 
b/lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py
index 3c07554f6cafd..bbc2dcbe4e30a 100644
--- a/lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py
+++ b/lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py
@@ -18,3 +18,4 @@ def test_resize_no_editline(self):
 dbg.RunCommandInterpreter(True, True, opts, 0, False, False)
 # Try resizing the terminal which shouldn't crash.
 dbg.SetTerminalWidth(47)
+dbg.GetInputFile().Close()

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


[Lldb-commits] [lldb] [lldb] Fixed the TestNetBSDCore test (PR #92285)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92285

TestNetBSDCore.py contains 3 classes with the same test names test_aarch64 and 
test_amd64. It causes conflicts because the same build dir. Add suffixes to 
avoid conflicts.

The error message on the Windows host running with `-j 2` is the following:
```
PermissionError: [WinError 32] The process cannot access the file because it is 
being used by another process:
'E:\\projects\\lldb\\build-lldb\\lldb-test-build.noindex\\functionalities\\postmortem\\netbsd-core\\TestNetBSDCore.test_aarch64\\Incomplete.log'
```

>From cd181f2b87008ae86c4195a74e9405b8a6e78da2 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 19:39:05 +0400
Subject: [PATCH] [lldb] Fixed the TestNetBSDCore test

TestNetBSDCore.py contains 3 classes with the same test names test_aarch64 and 
test_amd64. It causes conflicts because the same build dir. Add suffixes to 
avoid conflicts.

The error message on the Windows host running with `-j 2` is the following:
```
PermissionError: [WinError 32] The process cannot access the file because it is 
being used by another process: 
'E:\\projects\\lldb\\build-lldb\\lldb-test-build.noindex\\functionalities\\postmortem\\netbsd-core\\TestNetBSDCore.test_aarch64\\Incomplete.log'
```
---
 .../postmortem/netbsd-core/TestNetBSDCore.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py 
b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
index 756f4d1e81caa..d56b38eb513e9 100644
--- a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
+++ b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py
@@ -147,12 +147,12 @@ def check_stack(self, process, pid, filename):
 self.check_backtrace(thread, filename, backtrace)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64(self):
+def test_aarch64_A(self):
 """Test single-threaded aarch64 core dump."""
 self.do_test("1lwp_SIGSEGV.aarch64", pid=8339, region_count=32)
 
 @skipIfLLVMTargetMissing("X86")
-def test_amd64(self):
+def test_amd64_A(self):
 """Test single-threaded amd64 core dump."""
 self.do_test("1lwp_SIGSEGV.amd64", pid=693, region_count=21)
 
@@ -177,12 +177,12 @@ def check_stack(self, process, pid, filename):
 self.assertEqual(thread.GetStopReasonDataAtIndex(0), 0)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64(self):
+def test_aarch64_B(self):
 """Test double-threaded aarch64 core dump where thread 2 is 
signalled."""
 self.do_test("2lwp_t2_SIGSEGV.aarch64", pid=14142, region_count=31)
 
 @skipIfLLVMTargetMissing("X86")
-def test_amd64(self):
+def test_amd64_B(self):
 """Test double-threaded amd64 core dump where thread 2 is signalled."""
 self.do_test("2lwp_t2_SIGSEGV.amd64", pid=622, region_count=24)
 
@@ -207,11 +207,11 @@ def check_stack(self, process, pid, filename):
 self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV)
 
 @skipIfLLVMTargetMissing("AArch64")
-def test_aarch64(self):
+def test_aarch64_C(self):
 """Test double-threaded aarch64 core dump where process is 
signalled."""
 self.do_test("2lwp_process_SIGSEGV.aarch64", pid=1403, region_count=30)
 
 @skipIfLLVMTargetMissing("X86")
-def test_amd64(self):
+def test_amd64_C(self):
 """Test double-threaded amd64 core dump where process is signalled."""
 self.do_test("2lwp_process_SIGSEGV.amd64", pid=665, region_count=24)

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


[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92281

Install the image to the remote target if necessary. Platform::LoadImage() uses 
the following logic before DoLoadImage()
```
if (IsRemote() || local_file != remote_file) {
  error = Install(local_file, remote_file);
  ...
}
```
The FileSpec for the local path may be resolved, so it is necessary to use the 
condition `if lldb.remote_platform:`.

>From f2badfe871dc3d17d4053be1c25f9abdf8d10a0c Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 19:21:25 +0400
Subject: [PATCH] [lldb] Fixed the TestCompletion test running on a remote
 target

Install the image to the remote target if necessary. Platform::LoadImage() uses 
the following logic before DoLoadImage()
```
if (IsRemote() || local_file != remote_file) {
  error = Install(local_file, remote_file);
  ...
}
```
The FileSpec for the local path may be resolved, so it is necessary to use the 
condition `if lldb.remote_platform:`.
---
 .../completion/TestCompletion.py| 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py 
b/lldb/test/API/functionalities/completion/TestCompletion.py
index 0d6907e0c3d22..9959c7363aa2b 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -107,9 +107,20 @@ def test_process_unload(self):
 self, "// Break here", lldb.SBFileSpec("main.cpp")
 )
 err = lldb.SBError()
-self.process().LoadImage(
-lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), err
-)
+if lldb.remote_platform:
+self.process().LoadImage(
+lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+lldb.SBFileSpec(
+lldbutil.append_to_process_working_directory(self, 
"libshared.so"),
+False,
+),
+err,
+)
+else:
+self.process().LoadImage(
+lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+err,
+)
 self.assertSuccess(err)
 
 self.complete_from_to("process unload ", "process unload 0")

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


[Lldb-commits] [lldb] [lldb] Fixed the TestFdLeak test (PR #92273)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92273

Use `NUL` instead of `/dev/null` in case of the Windows host.

>From 6341c038d41ac3b533314568187b8d5d390dc861 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 18:38:16 +0400
Subject: [PATCH] [lldb] Fixed the TestFdLeak test

Use `NUL` instead of `/dev/null` in case of the Windows host.
---
 lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py 
b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
index e4f5cd3a03f86..e292885ec390d 100644
--- a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
+++ b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
@@ -26,7 +26,10 @@ def test_fd_leak_basic(self):
 @skipIfTargetAndroid()  # Android have some other file descriptors open by 
the shell
 @skipIfDarwinEmbedded  #   # debugserver on ios 
has an extra fd open on launch
 def test_fd_leak_log(self):
-self.do_test(["log enable -f '/dev/null' lldb commands"])
+if lldbplatformutil.getHostPlatform() == "windows":
+self.do_test(["log enable -f 'NUL' lldb commands"])
+else:
+self.do_test(["log enable -f '/dev/null' lldb commands"])
 
 def do_test(self, commands):
 self.build()

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


[Lldb-commits] [lldb] [lldb] Fixed the TestGdbRemoteCompletion test (PR #92268)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92268

Do not try to run lldb-server on localhost in case of the remote target.

>From 1b200d1844d0241459fdc11064dc6b61a963e62f Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 18:29:17 +0400
Subject: [PATCH] [lldb] Fixed the TestGdbRemoteCompletion test

Do not try to run lldb-server on localhost in case of the remote target.
---
 lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py 
b/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py
index 04d6abe9d88c1..58373d2f85bb9 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py
@@ -26,6 +26,7 @@ def init_lldb_server(self):
 def generate_hex_path(self, target):
 return str(os.path.join(self.getBuildDir(), target)).encode().hex()
 
+@skipIfRemote
 @add_test_categories(["llgs"])
 def test_autocomplete_path(self):
 self.build()

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

Now we are in the middle of configuring buildbot and trying to get it green. I 
have added [the issues 
92255](https://github.com/llvm/llvm-project/issues/92255). Hope we will fix it 
later. Thanks.

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/92088

>From 7dcfe773b6eef27aabbcc7fc68cd6448bc3c2e88 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Tue, 14 May 2024 13:08:35 +0400
Subject: [PATCH 1/3] [lldb][Windows] Fixed the test
 gdb_remote_client/TestGDBRemotePlatformFile

The tests `test_file_permissions` and `test_file_permissions_fallback` are 
disabled for Windows target. These tests use MockGDBServerResponder and do not 
depend on the real target. These tests failed in case of Windows host and Linux 
target. Disable them for Windows host too.
---
 .../gdb_remote_client/TestGDBRemotePlatformFile.py  | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
index 2be5ae3132038..9ef0954af1fe3 100644
--- 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
+++ 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
@@ -148,6 +148,7 @@ def vFile(self, packet):
 )
 
 @skipIfWindows
+@skipIf(hostoslist=["windows"])
 def test_file_permissions(self):
 """Test 'platform get-permissions'"""
 
@@ -168,6 +169,7 @@ def vFile(self, packet):
 )
 
 @skipIfWindows
+@skipIf(hostoslist=["windows"])
 def test_file_permissions_fallback(self):
 """Test 'platform get-permissions' fallback to fstat"""
 

>From 478d251691d511916cae5fc344d549450222d584 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Tue, 14 May 2024 20:23:56 +0400
Subject: [PATCH 2/3] Removed @skipIfWindows

---
 .../gdb_remote_client/TestGDBRemotePlatformFile.py  | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
index 9ef0954af1fe3..b1c6f0822d1a8 100644
--- 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
+++ 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
@@ -147,7 +147,6 @@ def vFile(self, packet):
 log=server2.responder.packetLog,
 )
 
-@skipIfWindows
 @skipIf(hostoslist=["windows"])
 def test_file_permissions(self):
 """Test 'platform get-permissions'"""
@@ -168,7 +167,6 @@ def vFile(self, packet):
 ]
 )
 
-@skipIfWindows
 @skipIf(hostoslist=["windows"])
 def test_file_permissions_fallback(self):
 """Test 'platform get-permissions' fallback to fstat"""

>From 4f85d2379350306d915a94e0dd67377feb049fdb Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 17:10:26 +0400
Subject: [PATCH 3/3] Replaced @skipIf with @expectedFailureAll and bugnumber

---
 .../gdb_remote_client/TestGDBRemotePlatformFile.py| 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
index b1c6f0822d1a8..c902722a2f74b 100644
--- 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
+++ 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
@@ -147,7 +147,9 @@ def vFile(self, packet):
 log=server2.responder.packetLog,
 )
 
-@skipIf(hostoslist=["windows"])
+@expectedFailureAll(
+hostoslist=["windows"], 
bugnumber="github.com/llvm/llvm-project/issues/92255"
+)
 def test_file_permissions(self):
 """Test 'platform get-permissions'"""
 
@@ -167,7 +169,9 @@ def vFile(self, packet):
 ]
 )
 
-@skipIf(hostoslist=["windows"])
+@expectedFailureAll(
+hostoslist=["windows"], 
bugnumber="github.com/llvm/llvm-project/issues/92255"
+)
 def test_file_permissions_fallback(self):
 """Test 'platform get-permissions' fallback to fstat"""
 

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


[Lldb-commits] [lldb] [lldb] Move TestBase.runCmd() to the Base class (PR #92252)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/92252

runCmd() is called from Base.getCPUInfo() but implemented only in 
TestBase(Base). Usually it works if TestBase is used. But call getCPUInfo() 
from a class based on Base will cause something like
```
File 
"E:\projects\llvm-nino\lldb\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py",
 line 1256, in getCPUInfo
  self.runCmd('platform get-file "/proc/cpuinfo" ' + cpuinfo_path)
AttributeError: 'TestGdbRemoteExpeditedRegisters' object has no attribute 
'runCmd'
```
BTW, TestBase.setUp() called runCmd() before applying LLDB_MAX_LAUNCH_COUNT and 
LLDB_TIME_WAIT_NEXT_LAUNCH.

This patch fixes the test TestGdbRemoteExpeditedRegisters in case of Windows 
host and Linux target.

>From 3df0ffbf3ff66b6ee9419adf288efc2bbdd2c949 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Wed, 15 May 2024 15:54:25 +0400
Subject: [PATCH] [lldb] Move TestBase.runCmd() to the base class Base

runCmd() is called from Base.getCPUInfo() but implemented only in 
TestBase(Base).
Usually it works if TestBase is used. But call getCPUInfo() from a class based 
on Base will cause something like
```
File 
"E:\projects\llvm-nino\lldb\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py",
 line 1256, in getCPUInfo
  self.runCmd('platform get-file "/proc/cpuinfo" ' + cpuinfo_path)
AttributeError: 'TestGdbRemoteExpeditedRegisters' object has no attribute 
'runCmd'
```
BTW, TestBase.setUp() called runCmd() before applying LLDB_MAX_LAUNCH_COUNT and 
LLDB_TIME_WAIT_NEXT_LAUNCH.

This patch fixes the test TestGdbRemoteExpeditedRegisters in case of Windows 
host and Linux target.
---
 .../Python/lldbsuite/test/lldbtest.py | 130 +-
 1 file changed, 65 insertions(+), 65 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 5fd686c143e9f..1ad8ab6e6e462 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -531,6 +531,14 @@ class Base(unittest.TestCase):
 # Keep track of the old current working directory.
 oldcwd = None
 
+# Maximum allowed attempts when launching the inferior process.
+# Can be overridden by the LLDB_MAX_LAUNCH_COUNT environment variable.
+maxLaunchCount = 1
+
+# Time to wait before the next launching attempt in second(s).
+# Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable.
+timeWaitNextLaunch = 1.0
+
 @staticmethod
 def compute_mydir(test_file):
 """Subclasses should call this function to correctly calculate the
@@ -796,6 +804,12 @@ def setUp(self):
 # import traceback
 # traceback.print_stack()
 
+if "LLDB_MAX_LAUNCH_COUNT" in os.environ:
+self.maxLaunchCount = int(os.environ["LLDB_MAX_LAUNCH_COUNT"])
+
+if "LLDB_TIME_WAIT_NEXT_LAUNCH" in os.environ:
+self.timeWaitNextLaunch = 
float(os.environ["LLDB_TIME_WAIT_NEXT_LAUNCH"])
+
 if "LIBCXX_PATH" in os.environ:
 self.libcxxPath = os.environ["LIBCXX_PATH"]
 else:
@@ -937,6 +951,57 @@ def spawnSubprocess(self, executable, args=[], 
extra_env=None, install_remote=Tr
 self.subprocesses.append(proc)
 return proc
 
+def runCmd(self, cmd, msg=None, check=True, trace=False, inHistory=False):
+"""
+Ask the command interpreter to handle the command and then check its
+return status.
+"""
+# Fail fast if 'cmd' is not meaningful.
+if cmd is None:
+raise Exception("Bad 'cmd' parameter encountered")
+
+trace = True if traceAlways else trace
+
+if cmd.startswith("target create "):
+cmd = cmd.replace("target create ", "file ")
+
+running = cmd.startswith("run") or cmd.startswith("process launch")
+
+for i in range(self.maxLaunchCount if running else 1):
+with recording(self, trace) as sbuf:
+print("runCmd:", cmd, file=sbuf)
+if not check:
+print("check of return status not required", file=sbuf)
+
+self.ci.HandleCommand(cmd, self.res, inHistory)
+
+with recording(self, trace) as sbuf:
+if self.res.Succeeded():
+print("output:", self.res.GetOutput(), file=sbuf)
+else:
+print("runCmd failed!", file=sbuf)
+print(self.res.GetError(), file=sbuf)
+
+if self.res.Succeeded():
+break
+elif running:
+# For process launch, wait some time before possible next try.
+time.sleep(self.timeWaitNextLaunch)
+with recording(self, trace) as sbuf:
+print("Command '" + cmd + "' failed!", file=sbuf)
+
+if check:
+output = ""
+if self.res.GetOutput():
+   

[Lldb-commits] [lldb] [lldb][Windows] Fixed tests TestPty and TestPtyServer (PR #92090)

2024-05-15 Thread Dmitry Vasilyev via lldb-commits

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)

2024-05-14 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

The problem is here 
lldb\source\Plugins\Process\gdb-remote\GDBRemoteCommunicationClient.cpp, line 
3235
inside GDBRemoteCommunicationClient::GetFilePermissions()
```
file_permissions = mode & (S_IRWXU | S_IRWXG | S_IRWXO);
```
But S_IRWXU, S_IRWXG and S_IRWXO are 0 on Windows.

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)

2024-05-14 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

I have removed @skipIfWindows because these tests are host specific.

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


[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)

2024-05-14 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman updated 
https://github.com/llvm/llvm-project/pull/92088

>From 7dcfe773b6eef27aabbcc7fc68cd6448bc3c2e88 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Tue, 14 May 2024 13:08:35 +0400
Subject: [PATCH 1/2] [lldb][Windows] Fixed the test
 gdb_remote_client/TestGDBRemotePlatformFile

The tests `test_file_permissions` and `test_file_permissions_fallback` are 
disabled for Windows target. These tests use MockGDBServerResponder and do not 
depend on the real target. These tests failed in case of Windows host and Linux 
target. Disable them for Windows host too.
---
 .../gdb_remote_client/TestGDBRemotePlatformFile.py  | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
index 2be5ae3132038..9ef0954af1fe3 100644
--- 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
+++ 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
@@ -148,6 +148,7 @@ def vFile(self, packet):
 )
 
 @skipIfWindows
+@skipIf(hostoslist=["windows"])
 def test_file_permissions(self):
 """Test 'platform get-permissions'"""
 
@@ -168,6 +169,7 @@ def vFile(self, packet):
 )
 
 @skipIfWindows
+@skipIf(hostoslist=["windows"])
 def test_file_permissions_fallback(self):
 """Test 'platform get-permissions' fallback to fstat"""
 

>From 478d251691d511916cae5fc344d549450222d584 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Tue, 14 May 2024 20:23:56 +0400
Subject: [PATCH 2/2] Removed @skipIfWindows

---
 .../gdb_remote_client/TestGDBRemotePlatformFile.py  | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
index 9ef0954af1fe3..b1c6f0822d1a8 100644
--- 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
+++ 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
@@ -147,7 +147,6 @@ def vFile(self, packet):
 log=server2.responder.packetLog,
 )
 
-@skipIfWindows
 @skipIf(hostoslist=["windows"])
 def test_file_permissions(self):
 """Test 'platform get-permissions'"""
@@ -168,7 +167,6 @@ def vFile(self, packet):
 ]
 )
 
-@skipIfWindows
 @skipIf(hostoslist=["windows"])
 def test_file_permissions_fallback(self):
 """Test 'platform get-permissions' fallback to fstat"""

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


  1   2   >