| 75 | } |
| 76 | |
| 77 | void IVariableController::handleEvent(IDebugSession::event_t event) |
| 78 | { |
| 79 | Q_D(IVariableController); |
| 80 | |
| 81 | if (!variableCollection()) return; |
| 82 | |
| 83 | if (event != IDebugSession::thread_or_frame_changed) { |
| 84 | return; |
| 85 | } |
| 86 | |
| 87 | const auto thread = session()->frameStackModel()->currentThread(); |
| 88 | const auto frame = session()->frameStackModel()->currentFrame(); |
| 89 | if (thread < 0 || frame < 0) { |
| 90 | // Update only when both the current thread and the current frame become valid. |
| 91 | // Redundant updating breaks highlighting changed variables, slows down |
| 92 | // debugging by issuing unneeded MI commands, and may cause other bugs. |
| 93 | qCDebug(DEBUGGER).nospace() << "not handling a change to invalid thread (" << thread << ") or frame (" << frame |
| 94 | << ')'; |
| 95 | return; |
| 96 | } |
| 97 | |
| 98 | qCDebug(DEBUGGER) << d->autoUpdate; |
| 99 | if (!(d->autoUpdate & UpdateLocals)) { |
| 100 | const auto locals = variableCollection()->allLocals(); |
| 101 | for (Locals* l : locals) { |
| 102 | if (!l->isExpanded() && !l->childCount()) { |
| 103 | l->setHasMore(true); |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | if (thread == d->activeThread && frame == d->activeFrame) { |
| 109 | return; |
| 110 | } |
| 111 | |
| 112 | qCDebug(DEBUGGER) << "handling a change: thread" << d->activeThread << "=>" << thread << ';' << "frame" |
| 113 | << d->activeFrame << "=>" << frame; |
| 114 | d->activeThread = thread; |
| 115 | d->activeFrame = frame; |
| 116 | |
| 117 | variableCollection()->root()->resetChanged(); |
| 118 | if (d->autoUpdate != UpdateNone) { |
| 119 | update(); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | void IVariableController::setAutoUpdate(QFlags<UpdateType> autoUpdate) |
| 124 | { |
no test coverage detected