Skip to content

get_local_vars() does not work on whole stack #2073

@tmandys

Description

@tmandys

Seems that get_local_vars() does not work on whole stack but just in current Program or so (even is global procedure). When using in DebugUtil.qm I can see full stack in get_thread_call_stack() but get_local_vars() returns non-nothing values just for topmost items.

I proceeded with debugger so I'm able to demonstrate issue in unfriendly command line client.

Example:

qdbg> stack
processCommand: {cmd: "thread/stack", tid: 2}
command: ["thread", "stack"]
list: (6 elements)
  [0]=hash: (8 members)
    function : "get_thread_call_stack"
    line : 1503
    endline : 1503
    file : "/home/tma/work/qore/qore/qlib/DebugUtil.qm"
    source : <NOTHING>
    offset : 0
    typecode : 1
    type : "builtin"
  [1]=hash: (8 members)
    function : "DebugProgramControl::handleInterrupt"
    line : 1563
    endline : 1563
    file : "/home/tma/work/qore/qore/qlib/DebugUtil.qm"
    source : <NOTHING>
    offset : 0
    typecode : 0
    type : "user"
  [2]=hash: (8 members)
    function : "DebugProgramControl::onStep"
    line : 39
    endline : 39
    file : "test/qore/debug/test-debug-script.q"
    source : <NOTHING>
    offset : 0
    typecode : 0
    type : "user"
  [3]=hash: (8 members)
    function : "main"
    line : 39
    endline : 39
    file : "test/qore/debug/test-debug-script.q"
    source : <NOTHING>
    offset : 0
    typecode : 0
    type : "user"
  [4]=hash: (8 members)
    function : "Program::run"
    line : 120
    endline : 120
    file : "bin/qore-dbg"
    source : <NOTHING>
    offset : 0
    typecode : 1
    type : "builtin"
  [5]=hash: (8 members)
    function : "DebugWrapper::background operator"
    line : 120
    endline : 120
    file : "bin/qore-dbg"
    source : <NOTHING>
    offset : 0
    typecode : 2
    type : "new-thread"


keys get_local_vars(#)

  localvars0 : list: (15 elements)
    [0]="sd"
    [1]="ret"
    [2]="ctxCT"
    [3]="sendData1"
    [4]="ctx"
    [5]="tid"
    [6]="argv"
    [7]="self"
    [8]="except"
    [9]="refValue"
    [10]="refName"
    [11]="statementId"
    [12]="runState"
    [13]="pgm"
    [14]="func"
  localvars1 : list: (7 elements)
    [0]="argv"
    [1]="self"
    [2]="statementId"
    [3]="blockStatementId"
    [4]="pgm"
    [5]="rs"
    [6]="retCode"
  localvars2 : <EMPTY LIST>
  localvars3 : <EMPTY LIST>
  localvars4 : <EMPTY LIST>
  localvars5 : <EMPTY LIST>
  localvars6 : <EMPTY LIST>
  localvars7 : <EMPTY LIST>
  localvars8 : <EMPTY LIST>
  localvars9 : <EMPTY LIST>
  localvars10 : <EMPTY LIST>

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions