[Lldb-commits] [PATCH] D52651: Add functionality to export settings

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 28 08:01:35 PDT 2018


JDevlieghere created this revision.
JDevlieghere added reviewers: clayborg, jingham, teemperor.
JDevlieghere added a project: LLDB.

For the reproducer feature I need to be able to export and import the current LLDB configuration. To realize this I've extended the existing functionality to print settings. With the help of a new formatting option, we can now write the settings and their values to a file structured as regular commands.

Concretely the functionality works as follows:

  (lldb) settings export /path/to/file

This file contains a bunch of `settings set` commands, followed by the setting's name and value.

  settings set use-external-editor false
  settings set use-color true
  settings set auto-one-line-summaries true
  settings set auto-indent true

Loading the settings again is as simple as sourcing the newly created file:

  (lldb) command source /path/to/file

I had to make a few small changes here to make this work:

- When a value is not set `settings set <setting>` is equal to `settings clear <setting>`. This is because not all settings have a meaningful default For example for `settings set` we used to print `unknown` which is not a value the user can set.
- I introduced a new printing option and group for printing options as commands. This relates to printing everything on a single line for things like arrays and dicts.

There's one setting that is proving to be a pain: the disassembly format value. Currently we don't accept our own default value. I don't know what the problem is but I managed to work around this by escaping the back ticks.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52651

Files:
  include/lldb/Interpreter/OptionValue.h
  lit/Settings/TestExport.test
  source/Commands/CommandObjectSettings.cpp
  source/Core/Debugger.cpp
  source/Interpreter/OptionValueArray.cpp
  source/Interpreter/OptionValueDictionary.cpp
  source/Interpreter/OptionValueFileSpecLIst.cpp
  source/Interpreter/OptionValueFormatEntity.cpp
  source/Interpreter/OptionValueLanguage.cpp
  source/Interpreter/Property.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52651.167474.patch
Type: text/x-patch
Size: 11711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180928/50b4621d/attachment.bin>


More information about the lldb-commits mailing list