[Lldb-commits] [lldb] Make stop-hooks fire when lldb first gains control of a process. (PR #137410)
Prabhuk wrote: My team builds lldb on linux X64 and running into a test failure since this patch had landed. Builder link: https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/lldb-linux-x64/b8713139267610948369/overview I am taking a closer look. CC: @mysterymath ``` FAIL: lldb-api :: commands/target/stop-hooks/TestStopHookScripted.py (285 of 2899) TEST 'lldb-api :: commands/target/stop-hooks/TestStopHookScripted.py' FAILED Script: -- /b/s/w/ir/x/w/install-cpython-x86_64-linux-gnu/bin/python3 /b/s/w/ir/x/w/llvm-llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/b/s/w/ir/x/w/llvm_build/./lib --env LLVM_INCLUDE_DIR=/b/s/w/ir/x/w/llvm_build/include --env LLVM_TOOLS_DIR=/b/s/w/ir/x/w/llvm_build/./bin --arch x86_64 --build-dir /b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex --lldb-module-cache-dir /b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /b/s/w/ir/x/w/llvm_build/./bin/lldb --compiler /b/s/w/ir/x/w/cipd/clang/bin/clang --dsymutil /b/s/w/ir/x/w/llvm_build/./bin/dsymutil --make /b/s/w/ir/x/w/cipd/bin/make --llvm-tools-dir /b/s/w/ir/x/w/llvm_build/./bin --lldb-obj-root /b/s/w/ir/x/w/llvm_build/tools/lldb --lldb-libs-dir /b/s/w/ir/x/w/llvm_build/./lib --cmake-build-type Release --skip-category=pexpect /b/s/w/ir/x/w/llvm-llvm-project/lldb/test/API/commands/target/stop-hooks -p TestStopHookScripted.py -- Exit Code: 1 Command Output (stdout): -- lldb version 21.0.0git (https://llvm.googlesource.com/a/llvm-project revision d313c09b288c31f93819408048b0b64ca5c5fc2b) clang revision d313c09b288c31f93819408048b0b64ca5c5fc2b llvm revision d313c09b288c31f93819408048b0b64ca5c5fc2b I have stopped 1 times. Returning value: 1 from handle_stop. I have stopped 1 times. Returning value: 1 from handle_stop. I have stopped 2 times. Returning value: 1 from handle_stop. I have stopped 1 times. Returning value: 1 from handle_stop. I have stopped 2 times. Returning value: 1 from handle_stop. I have stopped 1 times. Returning value: 0 from handle_stop. I have stopped 2 times. Error running expression: can't evaluate expressions when the process is running.Returning value: 0 from handle_stop. I have stopped 1 times. Returning value: 1 from handle_stop. I have stopped 2 times. Returning value: 1 from handle_stop. I have stopped 1 times. Returning value: 1 from handle_stop. I have stopped 1 times. Returning value: 1 from handle_stop. Skipping the following test categories: ['pexpect', 'dsym', 'gmodules', 'debugserver', 'objc'] I am okay I am okay -- Command Output (stderr): -- PASS: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_bad_handler (TestStopHookScripted.TestStopHooks.test_bad_handler) PASS: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_stop_hooks_scripted (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted) FAIL: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_stop_hooks_scripted_auto_continue (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_auto_continue) PASS: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_stop_hooks_scripted_no_entry (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_no_entry) PASS: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_stop_hooks_scripted_return_false (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_return_false) FAIL: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_stop_hooks_scripted_right_func (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_right_func) PASS: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_stop_hooks_scripted_right_lines (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_right_lines) FAIL: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_stop_hooks_scripted_wrong_func (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_wrong_func) PASS: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: test_stop_hooks_scripted_wrong_lines (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_wrong_lines) == FAIL: test_stop_hooks_scripted_auto_continue (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_auto_continue) Test that the --auto-continue flag works -- Traceback (most recent call last): File "/b/s/w/ir/x/w/llvm-llvm-project/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py", line 77, in test_stop_hooks_scripted_auto_continue self.do_test_auto_continue(False) File "/b/s/w/ir/x/w/llvm-llvm-project/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py", line 118, in do_test_auto_continue self.assertEqual(var.GetValueAsUnsigned(), 6, "Updated g_var") AssertionError: 11 !=
[Lldb-commits] [lldb] Make stop-hooks fire when lldb first gains control of a process. (PR #137410)
Prabhuk wrote: @jimingham The suggested fix did not address the test failures. Log file: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8712946848893941121/+/u/test_lldb/check_lldb/stdout The builder attempted this run from here: The builder ran the tests from here: https://github.com/llvm/llvm-project/commit/fbd30e50644ec0c4d9fec4f4927a3488933fa376 This is reflected in the commit hash from the log message below. ``` FAIL: lldb-api :: commands/target/stop-hooks/TestStopHookScripted.py (281 of 2903) TEST 'lldb-api :: commands/target/stop-hooks/TestStopHookScripted.py' FAILED Script: -- /b/s/w/ir/x/w/install-cpython-x86_64-linux-gnu/bin/python3 /b/s/w/ir/x/w/github-prabhuk-llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/b/s/w/ir/x/w/llvm_build/./lib --env LLVM_INCLUDE_DIR=/b/s/w/ir/x/w/llvm_build/include --env LLVM_TOOLS_DIR=/b/s/w/ir/x/w/llvm_build/./bin --arch x86_64 --build-dir /b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex --lldb-module-cache-dir /b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /b/s/w/ir/x/w/llvm_build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /b/s/w/ir/x/w/llvm_build/./bin/lldb --compiler /b/s/w/ir/x/w/cipd/clang/bin/clang --dsymutil /b/s/w/ir/x/w/llvm_build/./bin/dsymutil --make /b/s/w/ir/x/w/cipd/bin/make --llvm-tools-dir /b/s/w/ir/x/w/llvm_build/./bin --lldb-obj-root /b/s/w/ir/x/w/llvm_build/tools/lldb --lldb-libs-dir /b/s/w/ir/x/w/llvm_build/./lib --cmake-build-type Release --skip-category=pexpect /b/s/w/ir/x/w/github-prabhuk-llvm-project/lldb/test/API/commands/target/stop-hooks -p TestStopHookScripted.py -- Exit Code: 1 Command Output (stdout): -- lldb version 21.0.0git (https://github.com/prabhuk/llvm-project revision fbd30e50644ec0c4d9fec4f4927a3488933fa376) clang revision fbd30e50644ec0c4d9fec4f4927a3488933fa376 llvm revision fbd30e50644ec0c4d9fec4f4927a3488933fa376 I have stopped 1 times. Returning value: 1 from handle_stop. I have stopped 1 times. ``` https://github.com/llvm/llvm-project/pull/137410 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix linux x64 test (PR #143048)
https://github.com/Prabhuk closed https://github.com/llvm/llvm-project/pull/143048 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix linux x64 test (PR #143048)
Prabhuk wrote: > I still don't understand the failures that triggered this patch - stopping at > the entry point somehow is at a place where both the function name filter for > `main` and `step_into_me` pass - even though that should be the same > stop-point for both checks. That seems quite odd. > > But this test was not intending to test entry point behavior, so it's fine to > exclude this for the purposes of this test. > > You still have to fix the Python formatting but then this should be fine. Can we file a bug for this? If there are patches that you'd like me to try in our environment to address the bug I'll be happy to do so. https://github.com/llvm/llvm-project/pull/143048 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix linux x64 test (PR #143048)
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/143048 >From d1371371fbcfd6f8113e2d04707f80a7c439d287 Mon Sep 17 00:00:00 2001 From: prabhukr Date: Thu, 5 Jun 2025 22:52:24 + Subject: [PATCH 1/2] [lldb] Fix linux x64 test Test was failing for cases where -I 0 was not passed to stop-hook add calls. --- .../target/stop-hooks/TestStopHookScripted.py| 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py index b71f3421f9834..71f805e7f296b 100644 --- a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py +++ b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py @@ -58,19 +58,19 @@ def test_stop_hooks_scripted_no_entry(self): def test_stop_hooks_scripted_right_func(self): """Test that a scripted stop hook fires when there is a function match""" -self.stop_hooks_scripted(5, "-n step_out_of_me") +self.stop_hooks_scripted(5, "-I 0 -n step_out_of_me") def test_stop_hooks_scripted_wrong_func(self): """Test that a scripted stop hook doesn't fire when the function does not match""" -self.stop_hooks_scripted(0, "-n main") +self.stop_hooks_scripted(0, "-I 0 -n main") def test_stop_hooks_scripted_right_lines(self): """Test that a scripted stop hook fires when there is a function match""" -self.stop_hooks_scripted(5, "-f main.c -l 1 -e %d" % (self.main_start_line)) +self.stop_hooks_scripted(5, "-I 0 -f main.c -l 1 -e %d" % (self.main_start_line)) def test_stop_hooks_scripted_wrong_lines(self): """Test that a scripted stop hook doesn't fire when the function does not match""" -self.stop_hooks_scripted(0, "-f main.c -l %d -e 100" % (self.main_start_line)) +self.stop_hooks_scripted(0, "-I 0 -f main.c -l %d -e 100" % (self.main_start_line)) def test_stop_hooks_scripted_auto_continue(self): """Test that the --auto-continue flag works""" @@ -89,9 +89,9 @@ def do_test_auto_continue(self, return_true): result = lldb.SBCommandReturnObject() if return_true: -command = "target stop-hook add -P stop_hook.stop_handler -k increment -v 5 -k return_false -v 1 -n step_out_of_me" +command = "target stop-hook add -I 0 -P stop_hook.stop_handler -k increment -v 5 -k return_false -v 1 -n step_out_of_me" else: -command = "target stop-hook add -G 1 -P stop_hook.stop_handler -k increment -v 5 -n step_out_of_me" +command = "target stop-hook add -I 0 -G 1 -P stop_hook.stop_handler -k increment -v 5 -n step_out_of_me" self.interp.HandleCommand(command, result) self.assertTrue(result.Succeeded(), "Set the target stop hook") >From 9b257aa18e05d0d305c0b5b983827872268f9a03 Mon Sep 17 00:00:00 2001 From: prabhukr Date: Fri, 6 Jun 2025 01:59:11 + Subject: [PATCH 2/2] Format python file. --- .../commands/target/stop-hooks/TestStopHookScripted.py| 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py index 71f805e7f296b..954cac1592435 100644 --- a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py +++ b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py @@ -66,11 +66,15 @@ def test_stop_hooks_scripted_wrong_func(self): def test_stop_hooks_scripted_right_lines(self): """Test that a scripted stop hook fires when there is a function match""" -self.stop_hooks_scripted(5, "-I 0 -f main.c -l 1 -e %d" % (self.main_start_line)) +self.stop_hooks_scripted( +5, "-I 0 -f main.c -l 1 -e %d" % (self.main_start_line) +) def test_stop_hooks_scripted_wrong_lines(self): """Test that a scripted stop hook doesn't fire when the function does not match""" -self.stop_hooks_scripted(0, "-I 0 -f main.c -l %d -e 100" % (self.main_start_line)) +self.stop_hooks_scripted( +0, "-I 0 -f main.c -l %d -e 100" % (self.main_start_line) +) def test_stop_hooks_scripted_auto_continue(self): """Test that the --auto-continue flag works""" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix linux x64 test (PR #143048)
https://github.com/Prabhuk created https://github.com/llvm/llvm-project/pull/143048 `TestStopHookScripted.py` Was failing for cases where -I 0 was not passed to stop-hook add calls. >From caba21d891cf799aecd98a038dc74458e6078867 Mon Sep 17 00:00:00 2001 From: prabhukr Date: Thu, 5 Jun 2025 22:52:24 + Subject: [PATCH] Fix tests --- .../target/stop-hooks/TestStopHookScripted.py| 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py index b71f3421f9834..71f805e7f296b 100644 --- a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py +++ b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py @@ -58,19 +58,19 @@ def test_stop_hooks_scripted_no_entry(self): def test_stop_hooks_scripted_right_func(self): """Test that a scripted stop hook fires when there is a function match""" -self.stop_hooks_scripted(5, "-n step_out_of_me") +self.stop_hooks_scripted(5, "-I 0 -n step_out_of_me") def test_stop_hooks_scripted_wrong_func(self): """Test that a scripted stop hook doesn't fire when the function does not match""" -self.stop_hooks_scripted(0, "-n main") +self.stop_hooks_scripted(0, "-I 0 -n main") def test_stop_hooks_scripted_right_lines(self): """Test that a scripted stop hook fires when there is a function match""" -self.stop_hooks_scripted(5, "-f main.c -l 1 -e %d" % (self.main_start_line)) +self.stop_hooks_scripted(5, "-I 0 -f main.c -l 1 -e %d" % (self.main_start_line)) def test_stop_hooks_scripted_wrong_lines(self): """Test that a scripted stop hook doesn't fire when the function does not match""" -self.stop_hooks_scripted(0, "-f main.c -l %d -e 100" % (self.main_start_line)) +self.stop_hooks_scripted(0, "-I 0 -f main.c -l %d -e 100" % (self.main_start_line)) def test_stop_hooks_scripted_auto_continue(self): """Test that the --auto-continue flag works""" @@ -89,9 +89,9 @@ def do_test_auto_continue(self, return_true): result = lldb.SBCommandReturnObject() if return_true: -command = "target stop-hook add -P stop_hook.stop_handler -k increment -v 5 -k return_false -v 1 -n step_out_of_me" +command = "target stop-hook add -I 0 -P stop_hook.stop_handler -k increment -v 5 -k return_false -v 1 -n step_out_of_me" else: -command = "target stop-hook add -G 1 -P stop_hook.stop_handler -k increment -v 5 -n step_out_of_me" +command = "target stop-hook add -I 0 -G 1 -P stop_hook.stop_handler -k increment -v 5 -n step_out_of_me" self.interp.HandleCommand(command, result) self.assertTrue(result.Succeeded(), "Set the target stop hook") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Make stop-hooks fire when lldb first gains control of a process. (PR #137410)
Prabhuk wrote: > Two things. First off, adding the -I 0 option did indeed fix a failure. > > In the first run you cited, three tests failed: > > FAIL: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: > test_stop_hooks_scripted_auto_continue > (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_auto_continue) > FAIL: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: > test_stop_hooks_scripted_right_func > (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_right_func) > FAIL: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: > test_stop_hooks_scripted_wrong_func > (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_wrong_func) > > But then in the second log from after you applied the patch I suggested, only > the last two tests failed. So the addition did in fact make the first test > pass. > > That makes sense because those other two failing tests don't use the same > command string as the first one. They use the command string on line 148 in > the test. So you also need to add the -I 0 to the command line in > `stop_hooks_scripted` in the test file. > > But still, those failures are odd. The only difference between these two > failing tests and two that pass: > > PASS: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: > test_stop_hooks_scripted_right_lines > (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_right_lines) > PASS: LLDB (/b/s/w/ir/x/w/cipd/clang/bin/clang-x86_64) :: > test_stop_hooks_scripted_wrong_lines > (TestStopHookScripted.TestStopHooks.test_stop_hooks_scripted_wrong_lines) > > are that the failing tests pass in a function name filter to determine when > the stop-hook should fire, and the passing tests pass in a line-range filter. > In both failures the symptom is that the stop-hook got to fire one more time > than expected. The only change in this patch was adding one more place where > the stop-hook might fire - "at the entry point", but in the case of these > tests, that "entry point" firing shouldn't matter because the "entry point" > stop won't pass the filter. Somehow, in your case, that's not true. > > Given that it did make the first test pass, I'm guessing adding the `-I 0` to > the other `target stop-hook add` command in the test file will make those > tests pass as well. > > But where was that "entry point" stop happening on your system such that both > file and line number filters correctly reject it, but it passes BOTH the > filter on function name `main` AND the filter on function name > `step_out_of_me`? Thank you. I added a PR with suggested changes that address the test failure https://github.com/llvm/llvm-project/pull/143048 I do not have the larger context to understand the test failures. I can bring this up with my team and get back to you with what we find out. Thank you for helping out here. https://github.com/llvm/llvm-project/pull/137410 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits