[Lldb-commits] [lldb] [lldb] Add support for unique target ids (PR #160736)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 2 05:51:26 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD lldb/test/API/python_api/debugger/TestDebuggerAPI.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- TestDebuggerAPI.py 2025-10-02 06:06:33.000000 +0000
+++ TestDebuggerAPI.py 2025-10-02 12:50:55.171299 +0000
@@ -404,26 +404,35 @@
exe = self.getBuildArtifact("a.out")
# Create two debuggers with targets each
debugger1 = lldb.SBDebugger.Create()
debugger2 = lldb.SBDebugger.Create()
-
+
# Create 2 targets per debugger
targets_d1 = [debugger1.CreateTarget(exe), debugger1.CreateTarget(exe)]
targets_d2 = [debugger2.CreateTarget(exe), debugger2.CreateTarget(exe)]
targets = targets_d1 + targets_d2
-
+
# Get all IDs and verify they're unique
ids = [target.GetGloballyUniqueID() for target in targets]
- self.assertEqual(len(set(ids)), len(ids), f"IDs should be globally unique: {ids}")
+ self.assertEqual(
+ len(set(ids)), len(ids), f"IDs should be globally unique: {ids}"
+ )
self.assertTrue(all(uid > 0 for uid in ids), "All IDs should be non-zero")
-
+
# Verify targets can be found by their IDs in respective debuggers
- for debugger, target_pair in [(debugger1, targets[:2]), (debugger2, targets[2:])]:
+ for debugger, target_pair in [
+ (debugger1, targets[:2]),
+ (debugger2, targets[2:]),
+ ]:
for target in target_pair:
found = debugger.FindTargetWithUniqueID(target.GetGloballyUniqueID())
- self.assertTrue(found.IsValid(), "Target should be found by its unique ID")
- self.assertEqual(found.GetGloballyUniqueID(), target.GetGloballyUniqueID())
+ self.assertTrue(
+ found.IsValid(), "Target should be found by its unique ID"
+ )
+ self.assertEqual(
+ found.GetGloballyUniqueID(), target.GetGloballyUniqueID()
+ )
# Clean up
lldb.SBDebugger.Destroy(debugger1)
lldb.SBDebugger.Destroy(debugger2)
``````````
</details>
https://github.com/llvm/llvm-project/pull/160736
More information about the lldb-commits
mailing list