Menu

#1435 Watch Window Context/Watch created invalid code

Undefined
fixed
None
Bug_Report
2023-12-09
2023-12-06
Tiger Beard
No

When the watch window shows a structure with subelements its possible to select a subelement and right click on it. Then a context menu pops up with the option "Watch". The single subelement appears as an own additional watch. It then creates the following watch line

*MyStruct.myVariable

This is the wrong syntax. The correct syntax should be

  (*MyStruct).myVariable           // this
   MyStruct->myVariable             // or this

The current workaround for this is to select "Rename" and change the line manually. Then it works fine.

Seen in 20.03 Linux but expected to be the same in other versions.
Can someone please confirm this.

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2023-12-09

    This code

    void GDBWatch::GetFullWatchString(wxString &full_watch) const
    {
        cb::shared_ptr<const cbWatch> parent = GetParent();
        if (parent)
        {
            parent->GetFullWatchString(full_watch);
            full_watch += wxT(".") + m_symbol;
        }
        else
            full_watch = m_symbol;
    }
    

    generates that line. Changing it to this

    void GDBWatch::GetFullWatchString(wxString &full_watch) const
    {
        cb::shared_ptr<const cbWatch> parent = GetParent();
        if (parent)
        {
            parent->GetFullWatchString(full_watch);
            if (full_watch.StartsWith("*"))
                full_watch = "(" + full_watch + ")";
    
            full_watch += "." + m_symbol;
        }
        else
            full_watch = m_symbol;
    }
    

    should fix the issue.

     
  • Miguel Gimenez

    Miguel Gimenez - 2023-12-09
    • assigned_to: Miguel Gimenez
     
  • Miguel Gimenez

    Miguel Gimenez - 2023-12-09
    • status: open --> fixed
     
  • Miguel Gimenez

    Miguel Gimenez - 2023-12-09

    Should be fixed in [r13404], thank you for reporting.

     

    Related

    Commit: [r13404]


Log in to post a comment.

MongoDB Logo MongoDB