Skip to content

Commit

Permalink
dap: improve evaluation collector
Browse files Browse the repository at this point in the history
collect all block variables including top function
  • Loading branch information
profelis committed Aug 31, 2023
1 parent 2396914 commit c0ab206
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions daslib/debug.das
Original file line number Diff line number Diff line change
Expand Up @@ -1665,10 +1665,19 @@ class private DAServer: Server
break
if !found
var inscope vars : table<string; Result>
ctxData.stack[frameId] |> iter_top_child_var() <| $(child)
if child.typeInfo != null
let tInfo & = unsafe(*child.typeInfo)
vars[child.name] <- [[Result tinfo=tInfo, value=child.rawValue, data=unsafe(reinterpret<void?>child.address)]]
var frame = frameId
let stackLen = length(ctxData.stack)
// collect all vars from all blocks till the function frame
while frame < stackLen && ctxData.stack[frame].isBlock
frame += 1
if frame >= stackLen
frame = stackLen - 1
while frame >= frameId
ctxData.stack[frame] |> iter_top_child_var() <| $(child)
if child.typeInfo != null
let tInfo & = unsafe(*child.typeInfo)
vars[child.name] <- [[Result tinfo=tInfo, value=child.rawValue, data=unsafe(reinterpret<void?>child.address)]]
--frame

var result = debug_eval(vars, ini.expression)
var resStr = ""
Expand Down

0 comments on commit c0ab206

Please sign in to comment.