Skip to content

Commit ba03d9d

Browse files
author
rchamala
committed
Fix code formatting
1 parent a4fdb2d commit ba03d9d

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed

lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ def cleanup():
7878

7979
# Create a random lib which does not exist in the corefile.
8080
random_dylib = self.get_module_with_name(corefile_target, "random.dylib")
81-
self.assertFalse(random_dylib, "Dynamic library random.dylib should not be found.")
81+
self.assertFalse(
82+
random_dylib, "Dynamic library random.dylib should not be found."
83+
)
8284

8385
structured_data = lldb.SBStructuredData()
8486
structured_data.SetFromJSON(
@@ -94,9 +96,9 @@ def cleanup():
9496
{
9597
"path": "/random/path/random.dylib",
9698
"load_addr": 12345678,
97-
"ignore_module_load_error": True
98-
}
99-
]
99+
"ignore_module_load_error": True,
100+
},
101+
],
100102
}
101103
)
102104
)

lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,53 @@ def __init__(self, exe_ctx: lldb.SBExecutionContext, args: lldb.SBStructuredData
5151
for id in range(custom_modules.GetSize()):
5252

5353
custom_module = custom_modules.GetItemAtIndex(id)
54-
if not custom_module or not custom_module.IsValid() or not custom_module.GetType() == lldb.eStructuredDataTypeDictionary:
54+
if (
55+
not custom_module
56+
or not custom_module.IsValid()
57+
or not custom_module.GetType() == lldb.eStructuredDataTypeDictionary
58+
):
5559
continue
5660

5761
# Get custom module path from args
5862
module_path_arg = custom_module.GetValueForKey("path")
5963
module_path = None
60-
if not module_path_arg or not module_path_arg.IsValid() or not module_path_arg.GetType() == lldb.eStructuredDataTypeString:
64+
if (
65+
not module_path_arg
66+
or not module_path_arg.IsValid()
67+
or not module_path_arg.GetType() == lldb.eStructuredDataTypeString
68+
):
6169
return
6270

6371
module_path = module_path_arg.GetStringValue(100)
6472
module_name = os.path.basename(module_path)
6573

6674
# Get ignore_module_load_error boolean from args
6775
ignore_module_load_error = False
68-
ignore_module_load_error_arg = custom_module.GetValueForKey("ignore_module_load_error")
69-
if ignore_module_load_error_arg and ignore_module_load_error_arg.IsValid() and ignore_module_load_error_arg.GetType() == lldb.eStructuredDataTypeBoolean:
70-
ignore_module_load_error = ignore_module_load_error_arg.GetBooleanValue()
76+
ignore_module_load_error_arg = custom_module.GetValueForKey(
77+
"ignore_module_load_error"
78+
)
79+
if (
80+
ignore_module_load_error_arg
81+
and ignore_module_load_error_arg.IsValid()
82+
and ignore_module_load_error_arg.GetType()
83+
== lldb.eStructuredDataTypeBoolean
84+
):
85+
ignore_module_load_error = (
86+
ignore_module_load_error_arg.GetBooleanValue()
87+
)
7188

7289
if not os.path.exists(module_path) and not ignore_module_load_error:
7390
return
7491

7592
# Get custom module load address from args
7693
module_load_addr = None
7794
module_load_addr_arg = custom_module.GetValueForKey("load_addr")
78-
if module_load_addr_arg and module_load_addr_arg.IsValid() and module_load_addr_arg.GetType() == lldb.eStructuredDataTypeInteger:
95+
if (
96+
module_load_addr_arg
97+
and module_load_addr_arg.IsValid()
98+
and module_load_addr_arg.GetType()
99+
== lldb.eStructuredDataTypeInteger
100+
):
79101
module_load_addr = module_load_addr_arg.GetIntegerValue()
80102

81103
# If module load address is not specified/valid, try to find it from corefile module
@@ -87,11 +109,19 @@ def __init__(self, exe_ctx: lldb.SBExecutionContext, args: lldb.SBStructuredData
87109
if not corefile_module or not corefile_module.IsValid():
88110
return
89111

90-
module_load_addr = corefile_module.GetObjectFileHeaderAddress().GetLoadAddress(
91-
self.corefile_target
112+
module_load_addr = (
113+
corefile_module.GetObjectFileHeaderAddress().GetLoadAddress(
114+
self.corefile_target
115+
)
92116
)
93117

94-
self.loaded_images.append({"path": module_path, "load_addr": module_load_addr, "ignore_module_load_error": ignore_module_load_error})
118+
self.loaded_images.append(
119+
{
120+
"path": module_path,
121+
"load_addr": module_load_addr,
122+
"ignore_module_load_error": ignore_module_load_error,
123+
}
124+
)
95125

96126
def get_memory_region_containing_address(
97127
self, addr: int
@@ -193,9 +223,9 @@ def get_stop_reason(self) -> Dict[str, Any]:
193223
if self.is_stopped:
194224
if "arm64" in self.scripted_process.arch:
195225
stop_reason["type"] = lldb.eStopReasonException
196-
stop_reason["data"][
197-
"desc"
198-
] = self.corefile_thread.GetStopDescription(100)
226+
stop_reason["data"]["desc"] = (
227+
self.corefile_thread.GetStopDescription(100)
228+
)
199229
elif self.scripted_process.arch == "x86_64":
200230
stop_reason["type"] = lldb.eStopReasonSignal
201231
stop_reason["data"]["signal"] = signal.SIGTRAP

0 commit comments

Comments
 (0)