MCPcopy Create free account
hub / github.com/KDE/kdevelop / updateAllVariables

Method updateAllVariables

plugins/lldb/debugsession.cpp:362–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362void DebugSession::updateAllVariables()
363{
364 // This function together with its caller and callees works around the following bugs:
365 // 1. LLDB-MI does not support `*` as the variable object names argument, for example:
366 // (lldb) 54-var-update --thread 1 --frame 0 --all-values *
367 // 54^error,msg="Command 'var-update'. Variable '*' does not exist"
368 // 2. LLDB-MI sends an empty -var-update changelist for variables that have a Python synthetic provider.
369 // 3. LLDB-MI does not support floating variable objects (https://github.com/lldb-tools/lldb-mi/issues/105).
370 // Therefore it always binds each variable object to the debuggee object, for which it was originally created.
371 // Consequently, if another debuggee object with a name that matches a variable object's expression is in scope
372 // at a subsequent debugger stop, the changelist reported for the variable object is empty. For example:
373 // (lldb) 107-var-update --thread 3 --frame 0 --all-values var9
374 // 107^done,changelist=[]
375 // TODO: remove this workaround after the bugs are fixed upstream. If only the first
376 // bug remains unfixed, revert 91d7176c7a10cdb8eb65e8aa20ea0cd3816ed8e7.
377
378 // re-fetch all toplevel variables, as -var-update doesn't work with data formatter
379 // we have to pick out top level variables first, as refetching will delete child
380 // variables.
381 QList<LldbVariable*> toplevels;
382 for (auto* variable : std::as_const(m_allVariables)) {
383 auto *var = qobject_cast<LldbVariable*>(variable);
384 if (var->topLevel()) {
385 toplevels << var;
386 }
387 }
388
389 for (auto var : std::as_const(toplevels)) {
390 var->refetch();
391 }
392}
393
394void DebugSession::handleSessionStateChange(IDebugSession::DebuggerState state)
395{

Callers 1

updateMethod · 0.80

Calls 1

refetchMethod · 0.80

Tested by

no test coverage detected