inline cb::shared_ptr<GDBWatch> AddChild(cb::shared_ptr<GDBWatch> parent, wxString const &str_name)
{
    int index = parent->FindChildIndex(str_name);
    cb::shared_ptr<GDBWatch> child;
    if (index != -1)
        child = cb::static_pointer_cast<GDBWatch>(parent->GetChild(index));
    else
    {
        child = cb::shared_ptr<GDBWatch>(new GDBWatch(str_name));
        cbWatch::AddChild(parent, child);
    }
    child->MarkAsRemoved(false);
    return child;
}
void RemoveMissingChildren(cb::shared_ptr<cbWatch> parent, const std::set<wxString> &knownsyms)
{
    for (int i=0; i<parent->GetChildCount(); ++i)
    {
        cb::shared_ptr<cbWatch> p(parent->GetChild(i));
        wxString s;
        p->GetSymbol(s);
        if (knownsyms.find(s)==knownsyms.end())
        {
            parent->RemoveChild(i);
            --i;
            continue;
        }
    }
}