Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lldb/include/lldb/Interpreter/OptionValueProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ class OptionValueProperties
return false;
}

auto begin() const { return m_properties.begin(); }
auto end() const { return m_properties.end(); }

protected:
Property *ProtectedGetPropertyAtIndex(size_t idx) {
assert(idx < m_properties.size() && "invalid property index");
Expand Down
44 changes: 44 additions & 0 deletions lldb/source/Commands/CommandObjectSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,48 @@ class CommandObjectSettingsList : public CommandObjectParsed {
}
};

// CommandObjectSettingsModified -- List modified variables

class CommandObjectSettingsModified : public CommandObjectParsed {
public:
CommandObjectSettingsModified(CommandInterpreter &interpreter)
: CommandObjectParsed(interpreter, "settings modified",
"List modified debugger settings.") {}

~CommandObjectSettingsModified() override = default;

protected:
void HandleProperties(OptionValueProperties *properties, Stream &strm) {
if (!properties)
return;

for (const auto &property : *properties) {
auto value_sp = property.GetValue();
if (!value_sp)
continue;

if (auto *subproperties = value_sp->GetAsProperties()) {
HandleProperties(subproperties, strm);
continue;
}

if (value_sp->OptionWasSet()) {
property.DumpQualifiedName(strm);
strm.PutCString(" = ");
value_sp->DumpValue(&m_exe_ctx, strm, OptionValue::eDumpOptionValue);
strm.EOL();
}
}
}

void DoExecute(Args &args, CommandReturnObject &result) override {
result.SetStatus(eReturnStatusSuccessFinishResult);

if (auto properties_sp = GetDebugger().GetValueProperties())
HandleProperties(properties_sp.get(), result.GetOutputStream());
}
};

// CommandObjectSettingsRemove

class CommandObjectSettingsRemove : public CommandObjectRaw {
Expand Down Expand Up @@ -1070,6 +1112,8 @@ CommandObjectMultiwordSettings::CommandObjectMultiwordSettings(
CommandObjectSP(new CommandObjectSettingsShow(interpreter)));
LoadSubCommand("list",
CommandObjectSP(new CommandObjectSettingsList(interpreter)));
LoadSubCommand("modified", CommandObjectSP(new CommandObjectSettingsModified(
interpreter)));
LoadSubCommand("remove",
CommandObjectSP(new CommandObjectSettingsRemove(interpreter)));
LoadSubCommand("replace", CommandObjectSP(
Expand Down
11 changes: 11 additions & 0 deletions lldb/test/API/commands/settings/TestSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,3 +1052,14 @@ def test_global_option(self):
# NULL execution context (not one with an empty Target...) and in the
# special handling for load-script-from-symbol-file this wasn't checked.
self.runCmd("settings set -g target.load-script-from-symbol-file true")

def test_modified(self):
self.runCmd("settings set notify-void true")
self.runCmd("settings set target.process.optimization-warnings false")
self.expect(
"settings modified",
substrs=[
"notify-void = true",
"target.process.optimization-warnings = false",
],
)
Loading