Author Topic: Debugger Watch issue  (Read 3241 times)

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Debugger Watch issue
« on: September 02, 2022, 06:07:46 am »
The current watchesdlg.cpp WatchesDlg::AddWatch(..) function does not support watches that have children. For watches to support children you need to add the watch and then update the watch so that the children are added.


The DAP debugger has a different way or working in that you can add a variable and it knows the variable has children when the watch is added, but does not get the children until the variable is expanded in order to not slow debugging down be getting data that is not currently shown to the end users. A quick fix to support adding a watch with children is to modify the  WatchesDlg::AddWatch(..) function as shown below with the code between the #if 1 and the #endif added.
Is the a better or another way of getting the watch to be expandable without performing an update after the watch has been added?

Code
    item.property->SetExpanded(watch->IsExpanded());
    item.watch = watch;

#if 1
    if (watch->GetChildCount() > 0)
    {
        const wxColour & changedColour = Manager::Get()->GetColourManager()->GetColour(wxT("dbg_watches_changed"));
        AppendChildren(*m_grid, *item.property, *item.watch, item.readonly, changedColour);
    }

#endif // 1

    m_watches.push_back(item);
    m_grid->Refresh();