This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add --exists flag to `settings set`
ClosedPublic

Authored by JDevlieghere on Mar 7 2022, 1:32 PM.

Details

Summary

Add a --exists/-e flag to settings set that sets the setting if it
exists, but doesn't print another error otherwise. This is useful when
setting options in your ~/.lldbinit that might not exist in older
versions of lldb.

Diff Detail

Event Timeline

JDevlieghere created this revision.Mar 7 2022, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 1:32 PM
Herald added a subscriber: dang. · View Herald Transcript
JDevlieghere requested review of this revision.Mar 7 2022, 1:32 PM
jingham accepted this revision.EditedMar 8 2022, 3:48 PM

I suggested what seems to me a slightly clearer help message, but the added option seems useful. I wondered briefly about whether it might be better as a setting settings set ignore-missing-settings but decided that would make it too easy to overlook errors. It's better to do it explicitly for settings you know don't exist in all the the versions of lldb you are likely to be running against.

lldb/source/Commands/Options.td
26

It might be clearer to phrase it focusing on not raising an error if the setting doesn't exist like:

Set the setting if it exists, but do not cause the command to raise an error if it does not exist.

This revision is now accepted and ready to land.Mar 8 2022, 3:48 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2022, 10:59 PM