[Lldb-commits] [PATCH] D67033: [lldb] Restructure test folders to match LLDB command hierarchy

2019-09-01 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370605: [lldb] Restructure test folders to match LLDB 
command hierarchy (authored by teemperor, committed by ).
Herald added subscribers: llvm-commits, mgrang, srhines.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D67033?vs=218205&id=218254#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67033/new/

https://reviews.llvm.org/D67033

Files:
  lldb/trunk/packages/Python/lldbsuite/test/commands/add-dsym/uuid/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/add-dsym/uuid/TestAddDsymCommand.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/add-dsym/uuid/main.cpp.template
  
lldb/trunk/packages/Python/lldbsuite/test/commands/apropos/basic/TestApropos.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/apropos/with-process/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/apropos/with-process/TestAproposWithProcess.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/apropos/with-process/main.cpp
  lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/TestBreakpointCommand.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/TestBreakpointCommandsFromPython.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/TestRegexpBreakCommand.py
  lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/a.c
  lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/b.c
  
lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/bktptcmd.py
  lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/main.c
  
lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/side_effect.py
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/history/.categories
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/history/TestCommandHistory.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/TestNestedAlias.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/main.cpp
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/.categories
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/TestCommandScript.py
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/bug11569.py
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/decorated.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/TestImport.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/bar/bar.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/bar/barutil.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/dummymodule.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/foo/bar/foobar.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/foo/foo2.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/main.c
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/TestRdar12586188.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail12586188.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/rdar-12586188/fail212586188.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitA.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/TPunitB.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/import/thepackage/__init__.py
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/main.cpp
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/mysto.py
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/py_import
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/welcome.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script_alias/.categories
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script_alias/TestCommandScriptAlias.py
  
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script_alias/tcsacmd.py
  lldb/trunk/packages/Python/lldbsuite/test/commands/command/source/.categories
  lldb/trunk/packages/Python/lldbsuite/test/commands/comma

[Lldb-commits] [lldb] r370611 - [lldb][NFC] Fix failing tests after restructuring test folder

2019-09-01 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Sun Sep  1 06:36:44 2019
New Revision: 370611

URL: http://llvm.org/viewvc/llvm-project?rev=370611&view=rev
Log:
[lldb][NFC] Fix failing tests after restructuring test folder

Just adjusts all the relative paths in the Makefiles (and
the breakpoint test which seems to rely on the name of its
folder).

Modified:

lldb/trunk/packages/Python/lldbsuite/test/commands/apropos/with-process/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/breakpoint/basic/TestBreakpointCommand.py

lldb/trunk/packages/Python/lldbsuite/test/commands/command/nested_alias/Makefile
lldb/trunk/packages/Python/lldbsuite/test/commands/command/script/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/disassemble/basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/anonymous-struct/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/argument_passing_restrictions/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-function/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-restarts/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/cast_int_to_anonymous_enum/Makefile
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/char/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/class_template_specialization_empty_pack/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/context-object/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/dollar-in-variable/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/dont_allow_jit/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/entry-bp/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/expr-in-syscall/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/formatters/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/function_template_specialization_temp_args/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/conflicts/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/no-std-module/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/queue/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/stack/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/sysroot/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/unique_ptr-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/unique_ptr/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-basic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-bool/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-of-vectors/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/weak_ptr-dbg-info-content/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import-std-module/weak_ptr/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/inline-namespace/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/ir-interpreter-phi-nodes/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/ir-interpreter/Makefile


[Lldb-commits] [lldb] r370612 - [lldb] Small optimization of FormatMap::Delete

2019-09-01 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Sun Sep  1 08:08:33 2019
New Revision: 370612

URL: http://llvm.org/viewvc/llvm-project?rev=370612&view=rev
Log:
[lldb] Small optimization of FormatMap::Delete

Modified:
lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h

Modified: lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h?rev=370612&r1=370611&r2=370612&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h Sun Sep  1 
08:08:33 2019
@@ -89,7 +89,7 @@ public:
 MapIterator iter = m_map.find(name);
 if (iter == m_map.end())
   return false;
-m_map.erase(name);
+m_map.erase(iter);
 if (listener)
   listener->Changed();
 return true;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67049: 1/2: Code cleanup: Change FormattersContainer::KeyType from SP to rvalue

2019-09-01 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil created this revision.
jankratochvil added reviewers: labath, JDevlieghere, jingham.
jankratochvil added a project: LLDB.
Herald added a reviewer: jdoerfert.

There is now `std::shared_ptr` passed around which is expensive for manycore 
CPUs.
Most of the times (except for 3 cases) it is now just `std::move`d with no CPU 
locks needed.
It also makes it possible to sort the keys (which is now not needed much after 
D66398 .
This was originally D66392  but then that one 
ended up as a different patch.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67049

Files:
  lldb/include/lldb/DataFormatters/FormattersContainer.h
  lldb/include/lldb/DataFormatters/TypeCategory.h
  lldb/include/lldb/Target/Target.h
  lldb/include/lldb/Utility/RegularExpression.h
  lldb/source/API/SBTarget.cpp
  lldb/source/API/SBTypeCategory.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/DataFormatters/FormatManager.cpp
  lldb/source/DataFormatters/FormattersHelpers.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -305,14 +305,14 @@
 const FileSpecList *containingModules,
 const FileSpecList *source_file_spec_list,
 const std::unordered_set &function_names,
-RegularExpression &source_regex, bool internal, bool hardware,
+RegularExpression source_regex, bool internal, bool hardware,
 LazyBool move_to_nearest_code) {
   SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList(
   containingModules, source_file_spec_list));
   if (move_to_nearest_code == eLazyBoolCalculate)
 move_to_nearest_code = GetMoveToNearestCode() ? eLazyBoolYes : eLazyBoolNo;
   BreakpointResolverSP resolver_sp(new BreakpointResolverFileRegex(
-  nullptr, source_regex, function_names,
+  nullptr, std::move(source_regex), function_names,
   !static_cast(move_to_nearest_code)));
 
   return CreateBreakpoint(filter_sp, resolver_sp, internal, hardware, true);
@@ -547,7 +547,7 @@
 
 BreakpointSP Target::CreateFuncRegexBreakpoint(
 const FileSpecList *containingModules,
-const FileSpecList *containingSourceFiles, RegularExpression &func_regex,
+const FileSpecList *containingSourceFiles, RegularExpression func_regex,
 lldb::LanguageType requested_language, LazyBool skip_prologue,
 bool internal, bool hardware) {
   SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList(
@@ -556,7 +556,7 @@
   ? GetSkipPrologue()
   : static_cast(skip_prologue);
   BreakpointResolverSP resolver_sp(new BreakpointResolverName(
-  nullptr, func_regex, requested_language, 0, skip));
+  nullptr, std::move(func_regex), requested_language, 0, skip));
 
   return CreateBreakpoint(filter_sp, resolver_sp, internal, hardware, true);
 }
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -550,8 +550,8 @@
   ConstString("^std::__[[:alnum:]]+::atomic<.+>$"), stl_synth_flags, true);
 
   cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
-  RegularExpressionSP(new RegularExpression(
-  llvm::StringRef("^(std::__[[:alnum:]]+::)deque<.+>(( )?&)?$"))),
+  RegularExpression(
+  llvm::StringRef("^(std::__[[:alnum:]]+::)deque<.+>(( )?&)?$")),
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
@@ -750,38 +750,32 @@
   false);
 
   cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
-  RegularExpressionSP(
-  new RegularExpression(llvm::StringRef("^std::vector<.+>(( )?&)?$"))),
+  RegularExpression(llvm::StringRef("^std::vector<.+>(( )?&)?$")),
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
   cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
-  RegularExpressionSP(
-  new RegularExpression(llvm::StringRef("^std::map<.+> >(( )?&)?$"))),
+  RegularExpression(llvm::StringRef("^std::map<.+> >(( )?&)?$")),
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider")));
   cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
-  RegularExpressionSP(new RegularExpression(
-  llvm::StringRef("^std::(__cxx11::)?list<.+>(( )?&)?$"))),
+  RegularExpression(llvm::StringRef("^std::

[Lldb-commits] [PATCH] D66654: 2/2: Process formatters in reverse-chronological order

2019-09-01 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 218265.
jankratochvil retitled this revision from "Prevent D66398 
`TestDataFormatterStdList`-like regressions in the future" to "2/2: Process 
formatters in reverse-chronological order".
jankratochvil edited the summary of this revision.
jankratochvil added a reverted change: D66398: 2/2: Fix 
`TestDataFormatterStdList` regression.
jankratochvil added a comment.
Herald added a subscriber: abidh.

In D66654#1646544 , @labath wrote:

> Personally, I'd go for the registration order,


Then you cannot override any existing formatter. Then it would be better to 
rather assert/error in such case which I tried to do in this patch but nobody 
likes this patch much.

> or possibly the reverse registration order,

That is what this new patch implements.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66654/new/

https://reviews.llvm.org/D66654

Files:
  lldb/include/lldb/DataFormatters/FormattersContainer.h

Index: lldb/include/lldb/DataFormatters/FormattersContainer.h
===
--- lldb/include/lldb/DataFormatters/FormattersContainer.h
+++ lldb/include/lldb/DataFormatters/FormattersContainer.h
@@ -65,8 +65,49 @@
 template  class FormatMap {
 public:
   typedef typename ValueType::SharedPointer ValueSP;
-  typedef std::map MapType;
+  // A ValueSP wrapper to track its lifetime and remove it from 'm_age' during
+  // its destruction.
+  class ValueTracker {
+  private:
+typedef std::list *> AgeType;
+void Destroy() {
+  if (m_age_iterator != m_age.end())
+m_age.erase(m_age_iterator);
+}
+
+  public:
+typedef ValueSP payload_type;
+ValueTracker(payload_type payload, AgeType &age)
+: m_payload(std::move(payload)), m_age(age), m_age_iterator(age.end()) {
+}
+void Initialize(typename AgeType::iterator age_iterator) {
+  Destroy();
+  lldbassert(&(*age_iterator)->second == this);
+  m_age_iterator = age_iterator;
+}
+ValueTracker(ValueTracker &&other)
+: m_payload(std::move(other.m_payload)), m_age(other.m_age),
+  m_age_iterator(other.m_age_iterator) {
+  lldbassert(m_age_iterator == m_age.end());
+}
+ValueTracker &operator=(ValueTracker &&other) {
+  std::swap(m_payload, other.m_payload);
+  return *this;
+}
+~ValueTracker() { Destroy(); }
+const payload_type &payload() const { return m_payload; }
+
+  private:
+payload_type m_payload;
+AgeType &m_age;
+typename AgeType::iterator m_age_iterator;
+
+DISALLOW_COPY_AND_ASSIGN(ValueTracker);
+  };
+  typedef std::map MapType;
   typedef typename MapType::iterator MapIterator;
+  typedef std::list *> AgeType;
+  typedef typename AgeType::iterator AgeIterator;
   typedef std::function ForEachCallback;
 
   FormatMap(IFormatChangeListener *lst)
@@ -79,7 +120,17 @@
   entry->GetRevision() = 0;
 
 std::lock_guard guard(m_map_mutex);
-m_map[std::move(name)] = entry;
+MapIterator iter = m_map.find(name);
+if (iter != m_map.end())
+  iter->second = ValueTracker(entry, m_age);
+else {
+  auto inserted =
+  m_map.emplace(std::move(name), ValueTracker(entry, m_age));
+  assert(inserted.second);
+  iter = inserted.first;
+}
+m_age.push_front(&*iter);
+iter->second.Initialize(m_age.begin());
 if (listener)
   listener->Changed();
   }
@@ -107,7 +158,7 @@
 MapIterator iter = m_map.find(name);
 if (iter == m_map.end())
   return false;
-entry = iter->second;
+entry = iter->second.payload();
 return true;
   }
 
@@ -117,7 +168,7 @@
   MapIterator pos, end = m_map.end();
   for (pos = m_map.begin(); pos != end; pos++) {
 const KeyType &type = pos->first;
-if (!callback(type, pos->second))
+if (!callback(type, pos->second.payload()))
   break;
   }
 }
