[Lldb-commits] [lldb] 352f16d - [lldb] Let OptionValueRegex::Clear set to value to the default and not an empty regex

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 12 08:12:37 PDT 2020


Author: Raphael Isemann
Date: 2020-03-12T16:12:14+01:00
New Revision: 352f16db87f583ec7f55f8028647b5fd8616111f

URL: https://github.com/llvm/llvm-project/commit/352f16db87f583ec7f55f8028647b5fd8616111f
DIFF: https://github.com/llvm/llvm-project/commit/352f16db87f583ec7f55f8028647b5fd8616111f.diff

LOG: [lldb] Let OptionValueRegex::Clear set to value to the default and not an empty regex

Since D75537 the test suite clears all settings before a test. This caused
two tests to fail:
    lldb-api :: functionalities/inline-stepping/TestInlineStepping.py
    lldb-api :: lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
The reason for that is that OptionValueRegex::Clear was setting the regex
to empty instead of the default value that was passed initially. This caused
that the target.process.thread.step-avoid-regexp setting which is used in the
tests was set to "" instead of "^std::".

This patch is just a quick fix that sets the regex back to the original value
to make the tests pass.

In total these 3 setting values have changed with D75537 and also need to be
fixed (even though they don't seem to break any tests).
  target.process.thread.step-avoid-regexp (regex) -> from '^std::' to empty string
  platform.module-cache-directory (file) -> from "~/.lldb/module_cache" to empty string
  script-lang (enum) -> from 'default' to 'python'

Added: 
    

Modified: 
    lldb/include/lldb/Interpreter/OptionValueRegex.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Interpreter/OptionValueRegex.h b/lldb/include/lldb/Interpreter/OptionValueRegex.h
index caeab69b5ef3..b09b8414d5bf 100644
--- a/lldb/include/lldb/Interpreter/OptionValueRegex.h
+++ b/lldb/include/lldb/Interpreter/OptionValueRegex.h
@@ -17,7 +17,8 @@ namespace lldb_private {
 class OptionValueRegex : public OptionValue {
 public:
   OptionValueRegex(const char *value = nullptr)
-      : OptionValue(), m_regex(llvm::StringRef::withNullAsEmpty(value)) {}
+      : OptionValue(), m_regex(llvm::StringRef::withNullAsEmpty(value)),
+        m_default_regex_str(llvm::StringRef::withNullAsEmpty(value).str()) {}
 
   ~OptionValueRegex() override = default;
 
@@ -36,7 +37,7 @@ class OptionValueRegex : public OptionValue {
                      VarSetOperationType = eVarSetOperationAssign) = delete;
 
   bool Clear() override {
-    m_regex = RegularExpression();
+    m_regex = RegularExpression(m_default_regex_str);
     m_value_was_set = false;
     return true;
   }
@@ -59,6 +60,7 @@ class OptionValueRegex : public OptionValue {
 
 protected:
   RegularExpression m_regex;
+  std::string m_default_regex_str;
 };
 
 } // namespace lldb_private


        


More information about the lldb-commits mailing list