Skip to content

Commit c9b766e

Browse files
committed
Fix formatting
1 parent 2beeaab commit c9b766e

File tree

2 files changed

+73
-50
lines changed

2 files changed

+73
-50
lines changed

lldb/include/lldb/API/SBTarget.h

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -665,14 +665,15 @@ class LLDB_API SBTarget {
665665
const char *symbol_name,
666666
uint32_t
667667
name_type_mask, // Logical OR one or more FunctionNameType enum bits
668-
const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
668+
const SBFileSpecList &module_list,
669+
const SBFileSpecList &comp_unit_list);
669670

670671
lldb::SBBreakpoint BreakpointCreateByName(
671672
const char *symbol_name,
672673
uint32_t
673674
name_type_mask, // Logical OR one or more FunctionNameType enum bits
674-
lldb::LanguageType symbol_language, const SBFileSpecList &module_list,
675-
const SBFileSpecList &comp_unit_list);
675+
lldb::LanguageType symbol_language,
676+
const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
676677

677678
lldb::SBBreakpoint BreakpointCreateByName(
678679
const char *symbol_name,
@@ -709,21 +710,23 @@ class LLDB_API SBTarget {
709710
const char *symbol_name[], uint32_t num_names,
710711
uint32_t
711712
name_type_mask, // Logical OR one or more FunctionNameType enum bits
712-
const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
713+
const SBFileSpecList &module_list,
714+
const SBFileSpecList &comp_unit_list);
713715

714716
lldb::SBBreakpoint BreakpointCreateByNames(
715717
const char *symbol_name[], uint32_t num_names,
716718
uint32_t
717719
name_type_mask, // Logical OR one or more FunctionNameType enum bits
718-
lldb::LanguageType symbol_language, const SBFileSpecList &module_list,
719-
const SBFileSpecList &comp_unit_list);
720+
lldb::LanguageType symbol_language,
721+
const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
720722

721723
lldb::SBBreakpoint BreakpointCreateByNames(
722724
const char *symbol_name[], uint32_t num_names,
723725
uint32_t
724726
name_type_mask, // Logical OR one or more FunctionNameType enum bits
725-
lldb::LanguageType symbol_language, lldb::addr_t offset,
726-
const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
727+
lldb::LanguageType symbol_language,
728+
lldb::addr_t offset, const SBFileSpecList &module_list,
729+
const SBFileSpecList &comp_unit_list);
727730
#endif
728731

729732
lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex,
@@ -782,8 +785,10 @@ class LLDB_API SBTarget {
782785
/// An SBBreakpoint that will set locations based on the logic in the
783786
/// resolver's search callback.
784787
lldb::SBBreakpoint BreakpointCreateFromScript(
785-
const char *class_name, SBStructuredData &extra_args,
786-
const SBFileSpecList &module_list, const SBFileSpecList &file_list,
788+
const char *class_name,
789+
SBStructuredData &extra_args,
790+
const SBFileSpecList &module_list,
791+
const SBFileSpecList &file_list,
787792
bool request_hardware = false);
788793

789794
/// Read breakpoints from source_file and return the newly created

lldb/test/API/python_api/debugger/TestDebuggerAPI.py

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,25 @@ def test_AddDestroyCallback(self):
173173
def foo(dbg_id):
174174
# Need nonlocal to modify closure variable.
175175
nonlocal called
176-
called += [('foo', dbg_id)]
176+
called += [("foo", dbg_id)]
177177

178178
def bar(dbg_id):
179179
# Need nonlocal to modify closure variable.
180180
nonlocal called
181-
called += [('bar', dbg_id)]
181+
called += [("bar", dbg_id)]
182182

183183
token_foo = self.dbg.AddDestroyCallback(foo)
184184
token_bar = self.dbg.AddDestroyCallback(bar)
185185
self.dbg.Destroy(self.dbg)
186186

187187
# Should call both `foo()` and `bar()`.
188-
self.assertEqual(called, [
189-
('foo', original_dbg_id),
190-
('bar', original_dbg_id),
191-
])
188+
self.assertEqual(
189+
called,
190+
[
191+
("foo", original_dbg_id),
192+
("bar", original_dbg_id),
193+
],
194+
)
192195

193196
def test_RemoveDestroyCallback(self):
194197
original_dbg_id = self.dbg.GetID()
@@ -197,12 +200,12 @@ def test_RemoveDestroyCallback(self):
197200
def foo(dbg_id):
198201
# Need nonlocal to modify closure variable.
199202
nonlocal called
200-
called += [('foo', dbg_id)]
203+
called += [("foo", dbg_id)]
201204

202205
def bar(dbg_id):
203206
# Need nonlocal to modify closure variable.
204207
nonlocal called
205-
called += [('bar', dbg_id)]
208+
called += [("bar", dbg_id)]
206209

207210
token_foo = self.dbg.AddDestroyCallback(foo)
208211
token_bar = self.dbg.AddDestroyCallback(bar)
@@ -212,7 +215,7 @@ def bar(dbg_id):
212215
# `Remove` should be successful
213216
self.assertTrue(ret)
214217
# Should only call `bar()`
215-
self.assertEqual(called, [('bar', original_dbg_id)])
218+
self.assertEqual(called, [("bar", original_dbg_id)])
216219

217220
def test_RemoveDestroyCallback_invalid_token(self):
218221
original_dbg_id = self.dbg.GetID()
@@ -222,7 +225,7 @@ def test_RemoveDestroyCallback_invalid_token(self):
222225
def foo(dbg_id):
223226
# Need nonlocal to modify closure variable.
224227
nonlocal called
225-
called += [('foo', dbg_id)]
228+
called += [("foo", dbg_id)]
226229

227230
token_foo = self.dbg.AddDestroyCallback(foo)
228231
ret = self.dbg.RemoveDestroyCallback(magic_token_that_should_not_exist)
@@ -231,7 +234,7 @@ def foo(dbg_id):
231234
# `Remove` should be unsuccessful
232235
self.assertFalse(ret)
233236
# Should call `foo()`
234-
self.assertEqual(called, [('foo', original_dbg_id)])
237+
self.assertEqual(called, [("foo", original_dbg_id)])
235238

236239
def test_HandleDestroyCallback(self):
237240
"""
@@ -246,46 +249,52 @@ def test_HandleDestroyCallback(self):
246249
def foo(dbg_id):
247250
# Need nonlocal to modify closure variable.
248251
nonlocal events
249-
events.append(('foo called', dbg_id))
252+
events.append(("foo called", dbg_id))
250253

251254
def bar(dbg_id):
252255
# Need nonlocal to modify closure variable.
253256
nonlocal events
254-
events.append(('bar called', dbg_id))
257+
events.append(("bar called", dbg_id))
255258

256259
def add_foo(dbg_id):
257260
# Need nonlocal to modify closure variable.
258261
nonlocal events
259-
events.append(('add_foo called', dbg_id))
260-
events.append(('foo token', self.dbg.AddDestroyCallback(foo)))
262+
events.append(("add_foo called", dbg_id))
263+
events.append(("foo token", self.dbg.AddDestroyCallback(foo)))
261264

262265
def remove_bar(dbg_id):
263266
# Need nonlocal to modify closure variable.
264267
nonlocal events
265-
events.append(('remove_bar called', dbg_id))
266-
events.append(('remove bar ret', self.dbg.RemoveDestroyCallback(bar_token)))
268+
events.append(("remove_bar called", dbg_id))
269+
events.append(("remove bar ret", self.dbg.RemoveDestroyCallback(bar_token)))
267270

268271
# Setup
269-
events.append(('add_foo token', self.dbg.AddDestroyCallback(add_foo)))
272+
events.append(("add_foo token", self.dbg.AddDestroyCallback(add_foo)))
270273
bar_token = self.dbg.AddDestroyCallback(bar)
271-
events.append(('bar token', bar_token))
272-
events.append(('remove_bar token', self.dbg.AddDestroyCallback(remove_bar)))
274+
events.append(("bar token", bar_token))
275+
events.append(("remove_bar token", self.dbg.AddDestroyCallback(remove_bar)))
273276
# Destroy
274277
self.dbg.Destroy(self.dbg)
275278

276-
self.assertEqual(events, [
277-
# Setup
278-
('add_foo token', 0), # add_foo should be added
279-
('bar token', 1), # bar should be added
280-
('remove_bar token', 2), # remove_bar should be added
281-
# Destroy
282-
('add_foo called', original_dbg_id), # add_foo should be called
283-
('foo token', 3), # foo should be added
284-
('bar called', original_dbg_id), # bar should be called
285-
('remove_bar called', original_dbg_id), # remove_bar should be called
286-
('remove bar ret', False), # remove_bar should fail, because it's already invoked and removed
287-
('foo called', original_dbg_id), # foo should be called
288-
])
279+
self.assertEqual(
280+
events,
281+
[
282+
# Setup
283+
("add_foo token", 0), # add_foo should be added
284+
("bar token", 1), # bar should be added
285+
("remove_bar token", 2), # remove_bar should be added
286+
# Destroy
287+
("add_foo called", original_dbg_id), # add_foo should be called
288+
("foo token", 3), # foo should be added
289+
("bar called", original_dbg_id), # bar should be called
290+
("remove_bar called", original_dbg_id), # remove_bar should be called
291+
(
292+
"remove bar ret",
293+
False,
294+
), # remove_bar should fail, because it's already invoked and removed
295+
("foo called", original_dbg_id), # foo should be called
296+
],
297+
)
289298

290299
def test_version(self):
291300
instance_str = self.dbg.GetVersionString()
@@ -406,23 +415,32 @@ def test_target_globally_unique_id_across_debuggers(self):
406415
# Create two debuggers with targets each
407416
debugger1 = lldb.SBDebugger.Create()
408417
debugger2 = lldb.SBDebugger.Create()
409-
418+
410419
# Create 2 targets per debugger
411420
targets_d1 = [debugger1.CreateTarget(exe), debugger1.CreateTarget(exe)]
412421
targets_d2 = [debugger2.CreateTarget(exe), debugger2.CreateTarget(exe)]
413422
targets = targets_d1 + targets_d2
414-
423+
415424
# Get all IDs and verify they're unique
416425
ids = [target.GetGloballyUniqueID() for target in targets]
417-
self.assertEqual(len(set(ids)), len(ids), f"IDs should be globally unique: {ids}")
426+
self.assertEqual(
427+
len(set(ids)), len(ids), f"IDs should be globally unique: {ids}"
428+
)
418429
self.assertTrue(all(uid > 0 for uid in ids), "All IDs should be non-zero")
419-
430+
420431
# Verify targets can be found by their IDs in respective debuggers
421-
for debugger, target_pair in [(debugger1, targets[:2]), (debugger2, targets[2:])]:
432+
for debugger, target_pair in [
433+
(debugger1, targets[:2]),
434+
(debugger2, targets[2:]),
435+
]:
422436
for target in target_pair:
423437
found = debugger.FindTargetWithUniqueID(target.GetGloballyUniqueID())
424-
self.assertTrue(found.IsValid(), "Target should be found by its unique ID")
425-
self.assertEqual(found.GetGloballyUniqueID(), target.GetGloballyUniqueID())
438+
self.assertTrue(
439+
found.IsValid(), "Target should be found by its unique ID"
440+
)
441+
self.assertEqual(
442+
found.GetGloballyUniqueID(), target.GetGloballyUniqueID()
443+
)
426444

427445
# Clean up
428446
lldb.SBDebugger.Destroy(debugger1)

0 commit comments

Comments
 (0)