@@ -135,10 +186,10 @@
   if (end == iter)
 return ValueSP();
 }
-return iter->second;
+return iter->second.payload();
   }
 
-  // If caller holds the mutex we could return a reference without copy ctor.
+  // If caller holds the mutex we could return a reference without the copying.
   KeyType GetKeyAtIndex(size_t index) {
 std::lock_guard guard(m_map_mutex);
 MapIterator iter = m_map.begin();
@@ -153,10 +204,13 @@
   }
 
 protected:
+  AgeType m_age;
+  // 'm_map' must be destructed first as its element dtor accesses 'm_age'.
   MapType m_map;
   std::recursive_mutex m_map_mutex;
   IFormatChangeListener *listener;
 
+  const AgeType &age() const { return m_age; }
   MapType &map() { return m_map; }
 
   std::recursive_mutex &mutex() { return m_map_mutex; }
@@ -173,7 +227,9 @@
   typedef typename BackEndType::MapType MapType;
   typedef typename MapType::iterator MapIterator;
   typedef typename MapType::key_type MapKeyType;
-  typedef typename MapType::mapped_type MapV

[Lldb-commits] [lldb] r370616 - [lldb][NFC] Fix failing tests on macOS after restructuring test folder

2019-09-01 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Sun Sep  1 09:30:06 2019
New Revision: 370616

URL: http://llvm.org/viewvc/llvm-project?rev=370616&view=rev
Log:
[lldb][NFC] Fix failing tests on macOS after restructuring test folder

Modified:
lldb/trunk/packages/Python/lldbsuite/test/commands/add-dsym/uuid/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash-incomplete-record/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash-lambda/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash1/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash2/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/context-object-objc/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/fixits/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/import_builtin_fileid/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/macros/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/namespace_local_var_same_name_cpp_and_c/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/namespace_local_var_same_name_obj_c/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/persist_objc_pointeetype/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/po_verbosity/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/two-files/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/weak_symbols/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/array/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/bad-reference/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/complicated-expression/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/dereference-argument/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/dereference-function-return/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/dereference-this/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/inheritance/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/local-variable/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/frame/diagnose/virtual-method-call/Makefile
lldb/trunk/packages/Python/lldbsuite/test/commands/frame/recognizer/Makefile

lldb/trunk/packages/Python/lldbsuite/test/commands/process/launch-with-shellexpand/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/add-dsym/uuid/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/add-dsym/uuid/Makefile?rev=370616&r1=370615&r2=370616&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/commands/add-dsym/uuid/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/add-dsym/uuid/Makefile 
Sun Sep  1 09:30:06 2019
@@ -1,4 +1,4 @@
-LEVEL = ../../make
+LEVEL = ../../../make
 
 CXX_SOURCES := main.cpp
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile?rev=370616&r1=370615&r2=370616&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/call-throws/Makefile
 Sun Sep  1 09:30:06 2019
@@ -1,4 +1,4 @@
-LEVEL = ../../make
+LEVEL = ../../../make
 
 OBJC_SOURCES := call-throws.m
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash-incomplete-record/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash-incomplete-record/Makefile?rev=370616&r1=370615&r2=370616&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash-incomplete-record/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash-incomplete-record/Makefile
 Sun Sep  1 09:30:06 2019
@@ -1,3 +1,3 @@
-LEVEL = ../../make
+LEVEL = ../../../make
 CXX_SOURCES := main.cpp
 include $(LEVEL)/Makefile.rules

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/completion-crash-lambda/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/co

[Lldb-commits] [PATCH] D66654: 2/2: Process formatters in reverse-chronological order

2019-09-01 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 218269.

Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66654/new/

https://reviews.llvm.org/D66654

Files:
  lldb/include/lldb/DataFormatters/FormattersContainer.h
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py

Index: lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
@@ -136,6 +136,13 @@
 self.expect("frame variable int_array",
 substrs=['1,2'])
 
