Skip to content

Local variables not always correct when changing depth of call stack in Debugger #230

@robertoffmoura

Description

@robertoffmoura

Using the debugger, when changing the context to a function that is higher up in the call stack, the local variables defined in that function are accessible via the terminal (e.g. they can be printed). However, when switching context back to a function that is deeper down in the call stack, the local variables are not accessible anymore.

To Reproduce
Let's say function2 defines a variable b, and function1 calls function2:

function function1()
    function2();
end

function out = function2()
    b = 2;
    out = [];
end
  1. Save this file as function1.m
  2. Set a breakpoint in line 7 (out = []).
  3. type b in the terminal
  4. Click function1 in the call stack, then click function2 in the call stack, then type b in the terminal
  5. See error Unrecognized function or variable 'b'.

Expected behavior
b should be accessible since we changed the context back to function2, where it was defined.

Useful Information

  • OS Version: "Red Hat Enterprise Linux" VERSION="8.10 (Ootpa)"
  • VS Code Version: 1.96.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions