Skip to content

Fix test assertions in TestDAP_stepInTargets.py #96687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@


class TestDAP_stepInTargets(lldbdap_testcase.DAPTestCaseBase):
@skipIf(
archs=no_match(["x86_64"])
) # InstructionControlFlowKind for ARM is not supported yet.
@expectedFailureAll(oslist=["windows"])
@skipIf(archs=no_match(["x86_64"]))
# InstructionControlFlowKind for ARM is not supported yet.
# On Windows, lldb-dap seems to ignore targetId when stepping into functions.
# For more context, see https://github.com/llvm/llvm-project/issues/98509.
def test_basic(self):
"""
Tests the basic stepping in targets with directly calls.
Expand Down Expand Up @@ -55,14 +57,24 @@ 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 that we are in bar2()
# Choose to step into second target and verify that we are in the second target,
# be it funcA or funcB.
self.stepIn(threadId=tid, targetId=step_in_targets[1]["id"], waitForStop=True)
leaf_frame = self.dap_server.get_stackFrame()
self.assertIsNotNone(leaf_frame, "expect a leaf frame")
self.assertEqual(leaf_frame["name"], "bar2()")
self.assertEqual(step_in_targets[1]["label"], leaf_frame["name"])
6 changes: 3 additions & 3 deletions lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

int foo(int val, int extra) { return val + extra; }

int bar() { return 22; }
int funcA() { return 22; }

int bar2() { return 54; }
int funcB() { return 54; }

int main(int argc, char const *argv[]) {
foo(bar(), bar2()); // set breakpoint here
foo(funcA(), funcB()); // set breakpoint here
return 0;
}
Loading