+# Test the patterns are matched in reverse-chronological order.
+self.runCmd(
+'type summary add --summary-string \"${var[2-3]}\" "int []"')
+
+self.expect("frame variable int_array",
+substrs=['3,4'])
+
 self.runCmd("type summary clear")
 
 self.runCmd("type summary add -c -x \"i_am_cool \[[0-9]\]\"")
Index: lldb/include/lldb/DataFormatters/FormattersContainer.h
===
--- lldb/include/lldb/DataFormatters/FormattersContainer.h
+++ lldb/include/lldb/DataFormatters/FormattersContainer.h
@@ -65,8 +65,49 @@
 template  class FormatMap {
 public:
   typedef typename ValueType::SharedPointer ValueSP;
-  typedef std::map MapType;
+  // A ValueSP wrapper to track its lifetime and remove it from 'm_age' during
+  // its destruction.
+  class ValueTracker {
+  private:
+typedef std::list *> AgeType;
+void Destroy() {
+  if (m_age_iterator != m_age.end())
+m_age.erase(m_age_iterator);
+}
+
+  public:
+typedef ValueSP payload_type;
+ValueTracker(payload_type payload, AgeType &age)
+: m_payload(std::move(payload)), m_age(age), m_age_iterator(age.end()) {
+}
+void Initialize(typename AgeType::iterator age_iterator) {
+  Destroy();
+  lldbassert(&(*age_iterator)->second == this);
+  m_age_iterator = age_iterator;
+}
+ValueTracker(ValueTracker &&other)
+: m_payload(std::move(other.m_payload)), m_age(other.m_age),
+  m_age_iterator(other.m_age_iterator) {
+  lldbassert(m_age_iterator == m_age.end());
+}
+ValueTracker &operator=(ValueTracker &&other) {
+  std::swap(m_payload, other.m_payload);
+  return *this;
+}
+~ValueTracker() { Destroy(); }
+const payload_type &payload() const { return m_payload; }
+
+  private:
+payload_type m_payload;
+AgeType &m_age;
+typename AgeType::iterator m_age_iterator;
+
+DISALLOW_COPY_AND_ASSIGN(ValueTracker);
+  };
+  typedef std::map MapType;
   typedef typename MapType::iterator MapIterator;
+  typedef std::list *> AgeType;
+  typedef typename AgeType::iterator AgeIterator;
   typedef std::function ForEachCallback;
 
   FormatMap(IFormatChangeListener *lst)
@@ -79,7 +120,17 @@
   entry->GetRevision() = 0;
 
 std::lock_guard guard(m_map_mutex);
-m_map[std::move(name)] = entry;
+MapIterator iter = m_map.find(name);
+if (iter != m_map.end())
+  iter->second = ValueTracker(entry, m_age);
+else {
+  auto inserted =
+  m_map.emplace(std::move(name), ValueTracker(entry, m_age));
+  assert(inserted.second);
+  iter = inserted.first;
+}
+m_age.push_front(&*iter);
+iter->second.Initialize(m_age.begin());
 if (listener)
   listener->Changed();
   }
@@ -107,7 +158,7 @@
 MapIterator iter = m_map.find(name);
 if (iter == m_map.end())
   return false;
-entry = iter->second;
+entry = iter->second.payload();
 return true;
   }
 
@@ -117,7 +168,7 @@
   MapIterator pos, end = m_map.end();
   for (pos = m_map.begin(); pos != end; pos++) {
 const KeyType &type = pos->first;
-if (!callback(type, pos->second))
+if (!callback(type, pos->second.payload()))
   break;
   }
 }
@@ -135,10 +186,10 @@
   if (end == iter)
 return ValueSP();
 }
-return iter->second;
+return iter->second.payload();
   }
 
-  // If caller holds the mutex we could return a reference without copy ctor.
+  // If caller holds the mutex we could return a reference without the copying.
   KeyType GetKeyAtIndex(size_t index) {
 std::lock_guard guard(m_map_mutex);
 MapIterator iter = m_map.begin();
@@ -153,10 +204,13 @@
   }
 
 protected:
