[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

2024-06-08 Thread Greg Clayton via lldb-commits

https://github.com/clayborg created 
https://github.com/llvm/llvm-project/pull/94846

The function that calculated the declaration context for a DIE was incorrectly 
transparently traversing acrosss DW_TAG_subprogram dies when climbing the 
parent DIE chain. This meant that types defined in functions would appear to 
have the declaration context of anything above the function. I fixed the 
GetTypeLookupContextImpl(...) function in DWARFDIE.cpp to not transparently 
skip over functions, lexical blocks and inlined functions and compile and type 
units. Added a test to verify things are working.

>From 2f579ecafeaeb735cbce1bcfc829eb52a93f067c Mon Sep 17 00:00:00 2001
From: Greg Clayton 
Date: Fri, 7 Jun 2024 23:56:03 -0700
Subject: [PATCH] Fix type lookup bug where wrong decl context was being used
 for a DIE.

The function that calculated the declaration context for a DIE was incorrectly 
transparently traversing acrosss DW_TAG_subprogram dies when climbing the 
parent DIE chain. This meant that types defined in functions would appear to 
have the declaration context of anything above the function. I fixed the 
GetTypeLookupContextImpl(...) function in DWARFDIE.cpp to not transparently 
skip over functions, lexical blocks and inlined functions and compile and type 
units. Added a test to verify things are working.
---
 .../Plugins/SymbolFile/DWARF/DWARFDIE.cpp | 12 
 .../API/functionalities/type_types/Makefile   |  2 +
 .../type_types/TestFindTypes.py   | 69 +++
 .../API/functionalities/type_types/main.cpp   | 16 +
 4 files changed, 99 insertions(+)
 create mode 100644 lldb/test/API/functionalities/type_types/Makefile
 create mode 100644 lldb/test/API/functionalities/type_types/TestFindTypes.py
 create mode 100644 lldb/test/API/functionalities/type_types/main.cpp

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index 7cf92adc6ef57..c10174e8848ee 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -491,6 +491,18 @@ static void GetTypeLookupContextImpl(DWARFDIE die,
 case DW_TAG_base_type:
   push_ctx(CompilerContextKind::Builtin, name);
   break;
+// If any of the tags below appear in the parent chain, stop the decl
+// context and return. Prior to these being in here, if a type existed in a
+// namespace "a" like "a::my_struct", but we also have a function in that
+// same namespace "a" which contained a type named "my_struct", both would
+// return "a::my_struct" as the declaration context since the
+// DW_TAG_subprogram would be skipped and its parent would be found.
+case DW_TAG_compile_unit:
+case DW_TAG_type_unit:
+case DW_TAG_subprogram:
+case DW_TAG_lexical_block:
+case DW_TAG_inlined_subroutine:
+  return;
 default:
   break;
 }
diff --git a/lldb/test/API/functionalities/type_types/Makefile 
b/lldb/test/API/functionalities/type_types/Makefile
new file mode 100644
index 0..3d0b98f13f3d7
--- /dev/null
+++ b/lldb/test/API/functionalities/type_types/Makefile
@@ -0,0 +1,2 @@
+CXX_SOURCES := main.cpp
+include Makefile.rules
diff --git a/lldb/test/API/functionalities/type_types/TestFindTypes.py 
b/lldb/test/API/functionalities/type_types/TestFindTypes.py
new file mode 100644
index 0..adbaaba51d080
--- /dev/null
+++ b/lldb/test/API/functionalities/type_types/TestFindTypes.py
@@ -0,0 +1,69 @@
+"""
+Test the SBModule and SBTarget type lookup APIs to find multiple types.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TypeFindFirstTestCase(TestBase):
+def test_find_first_type(self):
+"""
+Test SBTarget::FindTypes() and SBModule::FindTypes() APIs.
+
+We had issues where our declaration context when finding types was
+incorrectly calculated where a type in a namepace, and a type in a
+function that was also in the same namespace would match a lookup. For
+example:
+
+namespace a {
+  struct Foo {
+int foo;
+  };
+
+  unsigned foo() {
+typedef unsigned Foo;
+Foo foo = 12;
+return foo;
+  }
+} // namespace a
+
+
+Previously LLDB would calculate the declaration context of "a::Foo"
+correctly, but incorrectly calculate the declaration context of "Foo"
+from within the foo() function as "a::Foo". Adding tests to ensure this
+works correctly.
+"""
+self.build()
+target = self.createTestTarget()
+exe_module = target.GetModuleAtIndex(0)
+self.assertTrue(exe_module.IsValid())
+# Test the SBTarget and SBModule APIs for FindFirstType
+for api in [target, exe_module]:
+# We should find the "a::Foo" but not the "Foo

[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

2024-06-08 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Greg Clayton (clayborg)


Changes

The function that calculated the declaration context for a DIE was incorrectly 
transparently traversing acrosss DW_TAG_subprogram dies when climbing the 
parent DIE chain. This meant that types defined in functions would appear to 
have the declaration context of anything above the function. I fixed the 
GetTypeLookupContextImpl(...) function in DWARFDIE.cpp to not transparently 
skip over functions, lexical blocks and inlined functions and compile and type 
units. Added a test to verify things are working.

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


4 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (+12) 
- (added) lldb/test/API/functionalities/type_types/Makefile (+2) 
- (added) lldb/test/API/functionalities/type_types/TestFindTypes.py (+69) 
- (added) lldb/test/API/functionalities/type_types/main.cpp (+16) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index 7cf92adc6ef57..c10174e8848ee 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -491,6 +491,18 @@ static void GetTypeLookupContextImpl(DWARFDIE die,
 case DW_TAG_base_type:
   push_ctx(CompilerContextKind::Builtin, name);
   break;
+// If any of the tags below appear in the parent chain, stop the decl
+// context and return. Prior to these being in here, if a type existed in a
+// namespace "a" like "a::my_struct", but we also have a function in that
+// same namespace "a" which contained a type named "my_struct", both would
+// return "a::my_struct" as the declaration context since the
+// DW_TAG_subprogram would be skipped and its parent would be found.
+case DW_TAG_compile_unit:
+case DW_TAG_type_unit:
+case DW_TAG_subprogram:
+case DW_TAG_lexical_block:
+case DW_TAG_inlined_subroutine:
+  return;
 default:
   break;
 }
diff --git a/lldb/test/API/functionalities/type_types/Makefile 
b/lldb/test/API/functionalities/type_types/Makefile
new file mode 100644
index 0..3d0b98f13f3d7
--- /dev/null
+++ b/lldb/test/API/functionalities/type_types/Makefile
@@ -0,0 +1,2 @@
+CXX_SOURCES := main.cpp
+include Makefile.rules
diff --git a/lldb/test/API/functionalities/type_types/TestFindTypes.py 
b/lldb/test/API/functionalities/type_types/TestFindTypes.py
new file mode 100644
index 0..adbaaba51d080
--- /dev/null
+++ b/lldb/test/API/functionalities/type_types/TestFindTypes.py
@@ -0,0 +1,69 @@
+"""
+Test the SBModule and SBTarget type lookup APIs to find multiple types.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TypeFindFirstTestCase(TestBase):
+def test_find_first_type(self):
+"""
+Test SBTarget::FindTypes() and SBModule::FindTypes() APIs.
+
+We had issues where our declaration context when finding types was
+incorrectly calculated where a type in a namepace, and a type in a
+function that was also in the same namespace would match a lookup. For
+example:
+
+namespace a {
+  struct Foo {
+int foo;
+  };
+
+  unsigned foo() {
+typedef unsigned Foo;
+Foo foo = 12;
+return foo;
+  }
+} // namespace a
+
+
+Previously LLDB would calculate the declaration context of "a::Foo"
+correctly, but incorrectly calculate the declaration context of "Foo"
+from within the foo() function as "a::Foo". Adding tests to ensure this
+works correctly.
+"""
+self.build()
+target = self.createTestTarget()
+exe_module = target.GetModuleAtIndex(0)
+self.assertTrue(exe_module.IsValid())
+# Test the SBTarget and SBModule APIs for FindFirstType
+for api in [target, exe_module]:
+# We should find the "a::Foo" but not the "Foo" type in the 
function
+types = api.FindTypes("a::Foo")
+self.assertEqual(types.GetSize(), 1)
+type_str0 = str(types.GetTypeAtIndex(0))
+self.assertIn('struct Foo', type_str0)
+
+# When we search by type basename, we should find any type whose
+# basename matches "Foo", so "a::Foo" and the "Foo" type in the
+# function.
+types = api.FindTypes("Foo")
+self.assertEqual(types.GetSize(), 2)
+type_str0 = str(types.GetTypeAtIndex(0))
+type_str1 = str(types.GetTypeAtIndex(1))
+# We don't know which order the types will come back as, so
+if 'struct Foo' in type_str0:
+self.assertIn('typedef Foo', type_str1)
+else:
+self.assertIn('struct Foo', t

[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

2024-06-08 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 5aabbf0602c48b67bb89fd37f95bf97c95ded488 
2f579ecafeaeb735cbce1bcfc829eb52a93f067c -- 
lldb/test/API/functionalities/type_types/main.cpp 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/test/API/functionalities/type_types/main.cpp 
b/lldb/test/API/functionalities/type_types/main.cpp
index 57eecd81f0..095328932c 100644
--- a/lldb/test/API/functionalities/type_types/main.cpp
+++ b/lldb/test/API/functionalities/type_types/main.cpp
@@ -1,14 +1,13 @@
 namespace a {
-  struct Foo {};
+struct Foo {};
 
-  unsigned foo() {
-typedef unsigned Foo;
-Foo foo = 12;
-return foo;
-  }
+unsigned foo() {
+  typedef unsigned Foo;
+  Foo foo = 12;
+  return foo;
+}
 } // namespace a
 
-
 int main() {
   a::Foo f = {};
   a::foo();

``




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


[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

2024-06-08 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
5aabbf0602c48b67bb89fd37f95bf97c95ded488...2f579ecafeaeb735cbce1bcfc829eb52a93f067c
 lldb/test/API/functionalities/type_types/TestFindTypes.py
``





View the diff from darker here.


``diff
--- TestFindTypes.py2024-06-08 06:56:03.00 +
+++ TestFindTypes.py2024-06-08 07:03:23.715724 +
@@ -43,27 +43,27 @@
 for api in [target, exe_module]:
 # We should find the "a::Foo" but not the "Foo" type in the 
function
 types = api.FindTypes("a::Foo")
 self.assertEqual(types.GetSize(), 1)
 type_str0 = str(types.GetTypeAtIndex(0))
-self.assertIn('struct Foo', type_str0)
+self.assertIn("struct Foo", type_str0)
 
 # When we search by type basename, we should find any type whose
 # basename matches "Foo", so "a::Foo" and the "Foo" type in the
 # function.
 types = api.FindTypes("Foo")
 self.assertEqual(types.GetSize(), 2)
 type_str0 = str(types.GetTypeAtIndex(0))
 type_str1 = str(types.GetTypeAtIndex(1))
 # We don't know which order the types will come back as, so
-if 'struct Foo' in type_str0:
-self.assertIn('typedef Foo', type_str1)
+if "struct Foo" in type_str0:
+self.assertIn("typedef Foo", type_str1)
 else:
-self.assertIn('struct Foo', type_str1)
+self.assertIn("struct Foo", type_str1)
 
 # When we search by type basename with "::" prepended, we should
 # only types in the root namespace which means only "Foo" type in
 # the function.
 types = api.FindTypes("::Foo")
 self.assertEqual(types.GetSize(), 1)
 type_str0 = str(types.GetTypeAtIndex(0))
-self.assertIn('typedef Foo', type_str0)
+self.assertIn("typedef Foo", type_str0)

``




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


[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

2024-06-08 Thread via lldb-commits


@@ -0,0 +1,69 @@
+"""
+Test the SBModule and SBTarget type lookup APIs to find multiple types.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TypeFindFirstTestCase(TestBase):
+def test_find_first_type(self):
+"""
+Test SBTarget::FindTypes() and SBModule::FindTypes() APIs.
+
+We had issues where our declaration context when finding types was
+incorrectly calculated where a type in a namepace, and a type in a
+function that was also in the same namespace would match a lookup. For
+example:
+
+namespace a {
+  struct Foo {
+int foo;
+  };
+
+  unsigned foo() {
+typedef unsigned Foo;
+Foo foo = 12;
+return foo;
+  }
+} // namespace a
+
+
+Previously LLDB would calculate the declaration context of "a::Foo"
+correctly, but incorrectly calculate the declaration context of "Foo"
+from within the foo() function as "a::Foo". Adding tests to ensure this
+works correctly.
+"""
+self.build()
+target = self.createTestTarget()
+exe_module = target.GetModuleAtIndex(0)
+self.assertTrue(exe_module.IsValid())
+# Test the SBTarget and SBModule APIs for FindFirstType
+for api in [target, exe_module]:
+# We should find the "a::Foo" but not the "Foo" type in the 
function
+types = api.FindTypes("a::Foo")
+self.assertEqual(types.GetSize(), 1)
+type_str0 = str(types.GetTypeAtIndex(0))
+self.assertIn('struct Foo', type_str0)
+
+# When we search by type basename, we should find any type whose
+# basename matches "Foo", so "a::Foo" and the "Foo" type in the
+# function.
+types = api.FindTypes("Foo")
+self.assertEqual(types.GetSize(), 2)
+type_str0 = str(types.GetTypeAtIndex(0))
+type_str1 = str(types.GetTypeAtIndex(1))
+# We don't know which order the types will come back as, so
+if 'struct Foo' in type_str0:
+self.assertIn('typedef Foo', type_str1)
+else:
+self.assertIn('struct Foo', type_str1)
+
+# When we search by type basename with "::" prepended, we should
+# only types in the root namespace which means only "Foo" type in

kusmour wrote:

```suggestion
# When we search by type basename with "::" prepended, we should
# return only types in the root namespace which means only "Foo" 
type in
```

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


[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

2024-06-08 Thread via lldb-commits

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

Seems there's formatter issue and a nit. Other than that LGTM :)

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


[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

2024-06-08 Thread via lldb-commits

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


[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

2024-06-08 Thread via lldb-commits


@@ -0,0 +1,69 @@
+"""
+Test the SBModule and SBTarget type lookup APIs to find multiple types.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TypeFindFirstTestCase(TestBase):
+def test_find_first_type(self):
+"""
+Test SBTarget::FindTypes() and SBModule::FindTypes() APIs.
+
+We had issues where our declaration context when finding types was
+incorrectly calculated where a type in a namepace, and a type in a
+function that was also in the same namespace would match a lookup. For
+example:
+
+namespace a {
+  struct Foo {
+int foo;
+  };
+
+  unsigned foo() {
+typedef unsigned Foo;
+Foo foo = 12;
+return foo;
+  }
+} // namespace a
+
+
+Previously LLDB would calculate the declaration context of "a::Foo"
+correctly, but incorrectly calculate the declaration context of "Foo"
+from within the foo() function as "a::Foo". Adding tests to ensure this
+works correctly.
+"""
+self.build()
+target = self.createTestTarget()
+exe_module = target.GetModuleAtIndex(0)
+self.assertTrue(exe_module.IsValid())
+# Test the SBTarget and SBModule APIs for FindFirstType
+for api in [target, exe_module]:
+# We should find the "a::Foo" but not the "Foo" type in the 
function
+types = api.FindTypes("a::Foo")
+self.assertEqual(types.GetSize(), 1)
+type_str0 = str(types.GetTypeAtIndex(0))
+self.assertIn('struct Foo', type_str0)
+
+# When we search by type basename, we should find any type whose
+# basename matches "Foo", so "a::Foo" and the "Foo" type in the
+# function.
+types = api.FindTypes("Foo")
+self.assertEqual(types.GetSize(), 2)
+type_str0 = str(types.GetTypeAtIndex(0))
+type_str1 = str(types.GetTypeAtIndex(1))
+# We don't know which order the types will come back as, so
+if 'struct Foo' in type_str0:
+self.assertIn('typedef Foo', type_str1)
+else:
+self.assertIn('struct Foo', type_str1)
+
+# When we search by type basename with "::" prepended, we should
+# only types in the root namespace which means only "Foo" type in

kusmour wrote:

Just asking why the typedef will be at the root level but not the struct?

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


[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

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


@@ -491,6 +491,18 @@ static void GetTypeLookupContextImpl(DWARFDIE die,
 case DW_TAG_base_type:
   push_ctx(CompilerContextKind::Builtin, name);
   break;
+// If any of the tags below appear in the parent chain, stop the decl
+// context and return. Prior to these being in here, if a type existed in a
+// namespace "a" like "a::my_struct", but we also have a function in that
+// same namespace "a" which contained a type named "my_struct", both would
+// return "a::my_struct" as the declaration context since the
+// DW_TAG_subprogram would be skipped and its parent would be found.
+case DW_TAG_compile_unit:

Michael137 wrote:

Ah looks like the early-return was removed in the refactor in 
https://github.com/llvm/llvm-project/pull/93291?
This LGTM but @labath had plans to align `GetTypeLookupContext` and 
`GetDeclContext`, so wanted him to have a look too

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


[Lldb-commits] [lldb] Fix type lookup bug where wrong decl context was being used for a DIE. (PR #94846)

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


@@ -0,0 +1,69 @@
+"""

Michael137 wrote:

There's also a unit-test for `GetTypeLookupContext` in 
`lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp`. Would be nice to add a 
test-case there too (if the yaml isn't too much of a hassle)

https://github.com/llvm/llvm-project/pull/94846
___
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-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 via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff fb0c705dbf27e3ab84d726ad30e172806a530c21 
6fb19a05a6a4fb4463035bcd35a53fc51e446a05 -- 
lldb/test/API/functionalities/target-new-solib-notifications/a.cpp 
lldb/test/API/functionalities/target-new-solib-notifications/b.cpp 
lldb/test/API/functionalities/target-new-solib-notifications/c.cpp 
lldb/test/API/functionalities/target-new-solib-notifications/d.cpp 
lldb/test/API/functionalities/target-new-solib-notifications/main.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/test/API/functionalities/target-new-solib-notifications/a.cpp 
b/lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
index 5d0ab4030e..88c59bd7be 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/a.cpp
@@ -1,14 +1,7 @@
 extern "C" int b_function();
 
-int a_init()
-{
-return 234;
-}
+int a_init() { return 234; }
 
 int a_global = a_init();
 
-extern "C" int
-a_function ()
-{
-return b_function ();
-}
+extern "C" int a_function() { return b_function(); }
diff --git a/lldb/test/API/functionalities/target-new-solib-notifications/b.cpp 
b/lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
index ddb2d97fbd..908282f06a 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/b.cpp
@@ -1,9 +1,5 @@
-int b_init()
-{
-return 345;
-}
+int b_init() { return 345; }
 
 int b_global = b_init();
 
-extern "C"
-int b_function() { return 500; }
+extern "C" int b_function() { return 500; }
diff --git a/lldb/test/API/functionalities/target-new-solib-notifications/c.cpp 
b/lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
index 13ab26b4c4..8abd1b155a 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/c.cpp
@@ -1,5 +1 @@
-extern "C" int
-c_function ()
-{
-return 600;
-}
+extern "C" int c_function() { return 600; }
diff --git a/lldb/test/API/functionalities/target-new-solib-notifications/d.cpp 
b/lldb/test/API/functionalities/target-new-solib-notifications/d.cpp
index 13f9934745..85882b4ce9 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/d.cpp
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/d.cpp
@@ -1,7 +1,4 @@
-int d_init()
-{
-return 123;
-}
+int d_init() { return 123; }
 
 int d_global = d_init();
 
diff --git 
a/lldb/test/API/functionalities/target-new-solib-notifications/main.cpp 
b/lldb/test/API/functionalities/target-new-solib-notifications/main.cpp
index f7c4555e02..9efac88643 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/main.cpp
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/main.cpp
@@ -1,12 +1,11 @@
 #include 
 
-extern "C" int a_function ();
-extern "C" int c_function ();
-extern "C" int b_function ();
-extern "C" int d_function ();
+extern "C" int a_function();
+extern "C" int c_function();
+extern "C" int b_function();
+extern "C" int d_function();
 
-int main ()
-{
+int main() {
   a_function();
   b_function();
   c_function();

``




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

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 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
+   $(MAKE

[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
+   $(MAKE

[Lldb-commits] [lldb] [lldb] Add a test for lea_rsp_pattern_p to x86 unwinder (NFC) (PR #94852)

2024-06-08 Thread Shivam Gupta via lldb-commits

https://github.com/xgupta created 
https://github.com/llvm/llvm-project/pull/94852

This commit adds a test for lea_rsp_pattern_p which was previously due as FIXME.

>From 1ca5f7e7edefedd12de0745de5afe720f41456b1 Mon Sep 17 00:00:00 2001
From: Shivam Gupta 
Date: Sat, 8 Jun 2024 17:43:55 +0530
Subject: [PATCH] [lldb] Add a test for lea_rsp_pattern_p to x86 unwinder (NFC)

This commit adds a test for lea_rsp_pattern_p which was previously due as FIXME.
---
 .../x86/Testx86AssemblyInspectionEngine.cpp   | 24 ++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git 
a/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp 
b/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
index 277cc14ce50c9..597e5b2e40d5e 100644
--- a/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
+++ b/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
@@ -1731,7 +1731,29 @@ TEST_F(Testx86AssemblyInspectionEngine, TestAddESP) {
   EXPECT_EQ(4 - 16, row_sp->GetCFAValue().GetOffset());
 }
 
-// FIXME add test for lea_rsp_pattern_p
+TEST_F(Testx86AssemblyInspectionEngine, TestLEA_RSP_Pattern) {
+  UnwindPlan::Row::RegisterLocation regloc;
+  UnwindPlan::RowSP row_sp;
+  AddressRange sample_range;
+  UnwindPlan unwind_plan(eRegisterKindLLDB);
+  std::unique_ptr engine = Getx86_64Inspector();
+
+  uint8_t data[] = {
+  0x8d, 0x64, 0x24, 0x10, // lea rsp, [rsp + 0x10]
+  0x90// nop
+  };
+
+  sample_range = AddressRange(0x1000, sizeof(data));
+
+  EXPECT_TRUE(engine->GetNonCallSiteUnwindPlanFromAssembly(
+  data, sizeof(data), sample_range, unwind_plan));
+
+  row_sp = unwind_plan.GetRowForFunctionOffset(0);
+  EXPECT_EQ(0ull, row_sp->GetOffset());
+  EXPECT_TRUE(row_sp->GetCFAValue().GetRegisterNumber() == k_rsp);
+  EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true);
+  EXPECT_EQ(8, row_sp->GetCFAValue().GetOffset());
+}
 
 TEST_F(Testx86AssemblyInspectionEngine, TestPopRBX) {
   UnwindPlan::Row::RegisterLocation regloc;

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


[Lldb-commits] [lldb] [lldb] Add a test for lea_rsp_pattern_p to x86 unwinder (NFC) (PR #94852)

2024-06-08 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Shivam Gupta (xgupta)


Changes

This commit adds a test for lea_rsp_pattern_p which was previously due as FIXME.

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


1 Files Affected:

- (modified) 
lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp (+23-1) 


``diff
diff --git 
a/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp 
b/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
index 277cc14ce50c9..597e5b2e40d5e 100644
--- a/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
+++ b/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
@@ -1731,7 +1731,29 @@ TEST_F(Testx86AssemblyInspectionEngine, TestAddESP) {
   EXPECT_EQ(4 - 16, row_sp->GetCFAValue().GetOffset());
 }
 
-// FIXME add test for lea_rsp_pattern_p
+TEST_F(Testx86AssemblyInspectionEngine, TestLEA_RSP_Pattern) {
+  UnwindPlan::Row::RegisterLocation regloc;
+  UnwindPlan::RowSP row_sp;
+  AddressRange sample_range;
+  UnwindPlan unwind_plan(eRegisterKindLLDB);
+  std::unique_ptr engine = Getx86_64Inspector();
+
+  uint8_t data[] = {
+  0x8d, 0x64, 0x24, 0x10, // lea rsp, [rsp + 0x10]
+  0x90// nop
+  };
+
+  sample_range = AddressRange(0x1000, sizeof(data));
+
+  EXPECT_TRUE(engine->GetNonCallSiteUnwindPlanFromAssembly(
+  data, sizeof(data), sample_range, unwind_plan));
+
+  row_sp = unwind_plan.GetRowForFunctionOffset(0);
+  EXPECT_EQ(0ull, row_sp->GetOffset());
+  EXPECT_TRUE(row_sp->GetCFAValue().GetRegisterNumber() == k_rsp);
+  EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true);
+  EXPECT_EQ(8, row_sp->GetCFAValue().GetOffset());
+}
 
 TEST_F(Testx86AssemblyInspectionEngine, TestPopRBX) {
   UnwindPlan::Row::RegisterLocation regloc;

``




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


[Lldb-commits] [lldb] [lldb] Use const reference for range variables to improve performance (NFC) (PR #94840)

2024-06-08 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [libc] [libcxx] [lld] [lldb] [llvm] [mlir] [libc][math][C23] Implemented remquof128 function (PR #94809)

2024-06-08 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff bfa937a48767a3dd10c5847034ce0b341da00a93 
619189446484702fdf66dc43009cf6606dc4a8cd -- 
clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp 
clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.h 
clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/use-internal-linkage/func.h
 
clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/use-internal-linkage/func_cpp.inc
 
clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/use-internal-linkage/func_h.inc
 
clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/use-internal-linkage/var.h
 clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp 
clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp 
libc/src/math/fmodf16.h libc/src/math/generic/fmodf16.cpp 
libc/src/math/generic/remquof128.cpp libc/src/math/remquof128.h 
libc/test/src/math/performance_testing/fmodf16_perf.cpp 
libc/test/src/math/smoke/fmodf16_test.cpp 
libc/test/src/math/smoke/remquof128_test.cpp 
clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp 
clang/examples/PrintFunctionNames/PrintFunctionNames.cpp 
clang/include/clang/Sema/SemaHLSL.h clang/lib/AST/ExprConstant.cpp 
clang/lib/CodeGen/CGHLSLRuntime.cpp clang/lib/Sema/SemaHLSL.cpp 
clang/test/SemaCXX/complex-folding.cpp 
compiler-rt/lib/xray/tests/unit/function_call_trie_test.cpp 
compiler-rt/lib/xray/tests/unit/profile_collector_test.cpp 
compiler-rt/lib/xray/tests/unit/segmented_array_test.cpp 
compiler-rt/lib/xray/tests/unit/test_helpers.cpp 
compiler-rt/lib/xray/xray_fdr_logging.cpp 
compiler-rt/lib/xray/xray_function_call_trie.h 
compiler-rt/lib/xray/xray_profile_collector.cpp 
compiler-rt/lib/xray/xray_profiling.cpp 
compiler-rt/lib/xray/xray_segmented_array.h 
compiler-rt/test/dfsan/release_shadow_space.c 
compiler-rt/test/tsan/custom_mutex4.cpp compiler-rt/test/tsan/custom_mutex5.cpp 
libc/src/__support/FPUtil/FPBits.h libc/src/__support/FPUtil/generic/FMod.h 
libc/test/src/math/performance_testing/BinaryOpSingleOutputPerf.h 
libc/test/src/math/smoke/FModTest.h libcxx/include/__type_traits/promote.h 
lld/ELF/Arch/AArch64.cpp lld/ELF/InputFiles.cpp lld/ELF/Relocations.cpp 
lld/ELF/SyntheticSections.cpp lld/ELF/SyntheticSections.h lld/ELF/Writer.cpp 
lldb/include/lldb/API/SBCommandInterpreterRunOptions.h 
lldb/include/lldb/Interpreter/CommandInterpreter.h 
lldb/source/API/SBCommandInterpreterRunOptions.cpp 
lldb/source/Interpreter/CommandInterpreter.cpp 
lldb/tools/debugserver/source/JSON.cpp llvm/examples/BrainF/BrainF.cpp 
llvm/examples/BrainF/BrainFDriver.cpp llvm/include/llvm/ProfileData/InstrProf.h 
llvm/include/llvm/ProfileData/MemProf.h 
llvm/include/llvm/ProfileData/MemProfReader.h 
llvm/include/llvm/Support/GenericLoopInfoImpl.h 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
llvm/lib/ProfileData/InstrProfReader.cpp 
llvm/lib/ProfileData/InstrProfWriter.cpp llvm/lib/ProfileData/MemProf.cpp 
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp 
llvm/lib/Transforms/Instrumentation/MemProfiler.cpp 
llvm/lib/Transforms/Scalar/Reassociate.cpp 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp 
llvm/unittests/ProfileData/MemProfTest.cpp mlir/include/mlir/IR/PatternMatch.h 
mlir/lib/Dialect/Affine/IR/AffineOps.cpp 
mlir/lib/Dialect/Linalg/Transforms/Loops.cpp 
mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp mlir/lib/Dialect/SCF/IR/SCF.cpp 
mlir/lib/Dialect/SCF/Transforms/ForallToFor.cpp 
mlir/lib/Dialect/SCF/Transforms/ForallToParallel.cpp 
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp 
mlir/unittests/Dialect/SCF/LoopLikeSCFOpsTest.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 48f6618ab0..8683e2a88a 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -100,8 +100,7 @@ public:
LazyBool stop_on_error, LazyBool stop_on_crash,
LazyBool echo_commands, LazyBool echo_comments,
LazyBool print_results, LazyBool print_errors,
-   LazyBool add_to_history,
-   LazyBool handle_repeats)
+   LazyBool add_to_history, LazyBool 
handle_repeats)
   : m_stop_on_continue(stop_on_continue), m_stop_on_error(stop_on_error),
 m_stop_on_crash(stop_on_crash), m_echo_commands(echo_commands),
 m_echo_comment_commands(echo_comments), m_print_results(print_results),

``




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

[Lldb-commits] [lldb] 1e92ad4 - [lldb] Use const reference for range variables to improve performance (NFC) (#94840)

2024-06-08 Thread via lldb-commits

Author: Shivam Gupta
Date: 2024-06-08T22:34:40+05:30
New Revision: 1e92ad41d8ef46fa3c628b05ba8ed481fedc17bd

URL: 
https://github.com/llvm/llvm-project/commit/1e92ad41d8ef46fa3c628b05ba8ed481fedc17bd
DIFF: 
https://github.com/llvm/llvm-project/commit/1e92ad41d8ef46fa3c628b05ba8ed481fedc17bd.diff

LOG: [lldb] Use const reference for range variables to improve performance 
(NFC) (#94840)

Cppcheck recommends using a const reference for range variables in a
for-each loop.
This avoids unnecessary copying of elements, improving performance.

Caught by cppcheck -
lldb/source/API/SBBreakpoint.cpp:717:22: performance: Range variable
'name' should be declared as const reference. [iterateByValue]
lldb/source/API/SBTarget.cpp:1150:15: performance: Range variable 'name'
should be declared as const reference. [iterateByValue]
lldb/source/Breakpoint/Breakpoint.cpp:888:26: performance: Range
variable 'name' should be declared as const reference. [iterateByValue]
lldb/source/Breakpoint/BreakpointIDList.cpp:262:26: performance: Range
variable 'name' should be declared as const reference. [iterateByValue]

Fix #91213
Fix #91217
Fix #91219
Fix #91220

Added: 


Modified: 
lldb/source/API/SBBreakpoint.cpp
lldb/source/API/SBTarget.cpp
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Breakpoint/BreakpointIDList.cpp

Removed: 




diff  --git a/lldb/source/API/SBBreakpoint.cpp 
b/lldb/source/API/SBBreakpoint.cpp
index f1fb6f904f5f0..3d908047f9455 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -714,7 +714,7 @@ void SBBreakpoint::GetNames(SBStringList &names) {
 bkpt_sp->GetTarget().GetAPIMutex());
 std::vector names_vec;
 bkpt_sp->GetNames(names_vec);
-for (std::string name : names_vec) {
+for (const std::string &name : names_vec) {
   names.AppendString(name.c_str());
 }
   }

diff  --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 962ce9ba83cc7..adb9e645610ba 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1147,7 +1147,7 @@ void SBTarget::GetBreakpointNames(SBStringList &names) {
 
 std::vector name_vec;
 target_sp->GetBreakpointNames(name_vec);
-for (auto name : name_vec)
+for (const auto &name : name_vec)
   names.AppendString(name.c_str());
   }
 }

diff  --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index ae845e92762b9..dc80d435ad444 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -885,7 +885,7 @@ void Breakpoint::GetDescription(Stream *s, 
lldb::DescriptionLevel level,
 s->Printf("Names:");
 s->EOL();
 s->IndentMore();
-for (std::string name : m_name_list) {
+for (const std::string &name : m_name_list) {
   s->Indent();
   s->Printf("%s\n", name.c_str());
 }

diff  --git a/lldb/source/Breakpoint/BreakpointIDList.cpp 
b/lldb/source/Breakpoint/BreakpointIDList.cpp
index 97af1d40eb7a5..5fc9f95a75db1 100644
--- a/lldb/source/Breakpoint/BreakpointIDList.cpp
+++ b/lldb/source/Breakpoint/BreakpointIDList.cpp
@@ -259,7 +259,7 @@ llvm::Error BreakpointIDList::FindAndReplaceIDRanges(
 
 if (!names_found.empty()) {
   for (BreakpointSP bkpt_sp : target->GetBreakpointList().Breakpoints()) {
-for (std::string name : names_found) {
+for (const std::string &name : names_found) {
   if (bkpt_sp->MatchesName(name.c_str())) {
 StreamString canonical_id_str;
 BreakpointID::GetCanonicalReference(



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


[Lldb-commits] [lldb] [lldb] Use const reference for range variables to improve performance (NFC) (PR #94840)

2024-06-08 Thread Shivam Gupta via lldb-commits

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