dap-mode
dap-mode copied to clipboard
DAP Python does not refresh local variables, cannot expand locals
While debugging Python, the locals are displayed correctly until I hit a breakpoint, but after that, when I step through the code,
they don't update, and are in a perpetual state of (Loading...).
Also, when I try to expand one variable in the dap-ui-locals buffer, it doesn't react at all.
When I enabled logging through setting dap-print-io to t, the following messages were logged:
Sending: { "command": "variables", "arguments": { "variablesReference": 13 }, "type": "request", "seq": 173 } Received: { "seq": 250, "type": "response", "request_seq": 173, "success": null, "command": "variables", "message": "Unable to find thread to evaluate variable reference." } dap-request: Unable to find thread to evaluate variable reference.
I use version: 1.6.0+33.g78b030f5 of debugpy.
Interestingly, the same error ("Unable to find thread to evaluate variable reference") also displays sometimes in VSCode, however there the variables refresh with no issue, despite the error message.
Does it go away after having stopped thread and then killing the UI locals buffer and calling dap-ui-locals again?
I just use the Main Thread, so there aren't really other threads to stop, and unfortunately no, it doesn't go away if I kill the UI buffer and reopen it. There are times when it updates the locals when I continue to the next breakpoint but sometimes it just refuses to open the buffer and I just get the same "Unable to find thread to evaluate variable reference" message.
This is with a breakpoint being hit and a thread being selected, right? (As a side note we had a bug related to dap-mode not selecting the thread, which is fixed in TOT)
Yes, the active thread is MainThread (breakpoint) or MainThread (step). When I try to display the variables with dap-ui-repl, it works with no issues.
I experience the same issue in Golang. The locals UI shows the actual values the first time I unfold the "Locals" header in the panel. But from that point on, it either does not refresh the locals or it does not want to show their value, displaying the "Loading" hint forever.
If I move the execution point to a scope where the previous locals do not exist, I can see the Unable to find thread to evaluate variable reference
error pointed out by @Hrothgar32. My guess is that emacs requests values for the old variables from the DAP server, which unsurprisingly returns that there is no variable by that name.
When hovering a struct variable in a buffer, a popup appears with the name of the type but when I click to unfold it, nothing happens. In the Messages buffer, the error apply: Wrong number of arguments: (4 . 4), 3
is added at the same time.
I'm encountering the same issue here. In my case dap-ui-locals automatically shows the first level of headings, so I can see the variables are updating smoothly if you do NOT unfold anything inside the treemacs buffer:
But if you want to seed something under first level and unfold anything in side 'Locals', the variables stopped updating: