This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Don't save empty expressions in the multiline editor history
ClosedPublic

Authored by teemperor on Aug 31 2021, 3:27 AM.

Details

Summary

Right now running expr to start the multiline expression editor and then pressing enter
causes an empty history empty to be created for the multiline editor. That doesn't seem
very useful for users as pressing the 'up' key will now also bring up these empty expressions.

I don't think there is ever a use case for recalling a completely empty expression from the
history, so instead don't save those entries to the history file and make sure we never recall
them when navigating over the expression history.

Note: This is actually a Swift downstream patch that got shipped with Apple's LLDB for many years.
However, this recently started conflicting with upstream LLDB as D100048 added a test that
made sure that empty expression entries don't crash LLDB. Apple's LLDB was never affected by
this crash as it never saved empty expressions in the first place.

Diff Detail

Event Timeline

teemperor created this revision.Aug 31 2021, 3:27 AM
teemperor requested review of this revision.Aug 31 2021, 3:27 AM
augusto2112 accepted this revision.Aug 31 2021, 9:09 AM
augusto2112 added a subscriber: augusto2112.

LGTM!

This revision is now accepted and ready to land.Aug 31 2021, 9:09 AM
This revision was landed with ongoing or failed builds.Aug 31 2021, 9:51 AM
This revision was automatically updated to reflect the committed changes.