+  AgeType m_age;
+  // 'm_map' must be destructed first as its element dtor accesses 'm_age'.
   MapType m_map;
   std::recursive_mutex m_map_mutex;
   IFormatChangeListener *listener;
 
+  const AgeType &age() const { return m_age; }
   MapType &map() { return m_map; }
 
   std::recursive_mutex &mute

[Lldb-commits] [lldb] r370618 - [lldb][NFC] Add test for invalid expression command args

2019-09-01 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Sun Sep  1 11:59:40 2019
New Revision: 370618

URL: http://llvm.org/viewvc/llvm-project?rev=370618&view=rev
Log:
[lldb][NFC] Add test for invalid expression command args

Added:
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/

lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py

Added: 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py?rev=370618&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/expression/invalid-args/TestInvalidArgsExpression.py
 Sun Sep  1 11:59:40 2019
@@ -0,0 +1,48 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+class InvalidArgsExpressionTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+@no_debug_info_test
+def test_invalid_lang(self):
+self.expect("expression -l foo --", error=True,
+substrs=["error: unknown language type: 'foo' for 
expression"])
+
+@no_debug_info_test
+def test_invalid_all_thread(self):
+self.expect("expression -a foo --", error=True,
+substrs=['error: invalid all-threads value setting: 
"foo"'])
+
+@no_debug_info_test
+def test_invalid_ignore_br(self):
+self.expect("expression -i foo --", error=True,
+substrs=['error: could not convert "foo" to a boolean 
value.'])
+
+@no_debug_info_test
+def test_invalid_allow_jit(self):
+self.expect("expression -j foo --", error=True,
+substrs=['error: could not convert "foo" to a boolean 
value.'])
+
+@no_debug_info_test
+def test_invalid_timeout(self):
+self.expect("expression -t foo --", error=True,
+substrs=['error: invalid timeout setting "foo"'])
+
+self.expect("expression -t \"\" --", error=True,
+substrs=['error: invalid timeout setting ""'])
+
+@no_debug_info_test
+def test_invalid_unwind(self):
+self.expect("expression -u foo --", error=True,
+substrs=['error: could not convert "foo" to a boolean 
value.'])
+
+@no_debug_info_test
+def test_invalid_fixits(self):
+self.expect("expression -X foo --", error=True,
+substrs=['error: could not convert "foo" to a boolean 
value.'])


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r370619 - [lldb] Test and fix invalid log command invocations

2019-09-01 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Sun Sep  1 12:29:01 2019
New Revision: 370619

URL: http://llvm.org/viewvc/llvm-project?rev=370619&view=rev
Log:
[lldb] Test and fix invalid log command invocations

Added:
lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/

lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py
Modified:
lldb/trunk/source/Commands/CommandObjectLog.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py?rev=370619&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/commands/log/invalid-args/TestInvalidArgsLog.py
 Sun Sep  1 12:29:01 2019
@@ -0,0 +1,25 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+class InvalidArgsLogTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+@no_debug_info_test
+def test_enable_empty(self):
+self.expect("log enable", error=True,
+substrs=["error: log enable takes a log channel and one or 
more log types."])
+
+@no_debug_info_test
+def test_disable_empty(self):
+self.expect("log disable", error=True,
+substrs=["error: log disable takes a log channel and one 
or more log types."])
+
+@no_debug_info_test
+def test_timer_empty(self):
+self.expect("log timer", error=True,
+substrs=["error: Missing subcommand"])

Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=370619&r1=370618&r2=370619&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Sun Sep  1 12:29:01 2019
@@ -140,6 +140,7 @@ protected:
   result.AppendErrorWithFormat(
   "%s takes a log channel and one or more log types.\n",
   m_cmd_name.c_str());
+  result.SetStatus(eReturnStatusFailed);
   return false;
 }
 
@@ -207,6 +208,7 @@ protected:
   result.AppendErrorWithFormat(
   "%s takes a log channel and one or more log types.\n",
   m_cmd_name.c_str());
+  result.SetStatus(eReturnStatusFailed);
   return false;
 }
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits