Skip to content
Aabha AI Academy

Stage 9 · L42

Connect the debugger and inspect the correct stack frame

Core · original Session 9

Debugger workflow and launch configuration are authored; a live editor/debugger session has not been run.

A breakpoint is useful only in the process executing the code. Uvicorn reload can start a supervising process and a worker; Docker adds a filesystem boundary. A breakpoint in the wrong process or mismatched source path will remain unbound or never hit. First establish the interpreter, working directory, import string and current process.

The snapshot includes .vscode/launch.json to launch one owned Uvicorn process without reload. Its module is uvicorn, arguments are equipment.api:app and loopback port8000, and cwd is the extracted snapshot. It refers to already prepared environment variables rather than embedding real credentials. Launch the editor from the prepared learner environment or supply its synthetic configuration intentionally.

Set a breakpoint inside rentals.reserve after selecting equipment. The selected frame contains payload, equipment, session and the transaction state. An HTTP request's route frame and the service frame expose different locals. Selecting a different frame changes what an expression means; an undefined payload in another frame is not evidence that the application lost it.

For container attachment, an owned debug server and correct localRoot/remoteRoot path mapping are additional setup. That workflow is a conceptual comparison here, not a configured or executed debug attachment. Do not attach to an unrelated website process or open a debug port publicly.

The launch JSON parses, and the actual service/HTTP tests identify executable lines, but a live VSCode debugger session has not been run. Separate those claims. The guided lab is a manual learner workflow with observable criteria: a bound breakpoint in the intended process, a selected service frame and a resumed HTTP response.

Owned Uvicorn launch, no reload; Correct interpreter and cwd; Bound breakpoint in service frame; Inspect that frame's scalar locals; Resume only the owned process
Owned Uvicorn launch, no reload; Correct interpreter and cwd; Bound breakpoint in service frame; Inspect that frame's scalar locals; Resume only the owned process

Prepare the debugger

Focused lesson example; see the end-of-stage capstone for the cumulative app · stage 09

Launch one owned Uvicorn without reload
Bind a breakpoint in rentals.reserve
Send a synthetic authenticated reservation
Select reserve frame: payload, equipment, session
Resume; stop only the launched process.

Predict and observe this focused example using the concepts explained above. Its boundary is stated in the focused answer.

Guided lab

  1. Read the explanation and predict the focused example’s outcome.
  2. Record the intended interpreter/process/path and explain an unbound breakpoint or an undefined payload in a different frame.
  3. Compare the observed outcome with the focused answer and state its boundary.

Expected: Launch creates the owned process; attach joins an already configured owned process. A wrong interpreter/source mapping or reload supervisor can miss executable code. Locals belong to the selected frame; undefined payload elsewhere is not lost application state. The supplied launch config is parsed, but debugger interaction remains a manual learner exercise.

  • Wrong process or path mapping prevents hits; frame-local expressions differ; attaching to an unrelated process is outside this lab.

Focused exercise and answer

Complete the manual exercise in your learner repository and record which checks actually ran.

Your transfer task: Record the intended interpreter/process/path and explain an unbound breakpoint or an undefined payload in a different frame.

  1. Record the intended interpreter/process/path and explain an unbound breakpoint or an undefined payload in a different frame.
Inspect the matching answer

This answer addresses the focused exercise above; the cumulative implementation is shown only after the stage prerequisites.

Launch creates the owned process; attach joins an already configured owned process. A wrong interpreter/source mapping or reload supervisor can miss executable code. Locals belong to the selected frame; undefined payload elsewhere is not lost application state. The supplied launch config is parsed, but debugger interaction remains a manual learner exercise.

Check your reasoning

Why omit reload in the first debugger exercise?

Show the explanation

It keeps one clearly owned server process so the learner can establish the breakpoint boundary before adding child-process complexity.

Reading progress

54 lessons remain open to guests. Marking a lesson read records reading only; it does not award assessment credit or a certificate.

Device reading marks require browser storage. Reading is always available.

Sign in or create an account to save separate account progress. Your current page is kept.