Page MenuHomePhabricator

[lldb] Fix gnu_libstdcpp's update methods
ClosedPublic

Authored by wallace on May 26 2021, 2:41 PM.

Details

Summary

The variable.rst documentation says:

If it returns a value, and that value is True, LLDB will be allowed to cache the children and the children count it previously obtained, and will not return to the provider class to ask.  If nothing, None, or anything other than True is returned, LLDB will discard the cached information and ask. Regardless, whenever necessary LLDB will call update.

However, several update methods in gnu_libstdcpp.py were returning True,
which made lldb unaware of any changes in the corresponding objects.
This problem was visible by lldb-vscode in the following way:

  • If a breakpoint is hit and there's a vector with the contents {1, 2}, it'll be displayed correctly.
  • Then the user steps and the next stop contains the vector modified. The program changed it to {1, 2, 3}
  • frame var then displays {1, 2} incorrectly, due to the caching caused

by the update method

It's worth mentioning that none of libcxx.py'd update methods return True. Same for LibCxxVector.cpp, which returns false.

Added a very simple test that fails without this fix.

Diff Detail

Event Timeline

wallace requested review of this revision.May 26 2021, 2:41 PM
wallace created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2021, 2:41 PM
clayborg accepted this revision.May 26 2021, 2:46 PM
This revision is now accepted and ready to land.May 26 2021, 2:46 PM
This revision was landed with ongoing or failed builds.May 26 2021, 2:52 PM
This revision was automatically updated to reflect the committed changes.