[Lldb-commits] [lldb] r116895 - /lldb/trunk/source/Core/UserSettingsController.cpp

Johnny Chen johnny.chen at apple.com
Tue Oct 19 18:03:01 PDT 2010


Author: johnny
Date: Tue Oct 19 20:03:00 2010
New Revision: 116895

URL: http://llvm.org/viewvc/llvm-project?rev=116895&view=rev
Log:
For UserSettingsController::UpdateDictionaryVariable(), clear the dictionary
if passed in a NULL new_value and the operation intended is eVarSetOperationAssign.
This fixed a bug where in TestSettings.py:

        # Set the run-args and the env-vars.
        self.runCmd('settings set target.process.run-args A B C')
        self.runCmd('settings set target.process.env-vars ["MY_ENV_VAR"]=YES')
        # And add hooks to restore the settings during tearDown().
        self.addTearDownHook(
            lambda: self.runCmd("settings set -r target.process.run-args"))
        self.addTearDownHook(
            lambda: self.runCmd("settings set -r target.process.env-vars"))

"settings set -r target.process.env-vars" was not restoring the original env-vars
setting.

Modified:
    lldb/trunk/source/Core/UserSettingsController.cpp

Modified: lldb/trunk/source/Core/UserSettingsController.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/UserSettingsController.cpp?rev=116895&r1=116894&r2=116895&view=diff
==============================================================================
--- lldb/trunk/source/Core/UserSettingsController.cpp (original)
+++ lldb/trunk/source/Core/UserSettingsController.cpp Tue Oct 19 20:03:00 2010
@@ -2079,6 +2079,12 @@
         case lldb::eVarSetOperationAppend:
         case lldb::eVarSetOperationAssign:
             {
+                // Clear the dictionary if it's an assign with new_value as NULL.
+                if (new_value == NULL && op == lldb::eVarSetOperationAssign)
+                {
+                    dictionary.clear ();
+                    break;
+                }
                 Args args (new_value);
                 size_t num_args = args.GetArgumentCount();
                 for (size_t i = 0; i < num_args; ++i)





More information about the lldb-commits mailing list