Files
TheRock/compiler/amd-llvm/lldb/test/API/lang/c/stepping/TestThreadStepping.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

93 lines
3.3 KiB
Python

"""
Test thread stepping features in combination with frame select.
"""
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class ThreadSteppingTestCase(TestBase):
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
self.line1 = line_number(
"main.c", '// Find the line number of function "c" here.'
)
self.line2 = line_number(
"main.c", '// frame select 2, thread step-out while stopped at "c(1)"'
)
self.line3 = line_number("main.c", '// thread step-out while stopped at "c(2)"')
self.line4 = line_number(
"main.c", '// frame select 1, thread step-out while stopped at "c(3)"'
)
def test_step_out_with_run_command(self):
"""Exercise thread step-out and frame select followed by thread step-out."""
self.build()
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Create a breakpoint inside function 'c'.
lldbutil.run_break_set_by_file_and_line(
self, "main.c", self.line1, num_expected_locations=1, loc_exact=True
)
# Now run the program.
self.runCmd("run", RUN_SUCCEEDED)
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED, patterns=["Process .* stopped"])
# The frame #0 should correspond to main.c:32, the executable statement
# in function name 'c'. And frame #3 should point to main.c:37.
self.expect(
"thread backtrace",
STOPPED_DUE_TO_BREAKPOINT,
substrs=["stop reason = breakpoint"],
patterns=[
"frame #0.*main.c:%d" % self.line1,
"frame #3.*main.c:%d" % self.line2,
],
)
# We want to move the pc to frame #3. This can be accomplished by
# 'frame select 2', followed by 'thread step-out'.
self.runCmd("frame select 2")
self.runCmd("thread step-out")
self.expect(
"thread backtrace",
STEP_OUT_SUCCEEDED,
substrs=["stop reason = step out"],
patterns=["frame #0.*main.c:%d" % self.line2],
)
# Let's move on to a single step-out case.
self.runCmd("process continue")
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED, patterns=["Process .* stopped"])
self.runCmd("thread step-out")
self.expect(
"thread backtrace",
STEP_OUT_SUCCEEDED,
substrs=["stop reason = step out"],
patterns=["frame #0.*main.c:%d" % self.line3],
)
# Do another frame selct, followed by thread step-out.
self.runCmd("process continue")
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED, patterns=["Process .* stopped"])
self.runCmd("frame select 1")
self.runCmd("thread step-out")
self.expect(
"thread backtrace",
STEP_OUT_SUCCEEDED,
substrs=["stop reason = step out"],
patterns=["frame #0.*main.c:%d" % self.line4],
)