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/functionalities/breakpoint/scripted_bkpt/was_hit/TestWasHit.py lldb/test/API/functionalities/breakpoint/scripted_bkpt/was_hit/bkpt_resolver.py lldb/test/API/functionalities/breakpoint/scripted_bkpt/resolver.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 --- was_hit/TestWasHit.py 2025-09-11 18:01:38.000000 +0000 +++ was_hit/TestWasHit.py 2025-09-11 18:12:02.876650 +0000 @@ -31,55 +31,72 @@ command = "command script import " + script_name self.runCmd(command) def make_extra_args(self, sym_name, num_locs, loc_to_miss): - return f' -k symbol -v {sym_name} -k num_locs -v {num_locs} -k loc_to_miss -v {loc_to_miss} ' + return f" -k symbol -v {sym_name} -k num_locs -v {num_locs} -k loc_to_miss -v {loc_to_miss} " def do_test(self): """This reads in a python file and sets a breakpoint using it.""" target = self.make_target_and_import() extra_args = self.make_extra_args("stop_symbol", 4, 2) - bkpt_no = lldbutil.run_break_set_by_script(self, "bkpt_resolver.FacadeExample", extra_args, 4) + bkpt_no = lldbutil.run_break_set_by_script( + self, "bkpt_resolver.FacadeExample", extra_args, 4 + ) # Make sure the help text shows up in the "break list" output: self.expect( "break list", substrs=["I am a facade resolver - sym: stop_symbol - num_locs: 4"], msg="Help is listed in break list", ) bkpt = target.FindBreakpointByID(bkpt_no) self.assertTrue(bkpt.IsValid(), "Found the right breakpoint") - + # Now continue. We should hit locations 1, 3 and 4: - (target, process, thread, bkpt) = lldbutil.run_to_breakpoint_do_run(self, target, bkpt) + (target, process, thread, bkpt) = lldbutil.run_to_breakpoint_do_run( + self, target, bkpt + ) # This location should be bkpt_no.1: - self.assertEqual(thread.stop_reason_data[0], bkpt_no, "Hit the right breakpoint") + self.assertEqual( + thread.stop_reason_data[0], bkpt_no, "Hit the right breakpoint" + ) self.assertEqual(thread.stop_reason_data[1], 1, "First location hit is 1") for loc in [3, 4]: process.Continue() - self.assertEqual(thread.stop_reason, lldb.eStopReasonBreakpoint, "Hit breakpoint") - self.assertEqual(thread.stop_reason_data[0], bkpt_no, "Hit the right breakpoint") - self.assertEqual(thread.stop_reason_data[1], loc, f"Hit the right location: {loc}") + self.assertEqual( + thread.stop_reason, lldb.eStopReasonBreakpoint, "Hit breakpoint" + ) + self.assertEqual( + thread.stop_reason_data[0], bkpt_no, "Hit the right breakpoint" + ) + self.assertEqual( + thread.stop_reason_data[1], loc, f"Hit the right location: {loc}" + ) # At this point we should have hit three of the four locations, and not location 1.2. # Check that that is true, and that the descriptions for the location are the ones # the resolver provided. self.assertEqual(bkpt.hit_count, 3, "Hit three locations") - for loc_id in range(1,4): + for loc_id in range(1, 4): bkpt_loc = bkpt.FindLocationByID(loc_id) self.assertTrue(bkpt_loc.IsValid(), f"{loc_id} was invalid.") if loc_id != 2: - self.assertEqual(bkpt_loc.hit_count, 1, f"Loc {loc_id} hit count was wrong") + self.assertEqual( + bkpt_loc.hit_count, 1, f"Loc {loc_id} hit count was wrong" + ) else: self.assertEqual(bkpt_loc.hit_count, 0, "We didn't skip loc 2") stream = lldb.SBStream() - self.assertTrue(bkpt_loc.GetDescription(stream, lldb.eDescriptionLevelFull), - f"Didn't get description for {loc_id}") - self.assertIn(f"Location index: {loc_id}", stream.GetData(), - f"Wrong desciption for {loc_id}") - - + self.assertTrue( + bkpt_loc.GetDescription(stream, lldb.eDescriptionLevelFull), + f"Didn't get description for {loc_id}", + ) + self.assertIn( + f"Location index: {loc_id}", + stream.GetData(), + f"Wrong desciption for {loc_id}", + ) --- was_hit/bkpt_resolver.py 2025-09-11 18:01:38.000000 +0000 +++ was_hit/bkpt_resolver.py 2025-09-11 18:12:02.901013 +0000 @@ -1,6 +1,7 @@ import lldb + class FacadeExample: def __init__(self, bkpt, extra_args, dict): self.bkpt = bkpt self.extra_args = extra_args @@ -9,37 +10,40 @@ self.facade_locs_desc = [] self.cur_facade_loc = 1 self.sym_name = extra_args.GetValueForKey("symbol").GetStringValue(100) self.num_locs = extra_args.GetValueForKey("num_locs").GetIntegerValue(5) - self.loc_to_miss = extra_args.GetValueForKey("loc_to_miss").GetIntegerValue(10000) + self.loc_to_miss = extra_args.GetValueForKey("loc_to_miss").GetIntegerValue( + 10000 + ) def __callback__(self, sym_ctx): self.base_sym = sym_ctx.module.FindSymbol(self.sym_name, lldb.eSymbolTypeCode) if self.base_sym.IsValid(): self.bkpt.AddLocation(self.base_sym.GetStartAddress()) # Locations are 1 based, so to keep things simple, I'm making # the array holding locations 1 based as well: - self.facade_locs_desc.append("This is the zero index, you shouldn't see this") + self.facade_locs_desc.append( + "This is the zero index, you shouldn't see this" + ) self.facade_locs.append(None) for i in range(1, self.num_locs + 1): self.facade_locs_desc.append(f"Location index: {i}") self.facade_locs.append(self.bkpt.AddFacadeLocation()) - + def get_short_help(self): return f"I am a facade resolver - sym: {self.sym_name} - num_locs: {self.num_locs} - locs_to_miss: {self.loc_to_miss}" def was_hit(self, frame, bp_loc): tmp_loc = self.cur_facade_loc - self.cur_facade_loc = (self.cur_facade_loc + 1) + self.cur_facade_loc = self.cur_facade_loc + 1 if self.cur_facade_loc == 5: - self.cur_facade_loc = 1 + self.cur_facade_loc = 1 if tmp_loc == self.loc_to_miss: return None return self.facade_locs[tmp_loc] def get_location_description(self, bp_loc, desc_level): return self.facade_locs_desc[bp_loc.id] - `````````` </details> https://github.com/llvm/llvm-project/pull/158128 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits