MCPcopy Create free account
hub / github.com/microsoft/debugpy / test_deep_stacks

Function test_deep_stacks

tests/debugpy/test_breakpoints.py:381–415  ·  view source on GitHub ↗
(pyfile, target, run)

Source from the content-addressed store, hash-verified

379
380
381def test_deep_stacks(pyfile, target, run):
382 @pyfile
383 def code_to_debug():
384 import debuggee
385
386 debuggee.setup()
387
388 def deep_stack(level):
389 if level <= 0:
390 print("done") # @bp
391 return level
392 deep_stack(level - 1)
393
394 deep_stack(100)
395
396 with debug.Session() as session:
397 with run(session, target(code_to_debug)):
398 session.set_breakpoints(code_to_debug, all)
399
400 stop = session.wait_for_stop()
401 assert len(stop.frames) > 100
402
403 # Now try to retrieve the same stack in chunks, and check that it matches.
404 frames = []
405 for _ in range(5):
406 stack_trace = session.request(
407 "stackTrace",
408 {"threadId": stop.thread_id, "startFrame": len(frames), "levels": 25},
409 )
410
411 assert stack_trace["totalFrames"] > 0
412 frames += stack_trace["stackFrames"]
413
414 assert stop.frames == frames
415 session.request_continue()
416
417
418@pytest.mark.parametrize("target", targets.all)

Callers

nothing calls this directly

Calls 6

set_breakpointsMethod · 0.80
wait_for_stopMethod · 0.80
request_continueMethod · 0.80
runFunction · 0.70
targetFunction · 0.70
requestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…