[Lldb-commits] [lldb] [lldb] Add `scripting extension instances` command (PR #226043)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 24 00:16:56 PDT 2026
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/commands/scripting/extension/TestScriptingExtensionInstances.py lldb/test/API/commands/scripting/extension/instance_cmds.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
--- TestScriptingExtensionInstances.py 2026-09-24 07:10:17.000000 +0000
+++ TestScriptingExtensionInstances.py 2026-09-24 07:16:24.939870 +0000
@@ -46,18 +46,18 @@
self.assertIsNotNone(group, "scripted command instance is not listed")
self.assertEqual(
group.GetValueForKey("extension").GetStringValue(256), "ScriptedCommand"
)
self.assertEqual(
- os.path.realpath(
- group.GetValueForKey("source_path").GetStringValue(4096)
- ),
+ os.path.realpath(group.GetValueForKey("source_path").GetStringValue(4096)),
os.path.realpath(script_path),
)
(instance,) = self.get_instances(group)
self.assertTrue(instance.GetValueForKey("uuid").GetStringValue(64))
- self.assertNotEqual(instance.GetValueForKey("address").GetUnsignedIntegerValue(), 0)
+ self.assertNotEqual(
+ instance.GetValueForKey("address").GetUnsignedIntegerValue(), 0
+ )
# Scripted commands take no extra arguments.
self.assertFalse(instance.GetValueForKey("args").IsValid())
self.assertIsNotNone(
self.find_group("instance_cmds.EchoCommand", "ScriptedCommand")
@@ -81,23 +81,17 @@
def test_instances_grouped_by_class(self):
script_path = os.path.join(self.getSourceDir(), "instance_cmds.py")
self.runCmd("command script import " + script_path)
self.assertTrue(self.dbg.CreateTarget(""), VALID_TARGET)
- self.runCmd(
- "target stop-hook add -P instance_cmds.StopHook -k answer -v 42"
- )
- self.runCmd(
- "target stop-hook add -P instance_cmds.StopHook -k answer -v 42"
- )
+ self.runCmd("target stop-hook add -P instance_cmds.StopHook -k answer -v 42")
+ self.runCmd("target stop-hook add -P instance_cmds.StopHook -k answer -v 42")
group = self.find_group("instance_cmds.StopHook", "ScriptedHook")
self.assertIsNotNone(group, "stop hook instances are not listed")
self.assertEqual(
- os.path.realpath(
- group.GetValueForKey("source_path").GetStringValue(4096)
- ),
+ os.path.realpath(group.GetValueForKey("source_path").GetStringValue(4096)),
os.path.realpath(script_path),
)
# Identical class and arguments, but still two distinct instances.
instances = self.get_instances(group)
@@ -116,11 +110,17 @@
args.GetValueForKey("answer").GetUnsignedIntegerValue(), 42
)
self.expect(
"scripting extension instances ScriptedHook",
- substrs=["instance_cmds.StopHook", "Instances:", "[0] ", "[1] ", "- answer: 42"],
+ substrs=[
+ "instance_cmds.StopHook",
+ "Instances:",
+ "[0] ",
+ "[1] ",
+ "- answer: 42",
+ ],
)
def test_destroyed_instances_are_removed(self):
script_path = os.path.join(self.getSourceDir(), "instance_cmds.py")
self.runCmd("command script import " + script_path)
``````````
</details>
https://github.com/llvm/llvm-project/pull/226043
More information about the lldb-commits
mailing list