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

Method refetch

plugins/lldb/controllers/variable.cpp:37–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void LldbVariable::refetch()
38{
39 // NOTE: a comment in the function that calls this one describes bugs that are worked around here.
40 if (!topLevel() || varobj().isEmpty()) {
41 return;
42 }
43
44 if (!sessionIsAlive()) {
45 return;
46 }
47
48 // update the value itself
49 // LLDB-MI does not support floating variable objects (https://github.com/lldb-tools/lldb-mi/issues/105).
50 // Therefore it always binds each variable object to the debuggee object, for which it was originally
51 // created. Consequently, if another debuggee object with a name that matches a variable object's
52 // expression is in scope at a subsequent debugger stop, the value of the variable object returned by
53 // -var-evaluate-expression remains equal to the value of the original, now out-of-scope, debuggee object. Also
54 // note that even if LLDB-MI starts returning the value of a matching debuggee object that is in scope, KDevelop
55 // would display an obsolete type of the variable, seeing as -var-evaluate-expression does not return the type.
56 // TODO: -var-create a new variable object to display the types and values of variables that are currently in scope.
57 // If the -var-create command succeeds, i.e. a matching debuggee object is in scope, compare the old and
58 // new values of attributes of the reattached variable, update its attribute isChanged() accordingly
59 // so as to match the behavior of kdevgdb, and -var-delete the replaced variable object to clean up.
60 QPointer<LldbVariable> guarded_this(this);
61 m_debugSession->addCommand(VarEvaluateExpression, varobj(), [guarded_this](const ResultRecord &r){
62 auto* const variable = guarded_this.get();
63 if (variable && r.reason == QLatin1String("done")) {
64 variable->setValueToOptionalValueFieldOf(r);
65 }
66 });
67
68 // update children
69 // remove all children first, this will cause some gliches in the UI, but there's no good way
70 // that we can know if there's anything changed
71 if (isExpanded() || !childCount()) {
72 deleteChildren();
73 fetchMoreChildren();
74 }
75}
76
77const Value* LldbVariable::handleRawUpdate(const ResultRecord& r)
78{

Callers 1

updateAllVariablesMethod · 0.80

Calls 6

isExpandedFunction · 0.85
fetchMoreChildrenFunction · 0.85
addCommandMethod · 0.60
isEmptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected