[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
github-actions[bot] wrote: @kendalharland Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail [here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr). If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of [LLVM development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy). You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
kendalharland wrote: I'll need help merging this since I don't have write access to the repo. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
kendalharland wrote: Apologies, I push the wrong commits to this PR and just had the fix them up. Should be good to go. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From e3715f9928c6cd96a6cc96ea3cea8a8a735a7556 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 +-- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..d660844405e13 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,28 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 1 here", main_dot_c ) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 +bp2 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 2 here", main_dot_c ) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +70,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +77,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From 0ec149a364061432a9b7bd8d79ddbb5706b182dc Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 --- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..deb30669cc40e 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,24 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 -) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 -) +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c) +bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +66,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +73,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From 108865deb28016f6ebe7c507e082e0998a4d4839 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 1 Jul 2024 10:33:51 -0700 Subject: [PATCH 1/3] Fix type error when calling random.randrange with 'float' arg --- .../tools/lldb-server/commandline/TestGdbRemoteConnection.py| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py b/lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py index 853b7ad5ef290..f31a57b767c72 100644 --- a/lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py +++ b/lldb/test/API/tools/lldb-server/commandline/TestGdbRemoteConnection.py @@ -75,7 +75,7 @@ def __init__(self): class Pipe(object): def __init__(self, prefix): while True: -self.name = "lldb-" + str(random.randrange(1e10)) +self.name = "lldb-" + str(random.randrange(int(1e10))) full_name = ".\\pipe\\" + self.name self._handle = CreateNamedPipe( full_name, >From 0897e9ad65ca1ecb5ffa00afefaed3674a2bd140 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 1 Jul 2024 10:20:08 -0700 Subject: [PATCH 2/3] Disable TestUseSourceCache on Windows amd64 This test also fails on Windows amd64, although it is only disabled for aarch64. --- .../commands/settings/use_source_cache/TestUseSourceCache.py| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py b/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py index c54345af4994c..421599080a9e5 100644 --- a/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py +++ b/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py @@ -18,7 +18,7 @@ def test_set_use_source_cache_false(self): self.set_use_source_cache_and_test(False) @skipIf(hostoslist=no_match(["windows"])) -@skipIf(oslist=["windows"], archs=["aarch64"]) # Fails on windows 11 +@skipIf(oslist=["windows"]) # Fails on windows 11 def test_set_use_source_cache_true(self): """Test that after 'set use-source-cache false', files are locked.""" self.set_use_source_cache_and_test(True) >From 401e4a823037d8b7fece752f5a2c9fcabfe25bd5 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH 3/3] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 --- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..deb30669cc40e 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,24 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 -) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 -) +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c) +bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +66,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:")
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From b880f6d7951534fd90c3728fb9cabbe515295557 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH 1/2] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 +-- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..d660844405e13 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,28 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 1 here", main_dot_c ) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 +bp2 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 2 here", main_dot_c ) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +70,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +77,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() >From b579f4cf8a234331f0a8b2f276d438c22980a322 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 14:01:31 -0700 Subject: [PATCH 2/2] Fix test assertions in TestDAP_stepInTargets.py --- .../stepInTargets/TestDAP_stepInTargets.py| 25 +-- .../API/tools/lldb-dap/stepInTargets/main.cpp | 6 ++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py index 6296f6554d07e..4b7caf99e95cc 100644 --- a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py +++ b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py @@ -55,14 +55,23 @@ def test_basic(self): self.assertEqual(len(step_in_targets), 3, "expect 3 step in targets") # Verify the target names are correct. -self.assertEqual(step_in_targets[0]["label"], "bar()", "expect bar()") -self.assertEqual(step_in_targets[1]["label"], "bar2()", "expect bar2()") -self.assertEqual( -step_in_targets[2]["label"], "foo(int, int)", "expect foo(int, int)" -) +# The order of funcA and funcB may change depending on the compiler ABI. +funcA_target = None +funcB_target = None +for target in step_in_targets[0:2]: +if "funcB" in target["label"]: +funcB_target = target +elif "funcA" in target["label"]: +funcA_target = target +else: +self.fail(f"Unexpected step in target: {target}") + +self.assertIsNotNone(funcA_target, "expect funcA") +self.assertIsNotNone(funcB_target, "expect funcB") +self.assertIn("foo", step_in_targets[2]["label"], "expect foo") -# Choose to step into second target and verify th
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
kendalharland wrote: Applied formatter patch and rebased onto main https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From b880f6d7951534fd90c3728fb9cabbe515295557 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 +-- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..d660844405e13 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,28 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 1 here", main_dot_c ) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 +bp2 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 2 here", main_dot_c ) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +70,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +77,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From a3c524bebfc976f3dfee5b67dac490ed44705d6a Mon Sep 17 00:00:00 2001 From: kendal Date: Wed, 3 Jul 2024 11:18:43 -0700 Subject: [PATCH 1/2] Fix type error when calling random.randrange with 'float' arg --- .../lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py index 5bd352d3ac549..94376a16d39f6 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py @@ -1042,7 +1042,7 @@ def __init__(self): class Pipe(object): def __init__(self, prefix): while True: -self.name = "lldb-" + str(random.randrange(1e10)) +self.name = "lldb-" + str(random.randrange(10**10)) full_name = ".\\pipe\\" + self.name self._handle = CreateNamedPipe( full_name, >From e5f11c6c57980b75fd68451971db75f6ef0a777a Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH 2/2] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 +-- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..d660844405e13 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,28 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 1 here", main_dot_c ) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 +bp2 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 2 here", main_dot_c ) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +70,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +77,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
kendalharland wrote: Sure thing, I hadn't hooked up the formatter yet so I'll run it and reupload. Thanks for the reviews! https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
bulbazord wrote: Yes, looks good to me. Thanks for taking the time! :) https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
labath wrote: > > Looks good. Are you able to merge this on your own? > > Nope, I'll need someone with write access to do it. Sounds good. Can you just patch the formatter changes in, and then I'll submit it. @bulbazord, if you don't respond, I'm going to assume that new version addresses your comments as well. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r 7c83b7ef1796210451b839f4c58f2815f4aedfe5...e3d44a2fed3d4129e245d5695c3af0c21bb7b329 lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py `` View the diff from darker here. ``diff --- TestZerothFrame.py 2024-07-01 21:17:03.00 + +++ TestZerothFrame.py 2024-07-02 07:24:38.100392 + @@ -39,12 +39,16 @@ exe = self.getBuildArtifact("a.out") target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) main_dot_c = lldb.SBFileSpec("main.c") -bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c) -bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c) +bp1 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 1 here", main_dot_c +) +bp2 = target.BreakpointCreateBySourceRegex( +"// Set breakpoint 2 here", main_dot_c +) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) thread = self.thread() `` https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From e3d44a2fed3d4129e245d5695c3af0c21bb7b329 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 --- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..deb30669cc40e 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,24 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 -) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 -) +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c) +bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +66,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +73,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
kendalharland wrote: > Looks good. Are you able to merge this on your own? Nope, I'll need someone with write access to do it. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From 1d2c11e18e833104279fa6a005e4a64bb7be6216 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 --- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..deb30669cc40e 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,24 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 -) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 -) +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c) +bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +66,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +73,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/labath approved this pull request. Looks good. Are you able to merge this on your own? https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
kendalharland wrote: > This should be fine, although looking at the test case again, I think that > even simply replacing process.GetThreadAtIndex(0) with self.thread() should > be enough. self.thread() returns the "selected" thread and lldb should always > be selecting the thread which has stopped "for a reason" (e.g. a breakpoint) > and not a random (or first) thread in the process. This also works. Agreed it's much better. Ty for the suggestion! Updated. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From 1d2c11e18e833104279fa6a005e4a64bb7be6216 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 23 --- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..deb30669cc40e 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,24 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 -) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 -) +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c) +bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = self.thread() + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +66,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +73,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/labath approved this pull request. This should be fine, although looking at the test case again, I think that even simply replacing `process.GetThreadAtIndex(0)` with `self.thread()` should be enough. `self.thread()` returns the "selected" thread and lldb should always be selecting the thread which has stopped "for a reason" (e.g. a breakpoint) and not a random (or first) thread in the process. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From abc87f3cbadc47f7f0bfaf01fcdf7f7c6d4bfeb5 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 26 +-- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..7ccd85e5b1044 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -40,28 +40,27 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 -) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 -) +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c) +bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +# Get the thread executing a.out. +threads = lldbutil.get_threads_stopped_at_breakpoint(process, bp1) +self.assertEqual(len(threads), 1) +thread = threads[0] + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +69,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +76,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
kendalharland wrote: > The thread that you care about is stopped at a breakpoint, right? If so, then > you can use the lldbutil.get_threads_stopped_at_breakpoint utility to find > it... Thanks, this eventually led to me what I think is the most obvious solution: We can just set the breakpoints in this test while holding onto to the `SBBreakpoint` objects, and then fetch the associated thread from those breakpoints later, and compare the thread's frames' currently line numbers. Thanks @JDevlieghere and @bulbazord for the additional suggestions! https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From 836b5ee62a5e1e31fe973e1f4ff6cd47f10eca84 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By selecting the thread based on whether it is stopped at our breakpoint we can reliably select the correct one. --- .../unwind/zeroth_frame/TestZerothFrame.py| 32 +++ 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..d6a1be8052995 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -28,6 +28,12 @@ class ZerothFrame(TestBase): +def _is_thread_executing_file(self, thread, file_basename): +frame = thread.GetSelectedFrame() +module = frame.GetModule() +filename = module.GetFileSpec().GetFilename() +return os.path.basename(filename) == file_basename + def test(self): """ Test that line information is recalculated properly for a frame when it moves @@ -40,28 +46,27 @@ def test(self): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) -bp1_line = line_number("main.c", "// Set breakpoint 1 here") -bp2_line = line_number("main.c", "// Set breakpoint 2 here") - -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp1_line, num_expected_locations=1 -) -lldbutil.run_break_set_by_file_and_line( -self, "main.c", bp2_line, num_expected_locations=1 -) +main_dot_c = lldb.SBFileSpec("main.c") +bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c) +bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +# Get the thread executing a.out. +threads = lldbutil.get_threads_stopped_at_breakpoint(process, bp1) +self.assertEqual(len(threads), 1) +thread = threads[0] + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), -bp1_line, +thread.frame[0].GetLineEntry().GetLine(), +bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) @@ -70,7 +75,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: @@ -78,7 +82,7 @@ def test(self): # Check that we have stopped at the breakpoint self.assertEqual( thread.frame[0].GetLineEntry().GetLine(), -bp2_line, +bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(), "LLDB reported incorrect line number.", ) # Double-check with GetPCAddress() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From 1ca25a240cf459e16fb762f750e84260610c1077 Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By switching from `process.GetThreadAtIndex` to `process.GetThreadByIndex` we consistently retrieve the correct thread. Adds a helper function to find thread executing a file --- .../unwind/zeroth_frame/TestZerothFrame.py| 20 --- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..892522f5cc63e 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -28,6 +28,12 @@ class ZerothFrame(TestBase): +def _is_thread_executing_file(self, thread, file_basename): +frame = thread.GetSelectedFrame() +module = frame.GetModule() +filename = module.GetFileSpec().GetFilename() +return os.path.basename(filename) == file_basename + def test(self): """ Test that line information is recalculated properly for a frame when it moves @@ -53,14 +59,23 @@ def test(self): process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +# Find the thread that is running a.out. +thread = None +for i in range(len(process.thread)): +if self._is_thread_executing_file(process.thread[i], "a.out"): +thread = process.thread[i] +break + +self.assertTrue(thread != None, "failed to find thread executing a.out") + if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), +thread.frame[0].GetLineEntry().GetLine(), bp1_line, "LLDB reported incorrect line number.", ) @@ -70,7 +85,6 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
labath wrote: The thread that you care about is stopped at a breakpoint, right? If so, then you can use the `lldbutil.get_threads_stopped_at_breakpoint` utility to find it... https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
JDevlieghere wrote: > Sounds reasonable. I'll work that out with a helper method and resend for > review once I upload a new commit. @bulbazord any idea how I can access the > module from the `SBThread` object, to compare it against the name `a.out`? > I'm having trouble finding the right API. The module is a property of the target, so you could do: ``` process = thread.GetProcess() target = process.GetTarget() module = target.GetModuleAtIndex(0) ``` or you can create an ExecutionContext from the thread, and get the target from that: ``` exe_ctx = SBExecutionContext(thread) exe_ctx.target.GetModuleAtIndex(0) ``` https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
kendalharland wrote: > Instead of assuming the thread's index or index ID, it might be a good idea > to have a little helper method that can look through the inferior's threads > to find the thread with the property that we care about. In this case, we're > looking for the thread that's stopped in a specific module (`a.out` in this > case). > > Concurrent execution and thread order is not guaranteed to be stable between > runs, even if in practice they end up being that way on some platforms. The > less we can rely on specific indices or IDs that "should" be correct, the > better. Sounds reasonable. I'll work that out with a helper method and resend for review once I upload a new commit. @bulbazord any idea how I can access the module from the `SBThread` object? I'm having trouble finding the right API. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/bulbazord edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/bulbazord requested changes to this pull request. Instead of assuming the thread's index or index ID, it might be a good idea to have a little helper method that can look through the inferior's threads to find the thread with the property that we care about. In this case, we're looking for the thread that's stopped in a specific module (`a.out` in this case). Concurrency and thread order is not guaranteed to be stable, even if in practice they end up being that way on some platforms. The less we can rely on specific indices or IDs that "should" be correct, the better. https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96685 >From 97242b723de7fd4dcb14bd8481acc2254ab852ea Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py This test is relying on the order of `process.threads` which is nondeterministic. By switching from `process.GetThreadAtIndex` to `process.GetThreadByIndex` we consistently retrieve the correct thread. --- .../functionalities/unwind/zeroth_frame/TestZerothFrame.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..7e4078bbe887f 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -53,14 +53,15 @@ def test(self): process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = process.GetThreadByIndexID(1) if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), +thread.frame[0].GetLineEntry().GetLine(), bp1_line, "LLDB reported incorrect line number.", ) @@ -70,7 +71,7 @@ def test(self): # 'continue' command. process.Continue() -thread = process.GetThreadAtIndex(0) +thread = process.GetThreadByIndexID(1) if self.TraceOn(): print("Backtrace at the second breakpoint:") for f in thread.frames: ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland edited https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Kendal Harland (kendalharland) Changes This test is currently flaky on a local Windows amd64 build. If we print lldb's inputs and outputs while running, we can see that the breakpoints are always being set correctly, and always being hit: ```sh runCmd: breakpoint set -f "main.c" -l 2 output: Breakpoint 1: where = a.out`func_inner + 1 at main.c:2:9, address = 0x000140001001 runCmd: breakpoint set -f "main.c" -l 7 output: Breakpoint 2: where = a.out`main + 17 at main.c:7:5, address = 0x000140001021 runCmd: run output: Process 52328 launched: 'C:\workspace\llvm-project\llvm\build\lldb-test-build.noindex\functionalities\unwind\zeroth_frame\TestZerothFrame.test_dwarf\a.out' (x86_64) Process 52328 stopped * thread #1, stop reason = breakpoint 1.1 frame #0: 0x7ff68f6b1001 a.out`func_inner at main.c:2:9 1void func_inner() { -> 2int a = 1; // Set breakpoint 1 here ^ 3} 4 5int main() { 6func_inner(); 7return 0; // Set breakpoint 2 here ``` However, sometimes the backtrace printed in this test shows that the process is stopped inside NtWaitForWorkViaWorkerFactory from `ntdll.dll`: ```sh Backtrace at the first breakpoint: frame #0: 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 frame #1: 0x7ffecc74585e ntdll.dll`RtlClearThreadWorkOnBehalfTicket + 862 frame #2: 0x7ffecc3e257d kernel32.dll`BaseThreadInitThunk + 29 frame #3: 0x7ffecc76af28 ntdll.dll`RtlUserThreadStart + 40 ``` If we print the list of threads each time the test is run, we notice that threads are sometimes in a different order, within `process.threads`: ```sh Thread 0: thread #4: tid = 0x9c38, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 1: thread #2: tid = 0xa950, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 2: thread #1: tid = 0xab18, 0x7ff64bc81001 a.out`func_inner at main.c:2:9, stop reason = breakpoint 1.1 Thread 3: thread #3: tid = 0xc514, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 0: thread #3: tid = 0x018c, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 1: thread #1: tid = 0x85c8, 0x7ff7130c1001 a.out`func_inner at main.c:2:9, stop reason = breakpoint 1.1 Thread 2: thread #2: tid = 0xf344, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 3: thread #4: tid = 0x6a50, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 ``` We're interested in whichever thread is executing `a.out`. If we print more info, we can see that this thread always has an `IndexID` of 1 regardless of where it appars in `process.threads`: ```sh Thread 0: thread #3: tid = 0x2474, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 -- GetName: -- GetQueueName: None -- GetQueueID: 0 -- GetIndexId: 3 Thread 1: thread #2: tid = 0x2864, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 -- GetName: -- GetQueueName: None -- GetQueueID: 0 -- GetIndexId: 2 Thread 2: thread #4: tid = 0x9c90, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 -- GetName: -- GetQueueName: None -- GetQueueID: 0 -- GetIndexId: 4 Thread 3: thread #1: tid = 0xebbc, 0x7ff643331001 a.out`func_inner at main.c:2:9, stop reason = breakpoint 1.1 -- GetName: -- GetQueueName: None -- GetQueueID: 0 -- GetIndexId: 1 ``` By switching from `process.GetThreadAtIndex` to `process.GetThreadByIndex` we consistently retrieve the correct thread. This raises a few more questions that might lead to a different followup solution: 1. Why does our target thread always have an `IndexID` of 1? Why not 0 or any other value? 2. Why is `process.threads` non-deterministically ordered? --- Full diff: https://github.com/llvm/llvm-project/pull/96685.diff 1 Files Affected: - (modified) lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py (+4-3) ``diff diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py index f4e883d314644..7e4078bbe887f 100644 --- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py +++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py @@ -53,14 +53,15 @@ def test(self): process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, VALID_PROCESS) -thread = process.GetThreadAtIndex(0) +thread = process.GetThreadByIndexID(1) if self.TraceOn(): print("Backtrace at the first breakpoint:") for f in thread.frames: print(f) + # Check that we have stopped at correct breakpoint. self.assertEqual( -process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(), +thread.frame[0].GetLineEntry().GetLine(),
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/96685 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flake in TestZerothFrame.py (PR #96685)
https://github.com/kendalharland created https://github.com/llvm/llvm-project/pull/96685 This test is currently flaky on a local Windows amd64 build. If we print lldb's inputs and outputs while running, we can see that the breakpoints are always being set correctly, and always being hit: ```sh runCmd: breakpoint set -f "main.c" -l 2 output: Breakpoint 1: where = a.out`func_inner + 1 at main.c:2:9, address = 0x000140001001 runCmd: breakpoint set -f "main.c" -l 7 output: Breakpoint 2: where = a.out`main + 17 at main.c:7:5, address = 0x000140001021 runCmd: run output: Process 52328 launched: 'C:\workspace\llvm-project\llvm\build\lldb-test-build.noindex\functionalities\unwind\zeroth_frame\TestZerothFrame.test_dwarf\a.out' (x86_64) Process 52328 stopped * thread #1, stop reason = breakpoint 1.1 frame #0: 0x7ff68f6b1001 a.out`func_inner at main.c:2:9 1void func_inner() { -> 2int a = 1; // Set breakpoint 1 here ^ 3} 4 5int main() { 6func_inner(); 7return 0; // Set breakpoint 2 here ``` However, sometimes the backtrace printed in this test shows that the process is stopped inside NtWaitForWorkViaWorkerFactory from `ntdll.dll`: ```sh Backtrace at the first breakpoint: frame #0: 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 frame #1: 0x7ffecc74585e ntdll.dll`RtlClearThreadWorkOnBehalfTicket + 862 frame #2: 0x7ffecc3e257d kernel32.dll`BaseThreadInitThunk + 29 frame #3: 0x7ffecc76af28 ntdll.dll`RtlUserThreadStart + 40 ``` If we print the list of threads each time the test is run, we notice that threads are sometimes in a different order, within `process.threads`: ```sh Thread 0: thread #4: tid = 0x9c38, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 1: thread #2: tid = 0xa950, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 2: thread #1: tid = 0xab18, 0x7ff64bc81001 a.out`func_inner at main.c:2:9, stop reason = breakpoint 1.1 Thread 3: thread #3: tid = 0xc514, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 0: thread #3: tid = 0x018c, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 1: thread #1: tid = 0x85c8, 0x7ff7130c1001 a.out`func_inner at main.c:2:9, stop reason = breakpoint 1.1 Thread 2: thread #2: tid = 0xf344, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 Thread 3: thread #4: tid = 0x6a50, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 ``` We're interested in whichever thread is executing `a.out`. If we print more info, we can see that this thread always has an `IndexID` of 1 regardless of where it appars in `process.threads`: ```sh Thread 0: thread #3: tid = 0x2474, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 -- GetName: -- GetQueueName: None -- GetQueueID: 0 -- GetIndexId: 3 Thread 1: thread #2: tid = 0x2864, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 -- GetName: -- GetQueueName: None -- GetQueueID: 0 -- GetIndexId: 2 Thread 2: thread #4: tid = 0x9c90, 0x7ffecc7b3bf4 ntdll.dll`NtWaitForWorkViaWorkerFactory + 20 -- GetName: -- GetQueueName: None -- GetQueueID: 0 -- GetIndexId: 4 Thread 3: thread #1: tid = 0xebbc, 0x7ff643331001 a.out`func_inner at main.c:2:9, stop reason = breakpoint 1.1 -- GetName: -- GetQueueName: None -- GetQueueID: 0 -- GetIndexId: 1 ``` By switching from `process.GetThreadAtIndex` to `process.GetThreadByIndex` we consistently retrieve the correct thread. This raises a few more questions that might lead to a different followup solution: 1. Why does our target thread always have an `IndexID` of 1? Why not 0 or any other value? 2. Why is `process.threads` non-deterministically ordered? >From 5f23d2c48252c880a20e04f273d2d34b80758b6f Mon Sep 17 00:00:00 2001 From: kendal Date: Mon, 24 Jun 2024 13:42:20 -0700 Subject: [PATCH] Fix flake in TestZerothFrame.py If we print lldb's input and output while running this test, we can see that the breakpoints are always being set correctly, and always being hit: ```sh runCmd: breakpoint set -f "main.c" -l 2 output: Breakpoint 1: where = a.out`func_inner + 1 at main.c:2:9, address = 0x000140001001 runCmd: breakpoint set -f "main.c" -l 7 output: Breakpoint 2: where = a.out`main + 17 at main.c:7:5, address = 0x000140001021 runCmd: run output: Process 52328 launched: 'C:\workspace\llvm-project\llvm\build\lldb-test-build.noindex\functionalities\unwind\zeroth_frame\TestZerothFrame.test_dwarf\a.out' (x86_64) Process 52328 stopped * thread #1, stop reason = breakpoint 1.1 frame #0: 0x7ff68f6b1001 a.out`func_inner at main.c:2:9 1void func_inner() { -> 2int a = 1; // Set breakpoint 1 here ^ 3} 4 5int main() { 6func_inner(); 7return 0; // Set breakpoint 2 here ``` However, sometimes the backtrace printed in this test shows that the p