[Lldb-commits] [lldb] r369235 - [lldb] Remove unused inheritance in RegularExpression

2019-08-19 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Mon Aug 19 00:06:56 2019
New Revision: 369235

URL: http://llvm.org/viewvc/llvm-project?rev=369235&view=rev
Log:
[lldb] Remove unused inheritance in RegularExpression

D66174 left inherited llvm::Regex which is now a member variable there.

Approved as a part of: https://reviews.llvm.org/D66392#1634575

Modified:
lldb/trunk/include/lldb/Utility/RegularExpression.h

Modified: lldb/trunk/include/lldb/Utility/RegularExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/RegularExpression.h?rev=369235&r1=369234&r2=369235&view=diff
==
--- lldb/trunk/include/lldb/Utility/RegularExpression.h (original)
+++ lldb/trunk/include/lldb/Utility/RegularExpression.h Mon Aug 19 00:06:56 2019
@@ -15,7 +15,7 @@
 
 namespace lldb_private {
 
-class RegularExpression : public llvm::Regex {
+class RegularExpression {
 public:
   /// Default constructor.
   ///


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


[Lldb-commits] [lldb] r369237 - [lldb][NFC] Address review comments to StringList for-loop support

2019-08-19 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Aug 19 00:22:19 2019
New Revision: 369237

URL: http://llvm.org/viewvc/llvm-project?rev=369237&view=rev
Log:
[lldb][NFC] Address review comments to StringList for-loop support

Modified:
lldb/trunk/include/lldb/Utility/StringList.h
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Utility/StringList.cpp
lldb/trunk/unittests/Utility/StringListTest.cpp

Modified: lldb/trunk/include/lldb/Utility/StringList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringList.h?rev=369237&r1=369236&r2=369237&view=diff
==
--- lldb/trunk/include/lldb/Utility/StringList.h (original)
+++ lldb/trunk/include/lldb/Utility/StringList.h Mon Aug 19 00:22:19 2019
@@ -23,7 +23,7 @@ class Stream;
 namespace lldb_private {
 
 class StringList {
-  typedef std::vector StorageType;
+  typedef std::vector collection;
 
 public:
   StringList();
@@ -54,8 +54,8 @@ public:
 
   size_t GetMaxStringLength() const;
 
-  typedef StorageType::iterator iterator;
-  typedef StorageType::const_iterator const_iterator;
+  typedef collection::iterator iterator;
+  typedef collection::const_iterator const_iterator;
 
   iterator begin() { return m_strings.begin(); }
   iterator end() { return m_strings.end(); }
@@ -135,7 +135,7 @@ public:
   }
 
 private:
-  StorageType m_strings;
+  collection m_strings;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=369237&r1=369236&r2=369237&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Mon Aug 19 00:22:19 2019
@@ -436,10 +436,9 @@ protected:
 Status error;
 
 for (const std::string &type_name : options->m_target_types) {
-  ConstString const_type_name(type_name);
-  if (const_type_name) {
+  if (!type_name.empty()) {
 if (!CommandObjectTypeSynthAdd::AddSynth(
-const_type_name, synth_provider,
+ConstString(type_name), synth_provider,
 options->m_regex
 ? CommandObjectTypeSynthAdd::eRegexSynth
 : CommandObjectTypeSynthAdd::eRegularSynth,

Modified: lldb/trunk/source/Utility/StringList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringList.cpp?rev=369237&r1=369236&r2=369237&view=diff
==
--- lldb/trunk/source/Utility/StringList.cpp (original)
+++ lldb/trunk/source/Utility/StringList.cpp Mon Aug 19 00:22:19 2019
@@ -61,6 +61,7 @@ void StringList::AppendList(const char *
 }
 
 void StringList::AppendList(StringList strings) {
+  m_strings.reserve(m_strings.size() + strings.GetSize());
   m_strings.insert(m_strings.end(), strings.begin(), strings.end());
 }
 

Modified: lldb/trunk/unittests/Utility/StringListTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/StringListTest.cpp?rev=369237&r1=369236&r2=369237&view=diff
==
--- lldb/trunk/unittests/Utility/StringListTest.cpp (original)
+++ lldb/trunk/unittests/Utility/StringListTest.cpp Mon Aug 19 00:22:19 2019
@@ -512,7 +512,7 @@ TEST(StringListTest, ForRangeEmpty) {
 FAIL() << "Shouldn't have hit an element in for range" << e;
 }
 
-TEST(StringListTest, ForRangeSingle) {
+TEST(StringListTest, ForRange) {
   StringList s;
   s.AppendString("a");
   s.AppendString("b");


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


[Lldb-commits] [PATCH] D60963: Fix dereferencing null pointer

2019-08-19 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk marked an inline comment as done.
kwk added inline comments.



Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:737
 
 TagTypeNode *Demangler::parseTagUniqueName(StringView &MangledName) {
+  if (!MangledName.consumeFront(".?A")) {

thakis wrote:
> kwk wrote:
> > Why not change the return type to `llvm::Expected`? Then you 
> > have one return value that is either an error (when return value evaluates 
> > to `false`) or the value. On top of just a boolean `Error` variable you 
> > then can also use the return value to store error texts if you need them. 
> > Now, I don't know if the `Error` member is used anywhere else. 
> Error is not a parameter, it's class-level state that's used pervasively in 
> this file.
Okay, was just a thought. Thanks for explaining.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D60963



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


[Lldb-commits] [PATCH] D66345: [lldb][NFC] Allow for-range iterating over StringList

2019-08-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor closed this revision.
teemperor marked 5 inline comments as done.
teemperor added a comment.

In D66345#1633172 , @labath wrote:

> In D66345#1633118 , @teemperor wrote:
>
> > Not sure if we can get rid of StringList so easily as we still have 
> > SBStringList.
>
>
> We can keep the SBStringList. We can just have it be backed by a 
> `vector` instead of the StringList thingy...


I rarely touch the SB* classes, but I always thought we just want them as thin 
wrappers around LLDB classes? If not, then yeah, removing StringList seems good 
to me :).




Comment at: lldb/include/lldb/Utility/StringList.h:26
 class StringList {
+  typedef std::vector StorageType;
+

JDevlieghere wrote:
> This typedef is commonly `collection` in LLDB [1]. I think we should do the 
> same here for consistency. 
> 
> [1] See `TypeMap.h`, `Value.h`, `QueueList.h` etc
Thanks!



Comment at: lldb/source/Commands/CommandObjectApropos.cpp:70
+max_len = std::max(max_len, command.size());
   }
 

amccarth wrote:
> Or
> 
> ```
> const size_t max_len =
> std::max_element(commands_found.begin(), commands_found.end());
> ```
Don't think that works without a lambda that calls `.size()`, but StringList 
actually has a method for finding the max string length so we might as well use 
that.



Comment at: lldb/unittests/Utility/StringListTest.cpp:515
+
+TEST(StringListTest, ForRangeSingle) {
+  StringList s;

amccarth wrote:
> What does "ForRangeSingle" mean here?  The name led me to believe you were 
> going to test a 1-element StringList, but I see three elements.
Yeah, that was originally just for one element (before I just made one test 
with three elements which should be enough coverage).


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

https://reviews.llvm.org/D66345



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


[Lldb-commits] [lldb] r369240 - [lldb][NFC] Use GetMaxStringLength in CommandObjectApropos::DoExecute

2019-08-19 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Aug 19 00:59:44 2019
New Revision: 369240

URL: http://llvm.org/viewvc/llvm-project?rev=369240&view=rev
Log:
[lldb][NFC] Use GetMaxStringLength in CommandObjectApropos::DoExecute

Modified:
lldb/trunk/source/Commands/CommandObjectApropos.cpp

Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=369240&r1=369239&r2=369240&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Mon Aug 19 00:59:44 2019
@@ -63,11 +63,7 @@ bool CommandObjectApropos::DoExecute(Arg
 if (commands_found.GetSize() > 0) {
   result.AppendMessageWithFormat(
   "The following commands may relate to '%s':\n", args[0].c_str());
-  size_t max_len = 0;
-
-  for (const std::string &command : commands_found) {
-max_len = std::max(max_len, command.size());
-  }
+  const size_t max_len = commands_found.GetMaxStringLength();
 
   for (size_t i = 0; i < commands_found.GetSize(); ++i)
 m_interpreter.OutputFormattedHelpText(


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


[Lldb-commits] [lldb] r369242 - [lldb][NFC] Remove StringList::AutoComplete

2019-08-19 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Aug 19 01:15:46 2019
New Revision: 369242

URL: http://llvm.org/viewvc/llvm-project?rev=369242&view=rev
Log:
[lldb][NFC] Remove StringList::AutoComplete

We don't need this very specific function in StringList that
we only call once in LLDB.

Modified:
lldb/trunk/include/lldb/Utility/StringList.h
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Utility/StringList.cpp

Modified: lldb/trunk/include/lldb/Utility/StringList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringList.h?rev=369242&r1=369241&r2=369242&view=diff
==
--- lldb/trunk/include/lldb/Utility/StringList.h (original)
+++ lldb/trunk/include/lldb/Utility/StringList.h Mon Aug 19 01:15:46 2019
@@ -107,14 +107,6 @@ public:
   // Copy assignment for a vector of strings
   StringList &operator=(const std::vector &rhs);
 
-  // This string list contains a list of valid auto completion strings, and the
-  // "s" is passed in. "matches" is filled in with zero or more string values
-  // that start with "s", and the first string to exactly match one of the
-  // string values in this collection, will have "exact_matches_idx" filled in
-  // to match the index, or "exact_matches_idx" will have SIZE_MAX
-  size_t AutoComplete(llvm::StringRef s, StringList &matches,
-  size_t &exact_matches_idx) const;
-
   // Dump the StringList to the given lldb_private::Log, `log`, one item per
   // line. If given, `name` will be used to identify the start and end of the
   // list in the output.

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=369242&r1=369241&r2=369242&view=diff
==
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Mon Aug 19 01:15:46 2019
@@ -309,12 +309,18 @@ int CommandCompletions::SettingsNames(Co
 }
   }
 
-  size_t exact_matches_idx = SIZE_MAX;
-  StringList matches;
-  g_property_names.AutoComplete(request.GetCursorArgumentPrefix(), matches,
-exact_matches_idx);
-  request.SetWordComplete(exact_matches_idx != SIZE_MAX);
-  request.AddCompletions(matches);
+  bool exact_match = false;
+
+  for (const std::string &s : g_property_names) {
+if (llvm::StringRef(s).startswith(request.GetCursorArgumentPrefix())) {
+  if (request.GetCursorArgumentPrefix() == s)
+exact_match = true;
+  request.AddCompletion(s);
+}
+  }
+
+  request.SetWordComplete(exact_match);
+
   return request.GetNumberOfMatches();
 }
 

Modified: lldb/trunk/source/Utility/StringList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringList.cpp?rev=369242&r1=369241&r2=369242&view=diff
==
--- lldb/trunk/source/Utility/StringList.cpp (original)
+++ lldb/trunk/source/Utility/StringList.cpp Mon Aug 19 01:15:46 2019
@@ -223,29 +223,6 @@ StringList &StringList::operator=(const
   return *this;
 }
 
-size_t StringList::AutoComplete(llvm::StringRef s, StringList &matches,
-size_t &exact_idx) const {
-  matches.Clear();
-  exact_idx = SIZE_MAX;
-  if (s.empty()) {
-// No string, so it matches everything
-matches = *this;
-return matches.GetSize();
-  }
-
-  const size_t s_len = s.size();
-  const size_t num_strings = m_strings.size();
-
-  for (size_t i = 0; i < num_strings; ++i) {
-if (m_strings[i].find(s) == 0) {
-  if (exact_idx == SIZE_MAX && m_strings[i].size() == s_len)
-exact_idx = matches.GetSize();
-  matches.AppendString(m_strings[i]);
-}
-  }
-  return matches.GetSize();
-}
-
 void StringList::LogDump(Log *log, const char *name) {
   if (!log)
 return;


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


[Lldb-commits] [lldb] r369249 - [lldb][NFC] Add a few more completion tests to increase test coverage

2019-08-19 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Aug 19 03:46:38 2019
New Revision: 369249

URL: http://llvm.org/viewvc/llvm-project?rev=369249&view=rev
Log:
[lldb][NFC] Add a few more completion tests to increase test coverage

These tests are mostly trying to reach the different completion functions
in CommandCompletions.cpp (::ArchitectureNames, ::DiskFiles, ::Modules).

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=369249&r1=369248&r2=369249&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 Mon Aug 19 03:46:38 2019
@@ -84,6 +84,29 @@ class CommandLineCompletionTestCase(Test
 'process attach --con',
 'process attach --continue ')
 
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_process_launch_arch(self):
+self.complete_from_to('process launch --arch ',
+  ['mips',
+   'arm64'])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_process_launch_arch_arm(self):
+self.complete_from_to('process launch --arch arm',
+  ['arm64'])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_target_symbols_add_shlib(self):
+# Doesn't seem to work, but at least it shouldn't crash.
+self.complete_from_to('target symbols add --shlib ', [])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_log_file(self):
+# Complete in our source directory which contains a 'main.cpp' file.
+src_dir =  os.path.dirname(os.path.realpath(__file__)) + '/'
+self.complete_from_to('log enable lldb expr -f ' + src_dir,
+  ['main.cpp'])
+
 # 
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_infinite_loop_while_completing(self):


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


[Lldb-commits] [lldb] r369252 - [lldb][NFC] Use CompletionRequest in Variable::AutoComplete

2019-08-19 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Aug 19 04:49:43 2019
New Revision: 369252

URL: http://llvm.org/viewvc/llvm-project?rev=369252&view=rev
Log:
[lldb][NFC] Use CompletionRequest in Variable::AutoComplete

Modified:
lldb/trunk/source/Symbol/Variable.cpp

Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=369252&r1=369251&r2=369252&view=diff
==
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Mon Aug 19 04:49:43 2019
@@ -488,24 +488,21 @@ static void PrivateAutoComplete(
 StackFrame *frame, llvm::StringRef partial_path,
 const llvm::Twine
 &prefix_path, // Anything that has been resolved already will be in 
here
-const CompilerType &compiler_type,
-StringList &matches, bool &word_complete);
+const CompilerType &compiler_type, CompletionRequest &request);
 
 static void PrivateAutoCompleteMembers(
 StackFrame *frame, const std::string &partial_member_name,
 llvm::StringRef partial_path,
 const llvm::Twine
 &prefix_path, // Anything that has been resolved already will be in 
here
-const CompilerType &compiler_type,
-StringList &matches, bool &word_complete);
+const CompilerType &compiler_type, CompletionRequest &request);
 
 static void PrivateAutoCompleteMembers(
 StackFrame *frame, const std::string &partial_member_name,
 llvm::StringRef partial_path,
 const llvm::Twine
 &prefix_path, // Anything that has been resolved already will be in 
here
-const CompilerType &compiler_type,
-StringList &matches, bool &word_complete) {
+const CompilerType &compiler_type, CompletionRequest &request) {
 
   // We are in a type parsing child members
   const uint32_t num_bases = compiler_type.GetNumDirectBaseClasses();
@@ -515,9 +512,9 @@ static void PrivateAutoCompleteMembers(
   CompilerType base_class_type =
   compiler_type.GetDirectBaseClassAtIndex(i, nullptr);
 
-  PrivateAutoCompleteMembers(
-  frame, partial_member_name, partial_path, prefix_path,
-  base_class_type.GetCanonicalType(), matches, word_complete);
+  PrivateAutoCompleteMembers(frame, partial_member_name, partial_path,
+ prefix_path,
+ base_class_type.GetCanonicalType(), request);
 }
   }
 
@@ -528,9 +525,9 @@ static void PrivateAutoCompleteMembers(
   CompilerType vbase_class_type =
   compiler_type.GetVirtualBaseClassAtIndex(i, nullptr);
 
-  PrivateAutoCompleteMembers(
-  frame, partial_member_name, partial_path, prefix_path,
-  vbase_class_type.GetCanonicalType(), matches, word_complete);
+  PrivateAutoCompleteMembers(frame, partial_member_name, partial_path,
+ prefix_path,
+ vbase_class_type.GetCanonicalType(), request);
 }
   }
 
@@ -551,9 +548,9 @@ static void PrivateAutoCompleteMembers(
   frame, partial_path,
   prefix_path + member_name, // Anything that has been resolved
  // already will be in here
-  member_compiler_type.GetCanonicalType(), matches, word_complete);
+  member_compiler_type.GetCanonicalType(), request);
 } else {
-  matches.AppendString((prefix_path + member_name).str());
+  request.AddCompletion((prefix_path + member_name).str());
 }
   }
 }
@@ -564,8 +561,7 @@ static void PrivateAutoComplete(
 StackFrame *frame, llvm::StringRef partial_path,
 const llvm::Twine
 &prefix_path, // Anything that has been resolved already will be in 
here
-const CompilerType &compiler_type,
-StringList &matches, bool &word_complete) {
+const CompilerType &compiler_type, CompletionRequest &request) {
   //printf ("\nPrivateAutoComplete()\n\tprefix_path = '%s'\n\tpartial_path 
=
   //'%s'\n", prefix_path.c_str(), partial_path.c_str());
   std::string remaining_partial_path;
@@ -586,15 +582,15 @@ static void PrivateAutoComplete(
   case eTypeClassReference:
   case eTypeClassTypedef:
   case eTypeClassVector: {
-matches.AppendString(prefix_path.str());
-word_complete = matches.GetSize() == 1;
+request.AddCompletion(prefix_path.str());
+request.SetWordComplete(true);
   } break;
 
   case eTypeClassClass:
   case eTypeClassStruct:
   case eTypeClassUnion:
 if (prefix_path.str().back() != '.')
-  matches.AppendString((prefix_path + ".").str());
+  request.AddCompletion((prefix_path + ".").str());
 break;
 
   case eTypeClassObjCObject:
@@ -604,10 +600,10 @@ static void PrivateAutoComplete(
   case eTypeClassPointer: {
 bool omit_empty_base_classes = true;
 if (compiler_type.GetNumChildr

[Lldb-commits] [PATCH] D66370: [dotest] Add a dotest flag `--force-dwarf` to override the tested DWARF version.

2019-08-19 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

This looks fine to me. We spoke about this on irc, but I'll just repeat what I 
said here for the record. Running the dotest tests with different 
compilers/architectures/dwarf versions/etc. is very useful for increasing 
coverage, finding new bugs, etc. However, I don't think we should be using this 
facility as a first or only line of defence against regressions. Specifically, 
I'd like to avoid arguments like "there's no need to add tests for this because 
this code is exercised when running the test suite with gcc-47 and dwarf-13 on 
a Tuesday wearing shorts". New features/bugfixes should be testable in the 
default configuration, and this facility should be the "extra mile".




Comment at: lldb/packages/Python/lldbsuite/test/dotest.py:353
+
+os.environ['CFLAGS_EXTRAS'] = cflags_extras
 

aprantl wrote:
> Does this actually work with tests whose Makefiles manually set 
> CFLAGS_EXTRAS? I.e., do we need to distinguish between extra CFLAGS that come 
> in from the layer above and ones that are meant to be customized in the 
> individual test Makefiles?
If makefiles do `CFLAGS_EXTRAS += ...` instead of `CFLAGS_EXTRAS = foo` (which 
I think most do), then everything should be fine.



Comment at: lldb/packages/Python/lldbsuite/test/dotest_args.py:129
+group.add_argument(
+'--force-dwarf',
+metavar='dwarf_version',

Maybe just call the argument `--dwarf-version`, just like the source variable?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66370



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


[Lldb-commits] [PATCH] D66345: [lldb][NFC] Allow for-range iterating over StringList

2019-08-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D66345#1634800 , @teemperor wrote:

> In D66345#1633172 , @labath wrote:
>
> > In D66345#1633118 , @teemperor 
> > wrote:
> >
> > > Not sure if we can get rid of StringList so easily as we still have 
> > > SBStringList.
> >
> >
> > We can keep the SBStringList. We can just have it be backed by a 
> > `vector` instead of the StringList thingy...
>
>
> I rarely touch the SB* classes, but I always thought we just want them as 
> thin wrappers around LLDB classes? If not, then yeah, removing StringList 
> seems good to me :).


Yes, the SB classes should be thin, but I would interpret the "thinness" as 
"they shouldn't implement non-trivial logic", not as "there must be a non-SB 
class of the same name which they delegate to". I don't think the latter would 
be fair because the SB classes are basically frozen solid, and the second 
requirement would inflict that solidity on the rest of lldb too. We should have 
the ability refactor, clean up or otherwise improve internal lldb interfaces 
even if that means diverging the SB and non-SB class variants. Now, that 
divergence has a cost, and that should be weighed against the other benefits of 
the change, but it shouldn't be an immediate show-stopper. In this case, I 
would say that the cost of that is quite low, because StringList essentially is 
a `std::vector` and anything extra it provides on top of that 
(e.g. LongestCommonPrefix) can be easily implemented as a free function.


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

https://reviews.llvm.org/D66345



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


[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context

2019-08-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D66357#1634175 , @guiandrade wrote:

> In D66357#1633461 , @clayborg wrote:
>
> > Needs a test, but looks good.
>
>
> Sure, I agree. Though, it's not total clear to me how we could do that.
>
> I imagined something like the following.
>
>   TEST_F(DWARFASTParserClangTests,
>  TestGetDIEForDeclContextReturnsOnlyMatchingEntries) {
> auto ast = ClangASTContext(...);
> auto ast_parser = DWARFASTParserClang(ast);
> CompilerDeclContext decl1(nullptr, (void *)1LL);
> CompilerDeclContext decl2(nullptr, (void *)2LL);
> CompilerDeclContext decl3(nullptr, (void *)2LL);
> CompilerDeclContext decl4(nullptr, (void *)3LL);
> ast_parser->LinkDeclContextToDIE(decl1, DWARFDIE());
> ast_parser->LinkDeclContextToDIE(decl2, DWARFDIE());
> ast_parser->LinkDeclContextToDIE(decl3, DWARFDIE());
> ast_parser->LinkDeclContextToDIE(decl4, DWARFDIE());
>  
> auto decl_ctx_die_list = ast_parser->GetDIEForDeclContext(decl2);
> EXPECT_EQ(2u, decl_ctx_die_list.size());
> EXPECT_EQ(decl2.GetOpaqueDeclContext(),
>   decl_ctx_die_list[0].GetDeclContext().GetOpaqueDeclContext());
> EXPECT_EQ(decl3.GetOpaqueDeclContext(),
>   decl_ctx_die_list[1].GetDeclContext().GetOpaqueDeclContext());
>   }
>
>
> But DWARFASTParserClang::LinkDeclContextToDIE is protected. Do you have any 
> ideas to overcome that?


Feel free to relax that function to be public or to add a testing helper 
function that is public if needed. If you make it public, please put a comment 
on the function to indicate it was done for testing purposes.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66357



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


[Lldb-commits] [PATCH] D66345: [lldb][NFC] Allow for-range iterating over StringList

2019-08-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

The other thing to think about is the SB layer must be thread safe. StringList 
is not thread safe right now, but it probably should be. We might need to keep 
the internal version of StringList and make sure it is thread safe. That will 
ensure that our buildbots always run clean.


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

https://reviews.llvm.org/D66345



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


[Lldb-commits] [PATCH] D66392: 1/2: D66174 `RegularExpression` cleanup

2019-08-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 215890.
jankratochvil retitled this revision from "1/2: D66174 `RegularExpression` 
follow-up/cleanup" to "1/2: D66174 `RegularExpression` cleanup".
jankratochvil added a comment.

In D66392#1634575 , @JDevlieghere 
wrote:

> - Thanks for removing the stale inheritance! (LGTM)


Checked it in now as rL369235 .

> - Thanks for adding the relational operator back. I couldn't find why they 
> were needed (because they weren't used if I understand D66398 
>  correctly). (LGTM)

Yes, you are right the operators were not used.  So I have also moved them now 
to D66398  from this patch.

> - While I was doing the transition I considered the lifetime and came to the 
> conclusion that the regex input string (the StringRef) does not need to 
> outlive the regex compilation (`regcomp`). The interface of `llvm::Regex` 
> gives the same impression. Is this not correct?

OK, it is correct.  So I dropped the core of this patch (+added some lifetime 
explanatory comments).

> - I'm not a fan of the laziness. Do we really need it?

That is no longer a part of this patch.
Just then I find as a good cleanup to drop the `Compile` method there, don't 
you? As I do not find TIMTOWTDI as an advantage and there is already 
constructor parameter to compile the regex.
If this is not considered as a cleanup I will drop this patch and rework D66398 
 to use the `Compile` method again.
I am aware the `llvm/` part of this patch needs an extra approval and this is 
why @jdevlieghere had there that:

  std::string discarded;
  return m_regex.isValid(discarded);

Is it complicated to get the `llvm/` extension approved? I can quickly drop any 
parts of this patch not considered as feasible.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66392

Files:
  lldb/include/lldb/Interpreter/OptionValueRegex.h
  lldb/include/lldb/Utility/RegularExpression.h
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Commands/CommandCompletions.cpp
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Core/AddressResolverName.cpp
  lldb/source/Interpreter/CommandObjectRegexCommand.cpp
  lldb/source/Interpreter/OptionValueRegex.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/source/Target/ThreadPlanStepInRange.cpp
  lldb/source/Utility/RegularExpression.cpp
  llvm/include/llvm/Support/Regex.h

Index: llvm/include/llvm/Support/Regex.h
===
--- llvm/include/llvm/Support/Regex.h
+++ llvm/include/llvm/Support/Regex.h
@@ -44,6 +44,9 @@
 
 Regex();
 /// Compiles the given regular expression \p Regex.
+///
+/// \param Regex - referenced string lifetime is no longer needed after ths
+/// constructor does finish.  Only its compiled form is kept stored.
 Regex(StringRef Regex, unsigned Flags = NoFlags);
 Regex(const Regex &) = delete;
 Regex &operator=(Regex regex) {
@@ -57,6 +60,7 @@
 /// isValid - returns the error encountered during regex compilation, or
 /// matching, if any.
 bool isValid(std::string &Error) const;
+bool isValid() const { return !error; }
 
 /// getNumMatches - In a valid regex, return the number of parenthesized
 /// matches it contains.  The number filled in by match will include this
Index: lldb/source/Utility/RegularExpression.cpp
===
--- lldb/source/Utility/RegularExpression.cpp
+++ lldb/source/Utility/RegularExpression.cpp
@@ -12,28 +12,26 @@
 
 using namespace lldb_private;
 
-RegularExpression::RegularExpression(llvm::StringRef str) { Compile(str); }
-
-RegularExpression::RegularExpression(const RegularExpression &rhs)
-: RegularExpression() {
-  Compile(rhs.GetText());
-}
-
-bool RegularExpression::Compile(llvm::StringRef str) {
+RegularExpression::RegularExpression(llvm::StringRef str) {
   m_regex_text = str;
+
+  // m_regex does not reference str anymore after it is constructed.
   m_regex = llvm::Regex(str);
-  return IsValid();
 }
 
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+: RegularExpression(rhs.GetText()) {}
+
 bool RegularExpression::Execute(
 llvm::StringRef str,
 llvm::SmallVectorImpl *matches) const {
+  if (!IsValid())
+return false;
   return m_regex.match(str, matches);
 }
 
 bool RegularExpression::IsValid() const {
-  std::string discarded;
-  return m_regex.isValid(discarded);
+  return m_regex.isValid();
 }
 
 llvm::StringRef RegularExp

[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context

2019-08-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

If you're in a position to control how the class gets created, you can just 
make a new test class which inherits from `DWARFASTParserClang` and increases 
the visibility of that method. (Though I am somewhat doubtful you'll be able to 
construct this class without any of the other machinery around.)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66357



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


[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 215895.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66398

Files:
  lldb/include/lldb/Breakpoint/BreakpointResolverName.h
  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
@@ -307,14 +307,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);
@@ -549,7 +549,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(
@@ -558,7 +558,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
@@ -547,8 +547,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")));
@@ -744,38 +744,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::(__cxx11::)?list<.+>(( )?&)?$")),
   SyntheticChildrenSP(new ScriptedSyntheticChildren(
   stl_synth_flags,
   "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
   stl_summary_flags.SetDontShowChildren(false);
   stl_summary_flags.SetSkipPointers(true);
   cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
-  RegularExpressionSP(
-  new RegularExpression(ll

[Lldb-commits] [PATCH] D66392: 1/2: D66174 `RegularExpression` cleanup

2019-08-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D66392#1634575 , @JDevlieghere 
wrote:

> I am aware the `llvm/` part of this patch needs an extra approval and this is 
> why @jdevlieghere had there that:
>
>   std::string discarded;
>   return m_regex.isValid(discarded);
>   
>
> Is it complicated to get the `llvm/` extension approved? I can quickly drop 
> any parts of this patch not considered as feasible.


I have put there plain `m_regex.isValid()` instead as with my patch `IsValid()` 
is called during every `Execute()` so `IsValid()` could become a bottleneck.  
But then the `discarded` string is just 32 bytes on stack anyway so it should 
be cheap enough even without the `llvm/` extension.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66392



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


[Lldb-commits] [PATCH] D66392: 1/2: D66174 `RegularExpression` cleanup

2019-08-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 215897.
jankratochvil added a comment.

(comment typo fixed)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66392

Files:
  lldb/include/lldb/Interpreter/OptionValueRegex.h
  lldb/include/lldb/Utility/RegularExpression.h
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Commands/CommandCompletions.cpp
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Core/AddressResolverName.cpp
  lldb/source/Interpreter/CommandObjectRegexCommand.cpp
  lldb/source/Interpreter/OptionValueRegex.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/source/Target/ThreadPlanStepInRange.cpp
  lldb/source/Utility/RegularExpression.cpp
  llvm/include/llvm/Support/Regex.h

Index: llvm/include/llvm/Support/Regex.h
===
--- llvm/include/llvm/Support/Regex.h
+++ llvm/include/llvm/Support/Regex.h
@@ -44,6 +44,9 @@
 
 Regex();
 /// Compiles the given regular expression \p Regex.
+///
+/// \param Regex - referenced string lifetime is no longer needed after this
+/// constructor does finish.  Only its compiled form is kept stored.
 Regex(StringRef Regex, unsigned Flags = NoFlags);
 Regex(const Regex &) = delete;
 Regex &operator=(Regex regex) {
@@ -57,6 +60,7 @@
 /// isValid - returns the error encountered during regex compilation, or
 /// matching, if any.
 bool isValid(std::string &Error) const;
+bool isValid() const { return !error; }
 
 /// getNumMatches - In a valid regex, return the number of parenthesized
 /// matches it contains.  The number filled in by match will include this
Index: lldb/source/Utility/RegularExpression.cpp
===
--- lldb/source/Utility/RegularExpression.cpp
+++ lldb/source/Utility/RegularExpression.cpp
@@ -12,28 +12,26 @@
 
 using namespace lldb_private;
 
-RegularExpression::RegularExpression(llvm::StringRef str) { Compile(str); }
-
-RegularExpression::RegularExpression(const RegularExpression &rhs)
-: RegularExpression() {
-  Compile(rhs.GetText());
-}
-
-bool RegularExpression::Compile(llvm::StringRef str) {
+RegularExpression::RegularExpression(llvm::StringRef str) {
   m_regex_text = str;
+
+  // m_regex does not reference str anymore after it is constructed.
   m_regex = llvm::Regex(str);
-  return IsValid();
 }
 
+RegularExpression::RegularExpression(const RegularExpression &rhs)
+: RegularExpression(rhs.GetText()) {}
+
 bool RegularExpression::Execute(
 llvm::StringRef str,
 llvm::SmallVectorImpl *matches) const {
+  if (!IsValid())
+return false;
   return m_regex.match(str, matches);
 }
 
 bool RegularExpression::IsValid() const {
-  std::string discarded;
-  return m_regex.isValid(discarded);
+  return m_regex.isValid();
 }
 
 llvm::StringRef RegularExpression::GetText() const { return m_regex_text; }
Index: lldb/source/Target/ThreadPlanStepInRange.cpp
===
--- lldb/source/Target/ThreadPlanStepInRange.cpp
+++ lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -315,8 +315,8 @@
   auto name_ref = llvm::StringRef::withNullAsEmpty(name);
   if (!m_avoid_regexp_up)
 m_avoid_regexp_up.reset(new RegularExpression(name_ref));
-
-  m_avoid_regexp_up->Compile(name_ref);
+  else
+*m_avoid_regexp_up = RegularExpression(name_ref);
 }
 
 void ThreadPlanStepInRange::SetDefaultFlagValue(uint32_t new_value) {
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -332,11 +332,12 @@
 std::string regex_str = "^";
 regex_str += echo_packet;
 regex_str += "$";
-response_regex.Compile(regex_str);
+response_regex = RegularExpression(regex_str);
   } else {
 echo_packet_len =
 ::snprintf(echo_packet, sizeof(echo_packet), "qC");
-response_regex.Compile(llvm::StringRef("^QC[0-9A-Fa-f]+$"));
+response_regex =
+RegularExpression(llvm::StringRef("^QC[0-9A-Fa-f]+$"));
   }
 
   PacketResult echo_packet_result =
Index: lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ lldb/source/Plugins/LanguageRunt

[Lldb-commits] [lldb] r369267 - [lldb][NFC] Stop using GetNumberOfMatches in CompletionRequest test

2019-08-19 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Aug 19 07:52:48 2019
New Revision: 369267

URL: http://llvm.org/viewvc/llvm-project?rev=369267&view=rev
Log:
[lldb][NFC] Stop using GetNumberOfMatches in CompletionRequest test

This function is just a wrapper for GetNumberOfResults and will
be removed soon. This patch just changes all calls to GetNumberOfResults
where possible (which is currently just the unit test).

Modified:
lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Modified: lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/CompletionRequestTest.cpp?rev=369267&r1=369266&r2=369267&view=diff
==
--- lldb/trunk/unittests/Utility/CompletionRequestTest.cpp (original)
+++ lldb/trunk/unittests/Utility/CompletionRequestTest.cpp Mon Aug 19 07:52:48 
2019
@@ -41,20 +41,20 @@ TEST(CompletionRequest, DuplicateFilteri
   CompletionRequest request(command, cursor_pos, result);
   result.GetMatches(matches);
 
-  EXPECT_EQ(0U, request.GetNumberOfMatches());
+  EXPECT_EQ(0U, result.GetNumberOfResults());
 
   // Add foo twice
   request.AddCompletion("foo");
   result.GetMatches(matches);
 
-  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, result.GetNumberOfResults());
   EXPECT_EQ(1U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
 
   request.AddCompletion("foo");
   result.GetMatches(matches);
 
-  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, result.GetNumberOfResults());
   EXPECT_EQ(1U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
 
@@ -62,7 +62,7 @@ TEST(CompletionRequest, DuplicateFilteri
   request.AddCompletion("bar");
   result.GetMatches(matches);
 
-  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, result.GetNumberOfResults());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
@@ -70,7 +70,7 @@ TEST(CompletionRequest, DuplicateFilteri
   request.AddCompletion("bar");
   result.GetMatches(matches);
 
-  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, result.GetNumberOfResults());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
@@ -79,7 +79,7 @@ TEST(CompletionRequest, DuplicateFilteri
   request.AddCompletion("foo");
   result.GetMatches(matches);
 
-  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, result.GetNumberOfResults());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
@@ -88,7 +88,7 @@ TEST(CompletionRequest, DuplicateFilteri
   request.AddCompletion("foobar");
   result.GetMatches(matches);
 
-  EXPECT_EQ(3U, request.GetNumberOfMatches());
+  EXPECT_EQ(3U, result.GetNumberOfResults());
   EXPECT_EQ(3U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
@@ -105,14 +105,14 @@ TEST(CompletionRequest, DuplicateFilteri
   result.GetMatches(matches);
   result.GetDescriptions(descriptions);
 
-  EXPECT_EQ(0U, request.GetNumberOfMatches());
+  EXPECT_EQ(0U, result.GetNumberOfResults());
 
   // Add foo twice with same comment
   request.AddCompletion("foo", "comment");
   result.GetMatches(matches);
   result.GetDescriptions(descriptions);
 
-  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, result.GetNumberOfResults());
   EXPECT_EQ(1U, matches.GetSize());
   EXPECT_EQ(1U, descriptions.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
@@ -122,7 +122,7 @@ TEST(CompletionRequest, DuplicateFilteri
   result.GetMatches(matches);
   result.GetDescriptions(descriptions);
 
-  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, result.GetNumberOfResults());
   EXPECT_EQ(1U, matches.GetSize());
   EXPECT_EQ(1U, descriptions.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
@@ -133,7 +133,7 @@ TEST(CompletionRequest, DuplicateFilteri
   result.GetMatches(matches);
   result.GetDescriptions(descriptions);
 
-  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, result.GetNumberOfResults());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_EQ(2U, descriptions.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
@@ -143,7 +143,7 @@ TEST(CompletionRequest, DuplicateFilteri
   result.GetMatches(matches);
   result.GetDescriptions(descriptions);
 
-  EXPECT_EQ(3U, request.GetNumberOfMatches());
+  EXPECT_EQ(3U, result.GetNumberOfResults());
   EXPECT_EQ(3U, matches.GetSize());
   EXPECT_EQ(3U, descriptions.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
@@ -158,7 +158,7 @@ TEST(CompletionRequest, DuplicateFilteri
   result.GetMatches(matches);
   result.GetDescriptions(descriptions);
 
-  EXPECT_EQ(4U, reques

[Lldb-commits] [PATCH] D66392: 1/2: D66174 `RegularExpression` cleanup

2019-08-19 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

I agree that it is better to have just one way to initialize the regex object. 
This looks good to me modulo the llvm parts. I'd suggest just dropping those, 
or creating a separate patch for that...




Comment at: lldb/include/lldb/Interpreter/OptionValueRegex.h:53-55
-  m_regex.Compile(llvm::StringRef(value));
+  m_regex = RegularExpression(llvm::StringRef(value));
 else
   m_regex = RegularExpression();

The apparent inconsistency here is a pretty good argument against the `Compile` 
method imo.



Comment at: lldb/include/lldb/Utility/RegularExpression.h:34
+  /// \param[in] string
+  /// A NULL terminated C string that represents the regular
+  /// expression to compile.

Null terminated? I hope not..



Comment at: lldb/source/Commands/CommandObjectFrame.cpp:536-537
 llvm::StringRef name_str = entry.ref;
 RegularExpression regex(name_str);
-if (regex.Compile(name_str)) {
   size_t num_matches = 0;

lol



Comment at: 
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp:445
 
   RegularExpression regex;
   llvm::SmallVector matches;

Here I'd just declare a fresh variable in each of the blocks instead of 
continuously recycling this one.



Comment at: lldb/source/Target/ThreadPlanStepInRange.cpp:317-319
 m_avoid_regexp_up.reset(new RegularExpression(name_ref));
-
-  m_avoid_regexp_up->Compile(name_ref);
+  else
+*m_avoid_regexp_up = RegularExpression(name_ref);

maybe swap the then and else blocks around to reduce the amount of negation



Comment at: lldb/source/Utility/RegularExpression.cpp:16-19
   m_regex_text = str;
+
+  // m_regex does not reference str anymore after it is constructed.
   m_regex = llvm::Regex(str);

Initialize this stuff in the member initializer list?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66392



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


[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

From IRC:
In fact the whole patch is a oneliner (+`operator<` for `RegularExpression.h`):

  -  typedef FormattersContainer 
RegexMatchContainer;
  +  typedef FormattersContainer 
RegexMatchContainer;

The rest of the patch is just a mechanical update to make it compile again.
It was my mistake when trying to fix the `TestDataFormatterStdList` regression 
that it looked to me the new `RegularExpression` must be broken (its lifetime). 
 In the end it was not broken.  But along the way I have removed its 
IMO-excessive `Compile()` method as I am trying to push this API change as a 
cleanup in D66392 . If there is disagreement I 
will rework this patch D66398  to use the 
former `RegularExpression` API using `Compile()`.  If there is disagreement 
even with that I can drop it all and just make a new comparison function for 
`lldb::RegularExpressionSP`.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66398



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


[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-19 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

I very much support getting rid of shared pointers, and for this is I am 
inclined to accept this. However, I don't think it was ever really intended to 
use the sorting order of the regex text as a disambiguating criterion for data 
formatters, and I don't think we should make a feature of it now -- it's just 
too weird and I doubt anybody will expect that.

Since it seems that there is a need for disambiguation (libc++ can be 
configured to have any name for the inline namespace, so there's no way to make 
its regex not match the libstdc++ one), I think we should just use the 
registration order to disambiguate. Then we just need to make sure the 
libstdc++ formatter is registered before the libc++ one, which should be both 
easy to achieve and understandable.

Since you've recently touched this code, how hard do you think it would be to 
exchange the std::map in FormattersContainer for a std::vector? Would you be 
willing to give that a try?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66398



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


[Lldb-commits] [PATCH] D66392: 1/2: D66174 `RegularExpression` cleanup

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

Thanks, Jan. This LGTM with Pavel's comments addressed.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66392



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


[Lldb-commits] [lldb] r369272 - [dotest] Add --dwarf-version to override the tested DWARF version.

2019-08-19 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Aug 19 09:04:21 2019
New Revision: 369272

URL: http://llvm.org/viewvc/llvm-project?rev=369272&view=rev
Log:
[dotest] Add --dwarf-version to override the tested DWARF version.

On the matrix bot on GreenDragon [1] we want to run the test suite
against different DWARF versions. The idea here is not to replace
targeted tests for certain DWARF features, but rather to provide an easy
way to support this configuration.

[1] http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/

Differential revision: https://reviews.llvm.org/D66370

Modified:
lldb/trunk/packages/Python/lldbsuite/test/configuration.py
lldb/trunk/packages/Python/lldbsuite/test/decorators.py
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=369272&r1=369271&r2=369272&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Mon Aug 19 
09:04:21 2019
@@ -43,6 +43,9 @@ count = 1
 arch = None# Must be initialized after option parsing
 compiler = None# Must be initialized after option parsing
 
+# The overriden dwarf verison.
+dwarf_version = 0
+
 # Path to the FileCheck testing tool. Not optional.
 filecheck = None
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=369272&r1=369271&r2=369272&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Mon Aug 19 09:04:21 
2019
@@ -194,11 +194,9 @@ def _decorateTest(mode,
 macos_version[0],
 macos_version[1],
 platform.mac_ver()[0])))
-skip_for_dwarf_version = (
- dwarf_version is None) or (
- (self.getDebugInfo() is 'dwarf') and
- _check_expected_version(
- dwarf_version[0], dwarf_version[1], 
self.getDwarfVersion()))
+skip_for_dwarf_version = (dwarf_version is None) or (
+_check_expected_version(dwarf_version[0], dwarf_version[1],
+self.getDwarfVersion()))
 
 # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
 # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=369272&r1=369271&r2=369272&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Aug 19 09:04:21 2019
@@ -342,9 +342,15 @@ def parseOptionsAndInitTestdirs():
 configuration.skipCategories += test_categories.validate(
 args.skipCategories, False)
 
+cflags_extras = ""
 if args.E:
-cflags_extras = args.E
-os.environ['CFLAGS_EXTRAS'] = cflags_extras
+cflags_extras += args.E
+
+if args.dwarf_version:
+configuration.dwarf_version = args.dwarf_version
+cflags_extras += '-gdwarf-{}'.format(args.dwarf_version)
+
+os.environ['CFLAGS_EXTRAS'] = cflags_extras
 
 if args.d:
 sys.stdout.write(

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py?rev=369272&r1=369271&r2=369272&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py Mon Aug 19 
09:04:21 2019
@@ -126,6 +126,12 @@ def create_parser():
 action='store_true',
 help='A flag to indicate an out-of-tree debug server is being used')
 group.add_argument(
+'--dwarf-version',
+metavar='dwarf_version',
+dest='dwarf_version',
+type=int,
+help='Override the DWARF version.')
+group.add_argument(
 '-s',
 metavar='name',
 help='Specify the name of the dir created to store the session files 
of tests with errored or failed status. If not specified, the test driver uses 
the timestamp as the session dir name')

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.o

[Lldb-commits] [PATCH] D66370: [dotest] Add a dotest flag `--force-dwarf` to override the tested DWARF version.

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369272: [dotest] Add --dwarf-version to override the tested 
DWARF version. (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66370?vs=215702&id=215920#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66370

Files:
  lldb/trunk/packages/Python/lldbsuite/test/configuration.py
  lldb/trunk/packages/Python/lldbsuite/test/decorators.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py
@@ -43,6 +43,9 @@
 arch = None# Must be initialized after option parsing
 compiler = None# Must be initialized after option parsing
 
+# The overriden dwarf verison.
+dwarf_version = 0
+
 # Path to the FileCheck testing tool. Not optional.
 filecheck = None
 
Index: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py
@@ -194,11 +194,9 @@
 macos_version[0],
 macos_version[1],
 platform.mac_ver()[0])))
-skip_for_dwarf_version = (
- dwarf_version is None) or (
- (self.getDebugInfo() is 'dwarf') and
- _check_expected_version(
- dwarf_version[0], dwarf_version[1], 
self.getDwarfVersion()))
+skip_for_dwarf_version = (dwarf_version is None) or (
+_check_expected_version(dwarf_version[0], dwarf_version[1],
+self.getDwarfVersion()))
 
 # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
 # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -342,9 +342,15 @@
 configuration.skipCategories += test_categories.validate(
 args.skipCategories, False)
 
+cflags_extras = ""
 if args.E:
-cflags_extras = args.E
-os.environ['CFLAGS_EXTRAS'] = cflags_extras
+cflags_extras += args.E
+
+if args.dwarf_version:
+configuration.dwarf_version = args.dwarf_version
+cflags_extras += '-gdwarf-{}'.format(args.dwarf_version)
+
+os.environ['CFLAGS_EXTRAS'] = cflags_extras
 
 if args.d:
 sys.stdout.write(
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
@@ -126,6 +126,12 @@
 action='store_true',
 help='A flag to indicate an out-of-tree debug server is being used')
 group.add_argument(
+'--dwarf-version',
+metavar='dwarf_version',
+dest='dwarf_version',
+type=int,
+help='Override the DWARF version.')
+group.add_argument(
 '-s',
 metavar='name',
 help='Specify the name of the dir created to store the session files 
of tests with errored or failed status. If not specified, the test driver uses 
the timestamp as the session dir name')
Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -1290,6 +1290,8 @@
 
 def getDwarfVersion(self):
 """ Returns the dwarf version generated by clang or '0'. """
+if configuration.dwarf_version:
+return str(configuration.dwarf_version)
 if 'clang' in self.getCompiler():
 try:
 driver_output = check_output(


Index: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py
@@ -43,6 +43,9 @@
 arch = None# Must be initialized after option parsing
 compiler = None# Must be initialized after option parsing
 
+# The overriden dwarf verison.
+dwarf_version = 0
+

[Lldb-commits] [PATCH] D66345: [lldb][NFC] Allow for-range iterating over StringList

2019-08-19 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

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

https://reviews.llvm.org/D66345



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


[Lldb-commits] [PATCH] D66429: [CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: LLDB.
Herald added subscribers: teemperor, mgorny.
Herald added a project: LLDB.

Given that `LLDB_TEST_USE_CUSTOM_C_COMPILER` and `LLDB_TEST_C_COMPILER` are 
both set at configuration time, I don't really see the point of having them 
both. This patch simplifies things and uses the custom C/C++ compiler when the 
variable is set, and uses the default one when it's not set, or explicitly set 
to the empty string (so that you can choose to switch back to using the default 
compiler).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66429

Files:
  lldb/CMakeLists.txt
  lldb/docs/resources/build.rst
  lldb/docs/resources/test.rst


Index: lldb/docs/resources/test.rst
===
--- lldb/docs/resources/test.rst
+++ lldb/docs/resources/test.rst
@@ -30,9 +30,7 @@
 By default, the ``check-lldb`` target builds the test programs with the same
 compiler that was used to build LLDB. To build the tests with a different
 compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
-``LLDB_TEST_CXX_COMPILER`` CMake variables. These variables are ignored unless
-the respective ``LLDB_TEST_USE_CUSTOM_C_COMPILER`` and
-``LLDB_TEST_USE_CUSTOM_CXX_COMPILER`` are set to ``ON``.
+``LLDB_TEST_CXX_COMPILER`` CMake variables.
 
 It is possible to customize the architecture of the test binaries and compiler
 used by appending ``-A`` and ``-C`` options respectively to the CMake variable
Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -185,8 +185,6 @@
 ::
 
   > cmake -G Ninja \
-  -DLLDB_TEST_USE_CUSTOM_C_COMPILER=On \
-  -DLLDB_TEST_USE_CUSTOM_CXX_COMPILER=On \
   -DLLDB_TEST_C_COMPILER= \
   -DLLDB_TEST_CXX_COMPILER= \
   
@@ -228,7 +226,6 @@
   > cmake -G Ninja^
   -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
   -DPYTHON_HOME=C:\Python35^
-  -DLLDB_TEST_USE_CUSTOM_C_COMPILER=ON^
   -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -70,8 +70,6 @@
 add_subdirectory(docs)
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})
-option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via 
LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built 
compiler). Defaults to OFF." OFF)
-option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via 
LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built 
compiler). Defaults to OFF." OFF)
 if(LLDB_INCLUDE_TESTS)
 
   # Set the path to the default lldb test executable.
@@ -81,27 +79,33 @@
   set(LLDB_DEFAULT_TEST_DSYMUTIL 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
   set(LLDB_DEFAULT_TEST_FILECHECK 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 
-  if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang)
+  if (TARGET clang)
 set(LLDB_DEFAULT_TEST_C_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
+set(LLDB_DEFAULT_TEST_CXX_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
   else()
 set(LLDB_DEFAULT_TEST_C_COMPILER "")
+set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
   endif()
 
-  if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILER AND TARGET clang)
-set(LLDB_DEFAULT_TEST_CXX_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
-  else()
-set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
+  # Use the default C compiler if LLDB_TEST_C_COMPILER is explicitly unset.
+  if (LLDB_TEST_C_COMPILER STREQUAL "")
+set(LLDB_TEST_C_COMPILER_force FORCE)
+  endif()
+
+  # Use the default C++ compiler if LLDB_TEST_CXX_COMPILER is explicitly unset.
+  if (LLDB_TEST_CXX_COMPILER STREQUAL "")
+set(LLDB_TEST_CXX_COMPILER_force FORCE)
   endif()
 
   set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb 
executable used for testing")
-  set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors")
-  set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH 
"C++ Compiler to use for building LLDB test inferiors")
+  set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C 
Compiler to use for building LLDB test inferiors" ${LLDB_TEST_C_COMPILER_force})
+  set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH 
"C++ Compiler to use for building LLDB test inferiors" 
${LLDB_TEST_CXX_COMPILER_force})
   set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil 
used for generating dSYM bundles")
   set(LLDB_TE

[Lldb-commits] [lldb] r369293 - [lldb] Make TestIOHandlerCompletion more stable and document it

2019-08-19 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Mon Aug 19 12:13:26 2019
New Revision: 369293

URL: http://llvm.org/viewvc/llvm-project?rev=369293&view=rev
Log:
[lldb] Make TestIOHandlerCompletion more stable and document it

Instead of relying that three tabs show all completions, we should
show all remaining completions which will always stop the mode
where we show completions. Should fix this test on systems that
somehow have more completions that our normal LLDB (as they
would end up being stuck in the mode where we show completions).

Modified:

lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py?rev=369293&r1=369292&r2=369293&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/iohandler/completion/TestIOHandlerCompletion.py
 Mon Aug 19 12:13:26 2019
@@ -39,13 +39,16 @@ class IOHandlerCompletionTest(TestBase):
 (lldbtest_config.lldbExec, self.lldbOption, "", exe))
 
 self.expect_string(prompt)
-self.child.send("\t\t\t")
+# Start tab completion, go to the next page and then display all with 
'a'.
+self.child.send("\t\ta")
 self.expect_string("register")
 
+# Try tab completing regi to register.
 self.child.send("regi\t")
 self.expect_string(prompt + "register")
 self.child.send("\n")
 
+# Start tab completion and abort showing more commands with 'n'.
 self.child.send("\t")
 self.expect_string("More (Y/n/a)")
 self.child.send("n")


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


[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context

2019-08-19 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade updated this revision to Diff 215966.
guiandrade added a comment.
Herald added a subscriber: mgorny.

I tried to write a unit test following @labath's suggestion of creating a test 
class that inherits from `DWARFASTParserClang`. Please let me know what you 
guys think.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66357

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp


Index: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -0,0 +1,47 @@
+//===-- DWARFASTParserClangTests.cpp *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+class DWARFASTParserClangTests : public testing::Test {};
+
+class DWARFASTParserClangStub : public DWARFASTParserClang {
+public:
+  using DWARFASTParserClang::DWARFASTParserClang;
+  using DWARFASTParserClang::LinkDeclContextToDIE;
+};
+} // namespace
+
+TEST_F(DWARFASTParserClangTests,
+   TestGetDIEForDeclContextReturnsOnlyMatchingEntries) {
+  ClangASTContext ast_ctx;
+  DWARFASTParserClangStub ast_parser(ast_ctx);
+
+  auto unit = (DWARFUnit *)nullptr;
+  auto die1 = DWARFDIE(unit, (DWARFDebugInfoEntry *)1LL);
+  auto die2 = DWARFDIE(unit, (DWARFDebugInfoEntry *)2LL);
+  auto die3 = DWARFDIE(unit, (DWARFDebugInfoEntry *)3LL);
+  auto die4 = DWARFDIE(unit, (DWARFDebugInfoEntry *)4LL);
+  ast_parser.LinkDeclContextToDIE((clang::DeclContext *)1LL, die1);
+  ast_parser.LinkDeclContextToDIE((clang::DeclContext *)2LL, die2);
+  ast_parser.LinkDeclContextToDIE((clang::DeclContext *)2LL, die3);
+  ast_parser.LinkDeclContextToDIE((clang::DeclContext *)3LL, die4);
+
+  auto die_list = ast_parser.GetDIEForDeclContext(
+  CompilerDeclContext(nullptr, (clang::DeclContext *)2LL));
+  EXPECT_EQ(2u, die_list.size());
+  EXPECT_EQ(die2, die_list[0]);
+  EXPECT_EQ(die3, die_list[1]);
+}
Index: lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
===
--- lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(SymbolFileDWARFTests
+  DWARFASTParserClangTests.cpp
   SymbolFileDWARFTests.cpp
 
   LINK_LIBS
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2183,9 +2183,10 @@
 std::vector DWARFASTParserClang::GetDIEForDeclContext(
 lldb_private::CompilerDeclContext decl_context) {
   std::vector result;
-  for (auto it = m_decl_ctx_to_die.find(
-   (clang::DeclContext *)decl_context.GetOpaqueDeclContext());
-   it != m_decl_ctx_to_die.end(); it++)
+  auto opaque_decl_ctx =
+  (clang::DeclContext *)decl_context.GetOpaqueDeclContext();
+  for (auto it = m_decl_ctx_to_die.find(opaque_decl_ctx);
+   it != m_decl_ctx_to_die.end() && it->first == opaque_decl_ctx; it++)
 result.push_back(it->second);
   return result;
 }


Index: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -0,0 +1,47 @@
+//===-- DWARFASTParserClangTests.cpp *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+class DWARFASTParserClangTests : public testing::Test {};
+
+class DWARFASTParserClangStub : public DWARFASTParserClang {
+public:
+  using DWARFASTParserClang::DWARFASTParserClang;
+  using DWARFASTParserClang::LinkDeclContextToDIE;
+};
+} // namespace
+
+TEST_F(DWARFASTParserClangTests,
+   TestGetDIEForDeclContextR

[Lldb-commits] [lldb] r369296 - [lldb-vscode] add `launchCommands` to handle launch specific commands

2019-08-19 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Mon Aug 19 13:17:27 2019
New Revision: 369296

URL: http://llvm.org/viewvc/llvm-project?rev=369296&view=rev
Log:
[lldb-vscode] add `launchCommands` to handle launch specific commands

Summary:
This can help `lldb-vscode` handle launch commands associate with remote 
platform
attach request have field `attachCommands` to handle attach specific commands
add a corresponding one for launch request
if no launch command is provided, create a new target and launch; otherwise, 
execute the launch command

Differential Revision: https://reviews.llvm.org/D65363

Patch by Wanyi Ye 

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py?rev=369296&r1=369295&r2=369296&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
 Mon Aug 19 13:17:27 2019
@@ -341,3 +341,68 @@ class TestVSCode_launch(lldbvscode_testc
 # "exitCommands" that were run after the second breakpoint was hit
 output = self.get_console(timeout=1.0)
 self.verify_commands('exitCommands', output, exitCommands)
+
+@skipIfWindows
+@skipIfDarwin # Skip this test for now until we can figure out why tings 
aren't working on build bots
+@no_debug_info_test
+def test_extra_launch_commands(self):
+'''
+Tests the "luanchCommands" with extra launching settings
+'''
+self.build_and_create_debug_adaptor()
+program = self.getBuildArtifact("a.out")
+
+source = 'main.c'
+first_line = line_number(source, '// breakpoint 1')
+second_line = line_number(source, '// breakpoint 2')
+# Set target binary and 2 breakoints
+# then we can varify the "launchCommands" get run
+# also we can verify that "stopCommands" get run as the
+# breakpoints get hit
+launchCommands = [
+'target create "%s"' % (program),
+'br s -f main.c -l %d' % first_line,
+'br s -f main.c -l %d' % second_line,
+'run'
+]
+
+initCommands = ['target list', 'platform list']
+preRunCommands = ['image list a.out', 'image dump sections a.out']
+stopCommands = ['frame variable', 'bt']
+exitCommands = ['expr 2+3', 'expr 3+4']
+self.launch(program,
+initCommands=initCommands,
+preRunCommands=preRunCommands,
+stopCommands=stopCommands,
+exitCommands=exitCommands,
+launchCommands=launchCommands)
+
+# Get output from the console. This should contain both the
+# "initCommands" and the "preRunCommands".
+output = self.get_console()
+# Verify all "initCommands" were found in console output
+self.verify_commands('initCommands', output, initCommands)
+# Verify all "preRunCommands" were found in console output
+self.verify_commands('preRunCommands', output, preRunCommands)
+
+# Verify all "launchCommands" were founc in console output
+# After execution, program should launch
+self.verify_commands('launchCommands', output, launchCommands)
+# Verify the "stopCommands" here
+self.continue_to_next_stop()
+output = self.get_console(timeout=1.0)
+self.verify_commands('stopCommands', output, stopCommands)
+
+# Continue and hit the second breakpoint.
+# Get output from the console. This should contain both the
+# "stopCommands" that were run after the first breakpoint was hit
+self.continue_to_next_stop()
+output = self.get_console(timeout=1.0)
+self.verify_commands('stopCommands', output, stopCommands)
+
+# Continue until the program exits
+self.continue_to_exit()
+# Get output from the console. This should contain both the
+# "exitCommands" that were run after the second breakpoint was hit
+output = self.get_console(timeout=1.0)
+self.verify_commands('exitCommands', output, exitCommands)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py?rev=369296&r1=369295&r2=369296&view=diff
=

[Lldb-commits] [PATCH] D65363: [lldb-vscode] add `launchCommands` to handle launch specific commands

2019-08-19 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369296: [lldb-vscode] add `launchCommands` to handle launch 
specific commands (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65363?vs=212683&id=215971#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65363

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -245,20 +245,17 @@
 self.assertTrue(response['success'],
 'attach failed (%s)' % (response['message']))
 
-def build_and_launch(self, program, args=None, cwd=None, env=None,
- stopOnEntry=False, disableASLR=True,
- disableSTDIO=False, shellExpandArguments=False,
- trace=False, initCommands=None, preRunCommands=None,
- stopCommands=None, exitCommands=None,
- sourcePath=None, debuggerRoot=None):
-'''Build the default Makefile target, create the VSCode debug adaptor,
-   and launch the process.
+def launch(self, program=None, args=None, cwd=None, env=None,
+   stopOnEntry=False, disableASLR=True,
+   disableSTDIO=False, shellExpandArguments=False,
+   trace=False, initCommands=None, preRunCommands=None,
+   stopCommands=None, exitCommands=None,sourcePath= None,
+   debuggerRoot=None, launchCommands=None):
+'''Sending launch request to vscode
 '''
-self.build_and_create_debug_adaptor()
-self.assertTrue(os.path.exists(program), 'executable must exist')
 
-# Make sure we disconnect and terminate the VSCode debug adaptor even
-# if we throw an exception during the test case.
+# Make sure we disconnet and terminate the VSCode debug adaptor,
+# if we throw an exception during the test case
 def cleanup():
 self.vscode.request_disconnect(terminateDebuggee=True)
 self.vscode.terminate()
@@ -283,7 +280,25 @@
 stopCommands=stopCommands,
 exitCommands=exitCommands,
 sourcePath=sourcePath,
-debuggerRoot=debuggerRoot)
+debuggerRoot=debuggerRoot,
+launchCommands=launchCommands)
 if not (response and response['success']):
 self.assertTrue(response['success'],
 'launch failed (%s)' % (response['message']))
+
+def build_and_launch(self, program, args=None, cwd=None, env=None,
+ stopOnEntry=False, disableASLR=True,
+ disableSTDIO=False, shellExpandArguments=False,
+ trace=False, initCommands=None, preRunCommands=None,
+ stopCommands=None, exitCommands=None,
+ sourcePath=None, debuggerRoot=None):
+'''Build the default Makefile target, create the VSCode debug adaptor,
+   and launch the process.
+'''
+self.build_and_create_debug_adaptor()
+self.assertTrue(os.path.exists(program), 'executable must exist')
+
+self.launch(program, args, cwd, env, stopOnEntry, disableASLR,
+disableSTDIO, shellExpandArguments, trace,
+initCommands, preRunCommands, stopCommands, exitCommands,
+sourcePath, debuggerRoot)
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -558,7 +558,7 @@
disableSTDIO=False, shellExpandArguments=False,
trace=False, initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None, sourcePath=None,
-   debuggerRoot=None):
+   debuggerRoot=None, launchCommands=None):
 args_dict = {
 'program': program
 }
@@ -591,6 +591,8 @@
 args_dict['sourcePath'] = sourcePath
 if debuggerRoot:
 args_dict['debuggerRoot'] = debuggerRoot

[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context

2019-08-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Pavel, any comments on the testing code? LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66357



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


[Lldb-commits] [PATCH] D66442: Fix use-after-free

2019-08-19 Thread Matthias Gehre via Phabricator via lldb-commits
mgehre created this revision.
mgehre added reviewers: jingham, JDevlieghere.
Herald added a project: LLDB.

The warning

  lldb/source/Core/FormatEntity.cpp:2350:25: warning: object backing the 
pointer will be destroyed at the end of the full-expression [-Wdangling]

is emitted after annotating `llvm::StringRef` with `[[gsl::Pointer]]`.

The reason is that in

  size_t FormatEntity::AutoComplete(CompletionRequest &request) {
   llvm::StringRef str = request.GetCursorArgumentPrefix().str();

the function `GetCursorArgumentPrefix()` returns a `StringRef`, and 
`StringRef::str()` returns
a temporary `std::string`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66442

Files:
  lldb/source/Core/FormatEntity.cpp


Index: lldb/source/Core/FormatEntity.cpp
===
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -2347,7 +2347,7 @@
 }
 
 size_t FormatEntity::AutoComplete(CompletionRequest &request) {
-  llvm::StringRef str = request.GetCursorArgumentPrefix().str();
+  llvm::StringRef str = request.GetCursorArgumentPrefix();
 
   request.SetWordComplete(false);
 


Index: lldb/source/Core/FormatEntity.cpp
===
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -2347,7 +2347,7 @@
 }
 
 size_t FormatEntity::AutoComplete(CompletionRequest &request) {
-  llvm::StringRef str = request.GetCursorArgumentPrefix().str();
+  llvm::StringRef str = request.GetCursorArgumentPrefix();
 
   request.SetWordComplete(false);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66442: Fix use-after-free

2019-08-19 Thread Matthias Gehre via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369304: Fix use-after-free (authored by mgehre, committed by 
).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66442?vs=215985&id=215987#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66442

Files:
  lldb/trunk/source/Core/FormatEntity.cpp


Index: lldb/trunk/source/Core/FormatEntity.cpp
===
--- lldb/trunk/source/Core/FormatEntity.cpp
+++ lldb/trunk/source/Core/FormatEntity.cpp
@@ -2347,7 +2347,7 @@
 }
 
 size_t FormatEntity::AutoComplete(CompletionRequest &request) {
-  llvm::StringRef str = request.GetCursorArgumentPrefix().str();
+  llvm::StringRef str = request.GetCursorArgumentPrefix();
 
   request.SetWordComplete(false);
 


Index: lldb/trunk/source/Core/FormatEntity.cpp
===
--- lldb/trunk/source/Core/FormatEntity.cpp
+++ lldb/trunk/source/Core/FormatEntity.cpp
@@ -2347,7 +2347,7 @@
 }
 
 size_t FormatEntity::AutoComplete(CompletionRequest &request) {
-  llvm::StringRef str = request.GetCursorArgumentPrefix().str();
+  llvm::StringRef str = request.GetCursorArgumentPrefix();
 
   request.SetWordComplete(false);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66445: Explicitly Cast Constants to DWORD

2019-08-19 Thread Jason Mittertreiner via Phabricator via lldb-commits
jmittert created this revision.
jmittert added reviewers: xiaobai, labath, JDevlieghere, asmith.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

STATUS_SINGLE_STEP and STATUS_BREAKPOINT are defined as 0x8-- which
is negative and thus can't be implicitly narrowed to a DWORD which is
unsigned.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66445

Files:
  source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp


Index: source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
===
--- source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
+++ source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
@@ -430,7 +430,7 @@
 
   ExceptionResult result = ExceptionResult::SendToApplication;
   switch (record.GetExceptionCode()) {
-  case STATUS_SINGLE_STEP:
+  case DWORD(STATUS_SINGLE_STEP):
   case STATUS_WX86_SINGLE_STEP:
 StopThread(record.GetThreadID(), StopReason::eStopReasonTrace);
 SetState(eStateStopped, true);
@@ -438,7 +438,7 @@
 // Continue the debugger.
 return ExceptionResult::MaskException;
 
-  case STATUS_BREAKPOINT:
+  case DWORD(STATUS_BREAKPOINT):
   case STATUS_WX86_BREAKPOINT:
 if (FindSoftwareBreakpoint(record.GetExceptionAddress())) {
   LLDB_LOG(log, "Hit non-loader breakpoint at address {0:x}.",


Index: source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
===
--- source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
+++ source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
@@ -430,7 +430,7 @@
 
   ExceptionResult result = ExceptionResult::SendToApplication;
   switch (record.GetExceptionCode()) {
-  case STATUS_SINGLE_STEP:
+  case DWORD(STATUS_SINGLE_STEP):
   case STATUS_WX86_SINGLE_STEP:
 StopThread(record.GetThreadID(), StopReason::eStopReasonTrace);
 SetState(eStateStopped, true);
@@ -438,7 +438,7 @@
 // Continue the debugger.
 return ExceptionResult::MaskException;
 
-  case STATUS_BREAKPOINT:
+  case DWORD(STATUS_BREAKPOINT):
   case STATUS_WX86_BREAKPOINT:
 if (FindSoftwareBreakpoint(record.GetExceptionAddress())) {
   LLDB_LOG(log, "Hit non-loader breakpoint at address {0:x}.",
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: LLDB.
Herald added a subscriber: teemperor.
Herald added a project: LLDB.

This patch adds support for C++20 char8_t, as well as dlang's char/wchar/dchar 
types.

Original patch by James Blachly, modified by me.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66447

Files:
  lldb/include/lldb/lldb-enumerations.h
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/TestCxxChar8_t.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
  lldb/source/Symbol/ClangASTContext.cpp

Index: lldb/source/Symbol/ClangASTContext.cpp
===
--- lldb/source/Symbol/ClangASTContext.cpp
+++ lldb/source/Symbol/ClangASTContext.cpp
@@ -1378,10 +1378,21 @@
 
 case DW_ATE_UTF:
   if (type_name) {
-if (streq(type_name, "char16_t")) {
+if (streq(type_name, "char16_t") ||
+streq(type_name, "wchar") || // dlang
+streq(type_name, "const(wchar)") ||
+streq(type_name, "immutable(wchar)")) {
   return CompilerType(this, ast->Char16Ty.getAsOpaquePtr());
-} else if (streq(type_name, "char32_t")) {
+} else if (streq(type_name, "char32_t") ||
+   streq(type_name, "dchar") || // dlang
+   streq(type_name, "const(dchar") ||
+   streq(type_name, "immutable(dchar)")) {
   return CompilerType(this, ast->Char32Ty.getAsOpaquePtr());
+} else if (streq(type_name, "char8_t") || // C++20
+   streq(type_name, "char") ||// dlang
+   streq(type_name, "const(char)") ||
+   streq(type_name, "immutable(char)")) {
+  return CompilerType(this, ast->Char8Ty.getAsOpaquePtr());
 }
   }
   break;
Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
@@ -16,6 +16,9 @@
 
 namespace lldb_private {
 namespace formatters {
+bool Char8StringSummaryProvider(ValueObject &valobj, Stream &stream,
+const TypeSummaryOptions &options); // char8_t*
+
 bool Char16StringSummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // char16_t* and unichar*
@@ -27,6 +30,9 @@
 bool WCharStringSummaryProvider(ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // wchar_t*
 
+bool Char8SummaryProvider(ValueObject &valobj, Stream &stream,
+  const TypeSummaryOptions &options); // char8_t
+
 bool Char16SummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // char16_t and unichar
Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -32,6 +32,31 @@
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
+bool lldb_private::formatters::Char8StringSummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+return false;
+
+  lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
+  if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
+return false;
+
+  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
+  options.SetLocation(valobj_addr);
+  options.SetProcessSP(process_sp);
+  options.SetStream(&stream);
+  options.SetPrefixToken("u8");
+
+  if (!StringPrinter::ReadStringAndDumpToStream<
+  StringPrinter::StringElementType::UTF8>(options)) {
+stream.Printf("Summary Unavailable");
+return true;
+  }
+
+  return true;
+}
+
 bool lldb_private::formatters::Char16StringSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
   ProcessSP process_sp = valobj.GetProcessSP();
@@ -128,6 +153,32 @@
   return true;
 }
 
+bool lldb_private::formatters::Char8SummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+
+  if (error.Fail())
+return false;
+
+  std::string value;
+  valobj.GetValueAsCString(lldb::eFormatUnicode8, value);
+  if (!value.empty())
+stream.Printf("%s ", value.c_str());
+
+  StringPrinter::ReadBufferAndDumpToStreamOptions opti

[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/TestCxxChar8_t.py:26
+
+@skipIf(compiler="clang", compiler_version=['<', '5.0'])
+def test(self):

This should be 7


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66447



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


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.



Comment at: lldb/include/lldb/lldb-enumerations.h:170
  // etc...
+  eFormatUnicode8,
   eFormatUnicode16,

add to the end, or all LLDBRPC.framework calls that use this enumeration will 
fail for you.



Comment at: lldb/source/Symbol/ClangASTContext.cpp:1383-1384
+streq(type_name, "wchar") || // dlang
+streq(type_name, "const(wchar)") ||
+streq(type_name, "immutable(wchar)")) {
   return CompilerType(this, ast->Char16Ty.getAsOpaquePtr());

are "const(T)" and "immutable(T)" the actualy type names or are they layers on 
top of a base "wchar" type? These shouldn't be needed if so as the base "wchar" 
type should end up handling the base type correctly. Remove?



Comment at: lldb/source/Symbol/ClangASTContext.cpp:1388-1389
+   streq(type_name, "dchar") || // dlang
+   streq(type_name, "const(dchar") ||
+   streq(type_name, "immutable(dchar)")) {
   return CompilerType(this, ast->Char32Ty.getAsOpaquePtr());

ditto



Comment at: lldb/source/Symbol/ClangASTContext.cpp:1393-1394
+   streq(type_name, "char") ||// dlang
+   streq(type_name, "const(char)") ||
+   streq(type_name, "immutable(char)")) {
+  return CompilerType(this, ast->Char8Ty.getAsOpaquePtr());

ditto


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66447



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


[Lldb-commits] [PATCH] D66448: Include "windows" Instead of "Windows"

2019-08-19 Thread Gwen Mittertreiner via Phabricator via lldb-commits
gmittert created this revision.
gmittert added reviewers: xiaobai, JDevlieghere, labath, asmith.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The actual include directory is `lldb/Host/windows` not
`lldb/Host/Windows` which breaks on case sensitive file systems


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66448

Files:
  source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp
  source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
  source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
  source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
  source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp


Index: source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp
===
--- source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp
+++ source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp
@@ -10,7 +10,7 @@
 #include "NativeProcessWindows.h"
 
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/Log.h"
Index: 
source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
===
--- 
source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
+++ 
source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
@@ -16,7 +16,7 @@
 #include "ProcessWindowsLog.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 
 #include "lldb/Utility/Log.h"
Index: 
source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
===
--- source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
+++ source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
@@ -15,7 +15,7 @@
 #include "ProcessWindowsLog.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 
 #include "lldb/Utility/Log.h"
Index: 
source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
===
--- source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
+++ source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
@@ -15,7 +15,7 @@
 #include "ProcessWindowsLog.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 
 #include "lldb/Utility/Log.h"
Index: source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp
===
--- source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp
+++ source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp
@@ -7,7 +7,7 @@
 
//===--===//
 
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/Utility/Log.h"
 


Index: source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp
===
--- source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp
+++ source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp
@@ -10,7 +10,7 @@
 #include "NativeProcessWindows.h"
 
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/Log.h"
Index: source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
===
--- source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
+++ source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
@@ -16,7 +16,7 @@
 #include "ProcessWindowsLog.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 
 #include "lldb/Utility/Log.h"
Index: source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp

[Lldb-commits] [PATCH] D66448: Include "windows" Instead of "Windows"

2019-08-19 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.

Case-sensitive filesystems lol


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66448



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


[Lldb-commits] [lldb] r369307 - Windows: Include "windows" Instead of "Windows"

2019-08-19 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Mon Aug 19 15:45:01 2019
New Revision: 369307

URL: http://llvm.org/viewvc/llvm-project?rev=369307&view=rev
Log:
Windows: Include "windows" Instead of "Windows"

The actual include directory is lldb/Host/windows not
lldb/Host/Windows which breaks on case sensitive file systems

Patch by Gwen Mittertreiner!

Modified:

lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp

lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp

lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp

lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp

Modified: 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp?rev=369307&r1=369306&r2=369307&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp
 Mon Aug 19 15:45:01 2019
@@ -7,7 +7,7 @@
 
//===--===//
 
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/Utility/Log.h"
 

Modified: 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp?rev=369307&r1=369306&r2=369307&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp
 Mon Aug 19 15:45:01 2019
@@ -15,7 +15,7 @@
 #include "ProcessWindowsLog.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 
 #include "lldb/Utility/Log.h"

Modified: 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp?rev=369307&r1=369306&r2=369307&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp
 Mon Aug 19 15:45:01 2019
@@ -15,7 +15,7 @@
 #include "ProcessWindowsLog.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 
 #include "lldb/Utility/Log.h"

Modified: 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp?rev=369307&r1=369306&r2=369307&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
 Mon Aug 19 15:45:01 2019
@@ -16,7 +16,7 @@
 #include "ProcessWindowsLog.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 
 #include "lldb/Utility/Log.h"

Modified: 
lldb/trunk/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp?rev=369307&r1=369306&r2=369307&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp 
Mon Aug 19 15:45:01 2019
@@ -10,7 +10,7 @@
 #include "NativeProcessWindows.h"
 
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Windows/HostThreadWindows.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/Ta

[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 216008.
JDevlieghere added a comment.

- Feedback Greg.
- Remove dlang types.


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

https://reviews.llvm.org/D66447

Files:
  lldb/include/lldb/lldb-enumerations.h
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/TestCxxChar8_t.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
  lldb/source/Symbol/ClangASTContext.cpp

Index: lldb/source/Symbol/ClangASTContext.cpp
===
--- lldb/source/Symbol/ClangASTContext.cpp
+++ lldb/source/Symbol/ClangASTContext.cpp
@@ -1378,11 +1378,12 @@
 
 case DW_ATE_UTF:
   if (type_name) {
-if (streq(type_name, "char16_t")) {
+if (streq(type_name, "char16_t"))
   return CompilerType(this, ast->Char16Ty.getAsOpaquePtr());
-} else if (streq(type_name, "char32_t")) {
+else if (streq(type_name, "char32_t"))
   return CompilerType(this, ast->Char32Ty.getAsOpaquePtr());
-}
+else if (streq(type_name, "char8_t"))
+  return CompilerType(this, ast->Char8Ty.getAsOpaquePtr());
   }
   break;
 }
Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
@@ -16,6 +16,9 @@
 
 namespace lldb_private {
 namespace formatters {
+bool Char8StringSummaryProvider(ValueObject &valobj, Stream &stream,
+const TypeSummaryOptions &options); // char8_t*
+
 bool Char16StringSummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // char16_t* and unichar*
@@ -27,6 +30,9 @@
 bool WCharStringSummaryProvider(ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // wchar_t*
 
+bool Char8SummaryProvider(ValueObject &valobj, Stream &stream,
+  const TypeSummaryOptions &options); // char8_t
+
 bool Char16SummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // char16_t and unichar
Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -32,6 +32,31 @@
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
+bool lldb_private::formatters::Char8StringSummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+return false;
+
+  lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
+  if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
+return false;
+
+  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
+  options.SetLocation(valobj_addr);
+  options.SetProcessSP(process_sp);
+  options.SetStream(&stream);
+  options.SetPrefixToken("u8");
+
+  if (!StringPrinter::ReadStringAndDumpToStream<
+  StringPrinter::StringElementType::UTF8>(options)) {
+stream.Printf("Summary Unavailable");
+return true;
+  }
+
+  return true;
+}
+
 bool lldb_private::formatters::Char16StringSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
   ProcessSP process_sp = valobj.GetProcessSP();
@@ -128,6 +153,32 @@
   return true;
 }
 
+bool lldb_private::formatters::Char8SummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+
+  if (error.Fail())
+return false;
+
+  std::string value;
+  valobj.GetValueAsCString(lldb::eFormatUnicode8, value);
+  if (!value.empty())
+stream.Printf("%s ", value.c_str());
+
+  StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
+  options.SetData(data);
+  options.SetStream(&stream);
+  options.SetPrefixToken("u8");
+  options.SetQuote('\'');
+  options.SetSourceSize(1);
+  options.SetBinaryZeroIsTerminator(false);
+
+  return StringPrinter::ReadBufferAndDumpToStream<
+  StringPrinter::StringElementType::UTF8>(options);
+}
+
 bool lldb_private::formatters::Char16SummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
   DataExtractor data;
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/

[Lldb-commits] [PATCH] D66448: Include "windows" Instead of "Windows"

2019-08-19 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd closed this revision.
compnerd added a comment.

SVN r369307


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66448



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


[Lldb-commits] [PATCH] D66248: [JIT][Command] Add "inject-condition" flag to conditional breakpoints

2019-08-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked 18 inline comments as done.
mib added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py:51
+if cli == True:
+lldbutil.run_break_set_by_source_regexp(
+self, self.comment, self.extra_options

JDevlieghere wrote:
> Did you copy this code style from somewhere? If so it's fine, but otherwise 
> I'd stick to the common style. I think the "great refactor" commit includes 
> the command used to format the tests. I use `yapf` for Python but it doesn't 
> exactly match.
I used Python's Black formatter, because I wasn't aware of the "great refactor" 
command: `find . -iname "*.py" -exec autopep8 --in-place --aggressive 
--aggressive {} + ;` 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66248



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


[Lldb-commits] [PATCH] D66451: [ClangExpressionParser] Add ClangDeclVendor

2019-08-19 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: JDevlieghere, clayborg, jingham, labath.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: LLDB.

This introduces a layer between DeclVendor and the currently implemented
DeclVendors (ClangModulesDeclVendor and AppleObjCDeclVendor). This
allows the removal of DeclVendor::GetImporterSource which is extremely
clang-specific, freeing up the interface to be more general.

A good follow up to this would be to remove the remaining instances of
clang in DeclVendor, either by moving things to ClangDeclVendor or by
using wrappers (e.g. CompilerDecl instead of clang::NamedDecl).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66451

Files:
  lldb/include/lldb/Symbol/DeclVendor.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h

Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
@@ -10,19 +10,23 @@
 #define liblldb_AppleObjCDeclVendor_h_
 
 #include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Symbol/DeclVendor.h"
 #include "lldb/lldb-private.h"
 
+#include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h"
 #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
 
 namespace lldb_private {
 
 class AppleObjCExternalASTSource;
 
-class AppleObjCDeclVendor : public DeclVendor {
+class AppleObjCDeclVendor : public ClangDeclVendor {
 public:
   AppleObjCDeclVendor(ObjCLanguageRuntime &runtime);
 
+  static bool classof(const DeclVendor *vendor) {
+return vendor->GetKind() == eAppleObjCDeclVendor;
+  }
+
   uint32_t FindDecls(ConstString name, bool append, uint32_t max_matches,
  std::vector &decls) override;
 
Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -151,12 +151,13 @@
 };
 
 AppleObjCDeclVendor::AppleObjCDeclVendor(ObjCLanguageRuntime &runtime)
-: DeclVendor(), m_runtime(runtime), m_ast_ctx(runtime.GetProcess()
-  ->GetTarget()
-  .GetArchitecture()
-  .GetTriple()
-  .getTriple()
-  .c_str()),
+: ClangDeclVendor(eAppleObjCDeclVendor), m_runtime(runtime),
+  m_ast_ctx(runtime.GetProcess()
+->GetTarget()
+.GetArchitecture()
+.GetTriple()
+.getTriple()
+.c_str()),
   m_type_realizer_sp(m_runtime.GetEncodingToType()) {
   m_external_source = new AppleObjCExternalASTSource(*this);
   llvm::IntrusiveRefCntPtr external_source_owning_ptr(
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
@@ -10,22 +10,27 @@
 #define liblldb_ClangModulesDeclVendor_h
 
 #include "lldb/Core/ClangForward.h"
-#include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Symbol/SourceModule.h"
 #include "lldb/Target/Platform.h"
 
+#include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h"
+
 #include 
 #include 
 
 namespace lldb_private {
 
-class ClangModulesDeclVendor : public DeclVendor {
+class ClangModulesDeclVendor : public ClangDeclVendor {
 public:
   // Constructors and Destructors
   ClangModulesDeclVendor();
 
   ~ClangModulesDeclVendor() override;
 
+  static bool classof(const DeclVendor *vendor) {
+return vendor->GetKind() == eClangModuleDeclVendor;
+  }
+
   static ClangModulesDeclVendor *Create(Target &target);
 
   typedef std::vector ModulePath;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -147,7 

[Lldb-commits] [PATCH] D66248: [JIT][Command] Add "inject-condition" flag to conditional breakpoints

2019-08-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 216014.
mib marked an inline comment as done.
mib added a comment.

Moved NFC changes to separate patch.

Updated test to suit LLVM's style.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66248

Files:
  lldb/include/lldb/API/SBBreakpoint.h
  lldb/include/lldb/API/SBBreakpointLocation.h
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/include/lldb/Target/Target.h
  lldb/include/lldb/lldb-enumerations.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/main.c
  lldb/scripts/interface/SBBreakpoint.i
  lldb/scripts/interface/SBBreakpointLocation.i
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointLocation.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointOptions.cpp
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/Options.td

Index: lldb/source/Commands/Options.td
===
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -87,6 +87,9 @@
 Arg<"Command">,
 Desc<"A command to run when the breakpoint is hit, can be provided more "
 "than once, the commands will get run in order left to right.">;
+  def breakpoint_modify_inject_condition : Option<"inject-condition", "I">,
+  Desc<"The breakpoint injects the condition expression into the process "
+  "machine code. Enables Fast Conditional Breakpoints.">;
 }
 
 let Command = "breakpoint dummy" in {
Index: lldb/source/Commands/CommandObjectBreakpoint.cpp
===
--- lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -102,6 +102,13 @@
 m_bp_opts.SetIgnoreCount(ignore_count);
 }
 break;
+case 'I': {
+  if (!m_bp_opts.IsOptionSet(BreakpointOptions::eCondition))
+error.SetErrorString("inject-condition option only available for "
+ "conditional breakpoints");
+  else
+m_bp_opts.SetInjectCondition(true);
+} break;
 case 'o': {
   bool value, success;
   value = OptionArgParser::ToBoolean(option_arg, false, &success);
Index: lldb/source/Breakpoint/BreakpointOptions.cpp
===
--- lldb/source/Breakpoint/BreakpointOptions.cpp
+++ lldb/source/Breakpoint/BreakpointOptions.cpp
@@ -109,8 +109,8 @@
 
 const char *BreakpointOptions::g_option_names[(
 size_t)BreakpointOptions::OptionNames::LastOptionName]{
-"ConditionText", "IgnoreCount", 
-"EnabledState", "OneShotState", "AutoContinue"};
+"ConditionText", "IgnoreCount",  "EnabledState",
+"OneShotState",  "AutoContinue", "JITCondition"};
 
 bool BreakpointOptions::NullCallback(void *baton,
  StoppointCallbackContext *context,
@@ -124,25 +124,23 @@
 : m_callback(BreakpointOptions::NullCallback), m_callback_baton_sp(),
   m_baton_is_command_baton(false), m_callback_is_synchronous(false),
   m_enabled(true), m_one_shot(false), m_ignore_count(0), m_thread_spec_up(),
-  m_condition_text(), m_condition_text_hash(0), m_auto_continue(false),
-  m_set_flags(0) {
+  m_condition_text(), m_condition_text_hash(0), m_inject_condition(false),
+  m_auto_continue(false), m_set_flags(0) {
   if (all_flags_set)
 m_set_flags.Set(~((Flags::ValueType)0));
 }
 
 BreakpointOptions::BreakpointOptions(const char *condition, bool enabled,
- int32_t ignore, bool one_shot, 
- bool auto_continue)
+ int32_t ignore, bool one_shot,
+ bool auto_continue, bool inject_condition)
 : m_callback(nullptr), m_baton_is_command_baton(false),
   m_callback_is_synchronous(false), m_enabled(enabled),
-  m_one_shot(one_shot), m_ignore_count(ignore),
-  m_condition_text_hash(0), m_auto_continue(auto_continue)
-{
-m_set_flags.Set(eEnabled | eIgnoreCount | eOneShot 
-   | eAutoContinue);
-if (condition && *condition != '\0') {
-  SetCondition(condition);
-}
+  m_one_shot(one_shot), m_ignore_count(ignore), m_condition_text_hash(0),
+  m_inject_condition(inject_condition), m_auto_continue(auto_continue) {
+  m_set_flags.Set(eEnabled | eIgnoreCount | eOneShot | eAutoContinue);
+  if (condition && *condition != '\0') {
+SetConditi

[Lldb-commits] [PATCH] D66452: [lldb] Fix typo on the BreakpointLocation header and the lldbtest.py (NFC)

2019-08-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This commit fixes some typo I found while exploring LLDB's codebase.

Signed-off-by: Med Ismail Bennani 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66452

Files:
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/packages/Python/lldbsuite/test/lldbtest.py

Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -113,11 +113,11 @@
 
 BREAKPOINT_PENDING_CREATED = "Pending breakpoint created successfully"
 
-BREAKPOINT_HIT_ONCE = "Breakpoint resolved with hit cout = 1"
+BREAKPOINT_HIT_ONCE = "Breakpoint resolved with hit count = 1"
 
-BREAKPOINT_HIT_TWICE = "Breakpoint resolved with hit cout = 2"
+BREAKPOINT_HIT_TWICE = "Breakpoint resolved with hit count = 2"
 
-BREAKPOINT_HIT_THRICE = "Breakpoint resolved with hit cout = 3"
+BREAKPOINT_HIT_THRICE = "Breakpoint resolved with hit count = 3"
 
 MISSING_EXPECTED_REGISTERS = "At least one expected register is unavailable."
 
@@ -140,6 +140,8 @@
 
 STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT = "Stopped due to breakpoint and ignore count"
 
+STOPPED_DUE_TO_BREAKPOINT_JITTED_CONDITION = "Stopped due to breakpoint jitted condition"
+
 STOPPED_DUE_TO_SIGNAL = "Process state is stopped due to signal"
 
 STOPPED_DUE_TO_STEP_IN = "Process state is stopped due to step in"
Index: lldb/include/lldb/Breakpoint/BreakpointOptions.h
===
--- lldb/include/lldb/Breakpoint/BreakpointOptions.h
+++ lldb/include/lldb/Breakpoint/BreakpointOptions.h
@@ -107,6 +107,12 @@
   /// \param[in] ignore
   ///How many breakpoint hits we should ignore before stopping.
   ///
+  /// \param[in] one_shot
+  ///Should this breakpoint delete itself after being hit once.
+  ///
+  /// \param[in] auto_continue
+  ///Should this breakpoint auto-continue after running its commands.
+  ///
   BreakpointOptions(const char *condition, bool enabled = true,
 int32_t ignore = 0, bool one_shot = false,
 bool auto_continue = false);
@@ -319,7 +325,10 @@
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
 
-  /// Returns true if the breakpoint option has a callback set.
+  /// Check if the breakpoint option has a callback set.
+  ///
+  /// \return
+  ///If the breakpoint option has a callback, \b true otherwise \b false.
   bool HasCallback() const;
 
   /// This is the default empty callback.
@@ -367,22 +376,32 @@
   void SetThreadSpec(std::unique_ptr &thread_spec_up);
 
 private:
-  // For BreakpointOptions only
-  BreakpointHitCallback m_callback;  // This is the callback function pointer
-  lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
+  /// For BreakpointOptions only
+  
+  /// This is the callback function pointer
+  BreakpointHitCallback m_callback;
+  /// This is the client data for the callback
+  lldb::BatonSP m_callback_baton_sp;
   bool m_baton_is_command_baton;
   bool m_callback_is_synchronous;
   bool m_enabled;
+  /// If set, the breakpoint delete itself after being hit once.
   bool m_one_shot;
-  uint32_t m_ignore_count; // Number of times to ignore this breakpoint
-  std::unique_ptr
-  m_thread_spec_up; // Thread for which this breakpoint will take
-  std::string m_condition_text; // The condition to test.
-  size_t m_condition_text_hash; // Its hash, so that locations know when the
-// condition is updated.
-  bool m_auto_continue; // If set, auto-continue from breakpoint.
-  Flags m_set_flags;// Which options are set at this level.  Drawn
-// from BreakpointOptions::SetOptionsFlags.
+  /// Number of times to ignore this breakpoint.
+  uint32_t m_ignore_count;
+  /// Thread for which this breakpoint will stop.
+  std::unique_ptr m_thread_spec_up;
+  /// The condition to test.
+  std::string m_condition_text;
+  /// Its hash, so that locations know when the condition is updated.
+  size_t m_condition_text_hash;
+  /// If set, inject breakpoint condition into process.
+  bool m_inject_condition;
+  /// If set, auto-continue from breakpoint.
+  bool m_auto_continue;
+  /// Which options are set at this level.
+  /// Drawn from BreakpointOptions::SetOptionsFlags.
+  Flags m_set_flags;
 };
 
 } // namespace lldb_private
Index: lldb/include/lldb/Breakpoint/BreakpointLocation.h
===
--- lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -67,7 +67,7 @@
 
   // The next section deals with various breakpoint options.
 
-  /// If \a enable is \b true, enable the breakpoint, i

[Lldb-commits] [PATCH] D66452: [lldb] Fix typo on the BreakpointLocation header and the lldbtest.py (NFC)

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Thanks, Ismail. LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66452



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


[Lldb-commits] [PATCH] D66451: [ClangExpressionParser] Add ClangDeclVendor

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Symbol/DeclVendor.h:27
+eAppleObjCDeclVendor,
+eLastClangDeclVendor,
+  };

What's `eLastClangDeclVendor` and where is it used?



Comment at: lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h:33
+  static bool classof(const DeclVendor *vendor) {
+return vendor->GetKind() >= eClangDeclVendor &&
+   vendor->GetKind() < eLastClangDeclVendor;

I think a switch would be more readable? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66451



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


[Lldb-commits] [PATCH] D66451: [ClangExpressionParser] Add ClangDeclVendor

2019-08-19 Thread Alex Langford via Phabricator via lldb-commits
xiaobai marked an inline comment as done.
xiaobai added inline comments.



Comment at: lldb/include/lldb/Symbol/DeclVendor.h:27
+eAppleObjCDeclVendor,
+eLastClangDeclVendor,
+  };

JDevlieghere wrote:
> What's `eLastClangDeclVendor` and where is it used?
Following the advice here: https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html

I added a Last one to indicate that any new ClangDeclVendor subclasses should 
go before this one. It also makes the classof pattern of checking bounds 
easier. (kind >= eFoo && kind < eLastFoo).




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66451



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


[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: jasonmolenda, JDevlieghere, labath, clayborg.

I'm planning to modify this API shortly and thought best to first make it 
independently testable.

This adds a -compiler-context=<...> option to lldb-test that translates a 
JSON-formatted string that is a list of kind/name pairs and translates it into 
a std::vector, a CompilerContext being a pair of context-kind 
and name.


https://reviews.llvm.org/D66453

Files:
  lldb/lit/SymbolFile/DWARF/compilercontext.ll
  lldb/lit/SymbolFile/DWARF/compilercontext.test
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -30,6 +30,7 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/CleanUp.h"
 #include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/JSON.h"
 #include "lldb/Utility/State.h"
 #include "lldb/Utility/StreamString.h"
 
@@ -139,6 +140,11 @@
 cl::desc("Restrict search to the context of the given variable."),
 cl::value_desc("variable"), cl::sub(SymbolsSubcommand));
 
+static cl::opt CompilerContext(
+"compiler-context",
+cl::desc("Specify a compiler context as \"[(type,name),...]\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));
+
 static cl::list FunctionNameFlags(
 "function-flags", cl::desc("Function search flags:"),
 cl::values(clEnumValN(eFunctionNameTypeAuto, "auto",
@@ -220,6 +226,62 @@
 
 } // namespace opts
 
+std::vector parseCompilerContext() {
+  std::vector result;
+  if (opts::symbols::CompilerContext.empty())
+return result;
+
+  JSONParser parser(StringRef{opts::symbols::CompilerContext});
+  auto val = parser.ParseJSONValue();
+  auto array = dyn_cast_or_null(val.get());
+  if (!array) {
+WithColor::error() << "compiler context is not a JSON array\n";
+exit(1);
+  }
+  for (unsigned i = 0; i < array->GetNumElements(); ++i) {
+auto val = array->GetObject(i);
+auto entry = dyn_cast(val.get());
+if (!entry) {
+  WithColor::error() << "compiler context entry is not a JSON object\n";
+  exit(1);
+}
+auto kind_val =
+dyn_cast_or_null(entry->GetObject("kind").get());
+if (!kind_val) {
+  WithColor::error() << "compiler context entry has no \"kind\"\n";
+  exit(1);
+}
+auto kind =
+StringSwitch(kind_val->GetData())
+.Case("TranslationUnit", CompilerContextKind::TranslationUnit)
+.Case("Module", CompilerContextKind::Module)
+.Case("Namespace", CompilerContextKind::Namespace)
+.Case("Class", CompilerContextKind::Class)
+.Case("Structure", CompilerContextKind::Structure)
+.Case("Union", CompilerContextKind::Union)
+.Case("Function", CompilerContextKind::Function)
+.Case("Variable", CompilerContextKind::Variable)
+.Case("Enumeration", CompilerContextKind::Enumeration)
+.Case("Typedef", CompilerContextKind::Typedef)
+.Default(CompilerContextKind::Invalid);
+auto name_val =
+dyn_cast_or_null(entry->GetObject("name").get());
+if (!name_val) {
+  WithColor::error() << "compiler context entry has no \"name\"\n";
+  exit(1);
+}
+result.push_back({kind, ConstString{name_val->GetData()}});
+  }
+  outs() << "Search context: {\n";
+  for (auto entry: result) {
+outs() << " " << (unsigned)entry.type;
+outs() << " \"" << entry.name.GetStringRef() << "\"\n";
+  }
+  outs() << "}\n";
+
+  return result;
+}
+
 template 
 static Error make_string_error(const char *Format, Args &&... args) {
   return llvm::make_error(
@@ -464,8 +526,11 @@
 
   DenseSet SearchedFiles;
   TypeMap Map;
-  Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
-   SearchedFiles, Map);
+  if (!Name.empty())
+Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
+  SearchedFiles, Map);
+  else
+Symfile.FindTypes(parseCompilerContext(), true, Map);
 
   outs() << formatv("Found {0} types:\n", Map.GetSize());
   StreamString Stream;
@@ -679,6 +744,9 @@
 if (Regex || !File.empty() || Line != 0)
   return make_string_error("Cannot search for types using regular "
"expressions, file names or line numbers.");
+if (!Name.empty() && !CompilerContext.empty())
+  return make_string_error("Name is ignored if compiler context present.");
+
 return findTypes;
 
   case FindType::Variable:
Index: lldb/lit/SymbolFile/DWARF/compilercontext.test
===
--- /dev/null
+++ lldb/lit/SymbolFile/DWARF/compilercontext.test
@@ -0,0 +1,11 @@
+Test finding types by CompilerContext.
+RUN: llc %S/compilercontext.ll -filetype=obj -o %t.o
+RUN: lldb-test symbols %t.o -find=type -compiler-context='[{

[Lldb-commits] [PATCH] D66452: [lldb] Fix typo on the BreakpointLocation header and the lldbtest.py (NFC)

2019-08-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 216022.
mib added a comment.

updated version of the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66452

Files:
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/packages/Python/lldbsuite/test/lldbtest.py

Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -113,11 +113,11 @@
 
 BREAKPOINT_PENDING_CREATED = "Pending breakpoint created successfully"
 
-BREAKPOINT_HIT_ONCE = "Breakpoint resolved with hit cout = 1"
+BREAKPOINT_HIT_ONCE = "Breakpoint resolved with hit count = 1"
 
-BREAKPOINT_HIT_TWICE = "Breakpoint resolved with hit cout = 2"
+BREAKPOINT_HIT_TWICE = "Breakpoint resolved with hit count = 2"
 
-BREAKPOINT_HIT_THRICE = "Breakpoint resolved with hit cout = 3"
+BREAKPOINT_HIT_THRICE = "Breakpoint resolved with hit count = 3"
 
 MISSING_EXPECTED_REGISTERS = "At least one expected register is unavailable."
 
@@ -140,6 +140,8 @@
 
 STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT = "Stopped due to breakpoint and ignore count"
 
+STOPPED_DUE_TO_BREAKPOINT_JITTED_CONDITION = "Stopped due to breakpoint jitted condition"
+
 STOPPED_DUE_TO_SIGNAL = "Process state is stopped due to signal"
 
 STOPPED_DUE_TO_STEP_IN = "Process state is stopped due to step in"
Index: lldb/include/lldb/Breakpoint/BreakpointOptions.h
===
--- lldb/include/lldb/Breakpoint/BreakpointOptions.h
+++ lldb/include/lldb/Breakpoint/BreakpointOptions.h
@@ -107,6 +107,12 @@
   /// \param[in] ignore
   ///How many breakpoint hits we should ignore before stopping.
   ///
+  /// \param[in] one_shot
+  ///Should this breakpoint delete itself after being hit once.
+  ///
+  /// \param[in] auto_continue
+  ///Should this breakpoint auto-continue after running its commands.
+  ///
   BreakpointOptions(const char *condition, bool enabled = true,
 int32_t ignore = 0, bool one_shot = false,
 bool auto_continue = false);
@@ -319,7 +325,10 @@
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
 
-  /// Returns true if the breakpoint option has a callback set.
+  /// Check if the breakpoint option has a callback set.
+  ///
+  /// \return
+  ///If the breakpoint option has a callback, \b true otherwise \b false.
   bool HasCallback() const;
 
   /// This is the default empty callback.
@@ -367,22 +376,32 @@
   void SetThreadSpec(std::unique_ptr &thread_spec_up);
 
 private:
-  // For BreakpointOptions only
-  BreakpointHitCallback m_callback;  // This is the callback function pointer
-  lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
+  /// For BreakpointOptions only
+  
+  /// This is the callback function pointer
+  BreakpointHitCallback m_callback;
+  /// This is the client data for the callback
+  lldb::BatonSP m_callback_baton_sp;
   bool m_baton_is_command_baton;
   bool m_callback_is_synchronous;
   bool m_enabled;
+  /// If set, the breakpoint delete itself after being hit once.
   bool m_one_shot;
-  uint32_t m_ignore_count; // Number of times to ignore this breakpoint
-  std::unique_ptr
-  m_thread_spec_up; // Thread for which this breakpoint will take
-  std::string m_condition_text; // The condition to test.
-  size_t m_condition_text_hash; // Its hash, so that locations know when the
-// condition is updated.
-  bool m_auto_continue; // If set, auto-continue from breakpoint.
-  Flags m_set_flags;// Which options are set at this level.  Drawn
-// from BreakpointOptions::SetOptionsFlags.
+  /// Number of times to ignore this breakpoint.
+  uint32_t m_ignore_count;
+  /// Thread for which this breakpoint will stop.
+  std::unique_ptr m_thread_spec_up;
+  /// The condition to test.
+  std::string m_condition_text;
+  /// Its hash, so that locations know when the condition is updated.
+  size_t m_condition_text_hash;
+  /// If set, inject breakpoint condition into process.
+  bool m_inject_condition;
+  /// If set, auto-continue from breakpoint.
+  bool m_auto_continue;
+  /// Which options are set at this level.
+  /// Drawn from BreakpointOptions::SetOptionsFlags.
+  Flags m_set_flags;
 };
 
 } // namespace lldb_private
Index: lldb/include/lldb/Breakpoint/BreakpointLocation.h
===
--- lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -67,7 +67,7 @@
 
   // The next section deals with various breakpoint options.
 
-  /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+  /// If \a enabled 

[Lldb-commits] [PATCH] D66452: [lldb] Fix typo on the BreakpointLocation header and the lldbtest.py (NFC)

2019-08-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369313: [lldb] Fix typo on the BreakpointLocation header and 
the lldbtest.py (NFC) (authored by mib, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66452?vs=216022&id=216025#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66452

Files:
  lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Index: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
===
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
@@ -67,7 +67,7 @@
 
   // The next section deals with various breakpoint options.
 
-  /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+  /// If \a enabled is \b true, enable the breakpoint, if \b false disable it.
   void SetEnabled(bool enabled);
 
   /// Check the Enable/Disable state.
Index: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
===
--- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
@@ -107,6 +107,12 @@
   /// \param[in] ignore
   ///How many breakpoint hits we should ignore before stopping.
   ///
+  /// \param[in] one_shot
+  ///Should this breakpoint delete itself after being hit once.
+  ///
+  /// \param[in] auto_continue
+  ///Should this breakpoint auto-continue after running its commands.
+  ///
   BreakpointOptions(const char *condition, bool enabled = true,
 int32_t ignore = 0, bool one_shot = false,
 bool auto_continue = false);
@@ -319,7 +325,10 @@
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
 
-  /// Returns true if the breakpoint option has a callback set.
+  /// Check if the breakpoint option has a callback set.
+  ///
+  /// \return
+  ///If the breakpoint option has a callback, \b true otherwise \b false.
   bool HasCallback() const;
 
   /// This is the default empty callback.
@@ -367,22 +376,32 @@
   void SetThreadSpec(std::unique_ptr &thread_spec_up);
 
 private:
-  // For BreakpointOptions only
-  BreakpointHitCallback m_callback;  // This is the callback function pointer
-  lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
+  /// For BreakpointOptions only
+  
+  /// This is the callback function pointer
+  BreakpointHitCallback m_callback;
+  /// This is the client data for the callback
+  lldb::BatonSP m_callback_baton_sp;
   bool m_baton_is_command_baton;
   bool m_callback_is_synchronous;
   bool m_enabled;
+  /// If set, the breakpoint delete itself after being hit once.
   bool m_one_shot;
-  uint32_t m_ignore_count; // Number of times to ignore this breakpoint
-  std::unique_ptr
-  m_thread_spec_up; // Thread for which this breakpoint will take
-  std::string m_condition_text; // The condition to test.
-  size_t m_condition_text_hash; // Its hash, so that locations know when the
-// condition is updated.
-  bool m_auto_continue; // If set, auto-continue from breakpoint.
-  Flags m_set_flags;// Which options are set at this level.  Drawn
-// from BreakpointOptions::SetOptionsFlags.
+  /// Number of times to ignore this breakpoint.
+  uint32_t m_ignore_count;
+  /// Thread for which this breakpoint will stop.
+  std::unique_ptr m_thread_spec_up;
+  /// The condition to test.
+  std::string m_condition_text;
+  /// Its hash, so that locations know when the condition is updated.
+  size_t m_condition_text_hash;
+  /// If set, inject breakpoint condition into process.
+  bool m_inject_condition;
+  /// If set, auto-continue from breakpoint.
+  bool m_auto_continue;
+  /// Which options are set at this level.
+  /// Drawn from BreakpointOptions::SetOptionsFlags.
+  Flags m_set_flags;
 };
 
 } // namespace lldb_private
Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -113,11 +113,11 @@
 
 BREAKPOINT_PENDING_CREATED = "Pending breakpoint created successfully"
 
-BREAKPOINT_HIT_ONCE = "Breakpoint resolved with hit cout = 1"
+BREAKPOINT_HIT_ONCE = "Breakpoint resolved with hit count = 1"
 
-BREAKPOINT_HIT_TWICE = "Breakpoint resolved with hit cout = 2"
+BREAKPOINT_HIT_TWICE = "Breakpoint resolved with hit count = 2"
 
-BREAKPOINT_HIT_THRICE = "Breakpoint resolved with hit cout = 3"
+BREAKPOINT_HIT_THRICE = "Br

[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/tools/lldb-test/lldb-test.cpp:145
+"compiler-context",
+cl::desc("Specify a compiler context as \"[(type,name),...]\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));

> ...as a JSON array...`

This makes me wonder though, wouldn't it be better to pass a file here and have 
it live in inputs? Do you expect it to be different across tests or could we 
reuse the context across tests?


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

https://reviews.llvm.org/D66453



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


[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl marked an inline comment as done.
aprantl added inline comments.



Comment at: lldb/tools/lldb-test/lldb-test.cpp:145
+"compiler-context",
+cl::desc("Specify a compiler context as \"[(type,name),...]\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));

JDevlieghere wrote:
> > ...as a JSON array...`
> 
> This makes me wonder though, wouldn't it be better to pass a file here and 
> have it live in inputs? Do you expect it to be different across tests or 
> could we reuse the context across tests?
I don't really expect a DeclContexts to have more than 3 entries in the 
forseeable future, so that would arguable just make the test harder to read.


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

https://reviews.llvm.org/D66453



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


[Lldb-commits] [PATCH] D66451: [ClangExpressionParser] Add ClangDeclVendor

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Symbol/DeclVendor.h:27
+eAppleObjCDeclVendor,
+eLastClangDeclVendor,
+  };

xiaobai wrote:
> JDevlieghere wrote:
> > What's `eLastClangDeclVendor` and where is it used?
> Following the advice here: https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html
> 
> I added a Last one to indicate that any new ClangDeclVendor subclasses should 
> go before this one. It also makes the classof pattern of checking bounds 
> easier. (kind >= eFoo && kind < eLastFoo).
> 
> 
Fair enough, I totally forgot about that pattern. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66451



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


[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/tools/lldb-test/lldb-test.cpp:145
+"compiler-context",
+cl::desc("Specify a compiler context as \"[(type,name),...]\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));

aprantl wrote:
> JDevlieghere wrote:
> > > ...as a JSON array...`
> > 
> > This makes me wonder though, wouldn't it be better to pass a file here and 
> > have it live in inputs? Do you expect it to be different across tests or 
> > could we reuse the context across tests?
> I don't really expect a DeclContexts to have more than 3 entries in the 
> forseeable future, so that would arguable just make the test harder to read.
But would those entries be the same across tests or not? If they're the same I 
think it'd be better to reuse them, even if it's only a few entries.


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

https://reviews.llvm.org/D66453



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


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-19 Thread James S Blachly, MD via Phabricator via lldb-commits
jblachly added a comment.

Thank you for creating a revision and reviewing this.

I made inline comments on the test harness and Dlang types / qualifiers.

With removal of the Dlang types, where is the appropriate place to put them?
It is not clear to me whether language plugins can replace the functionality in 
ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize.

Thanks again




Comment at: 
lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/TestCxxChar8_t.py:26
+
+@skipIf(compiler="clang", compiler_version=['<', '5.0'])
+def test(self):

JDevlieghere wrote:
> This should be 7
I believe clang7 requires -fchar8_t, whereas the test harness here passes 
-std=c++2a ; char8_t is enabled via -std=c++2a beginning in clang-8

"(11): Prior to Clang 8, this feature is not enabled by -std=c++2a, but can be 
enabled with -fchar8_t. "

https://clang.llvm.org/cxx_status.html#p0482



Comment at: lldb/source/Symbol/ClangASTContext.cpp:1383-1384
+streq(type_name, "wchar") || // dlang
+streq(type_name, "const(wchar)") ||
+streq(type_name, "immutable(wchar)")) {
   return CompilerType(this, ast->Char16Ty.getAsOpaquePtr());

clayborg wrote:
> are "const(T)" and "immutable(T)" the actualy type names or are they layers 
> on top of a base "wchar" type? These shouldn't be needed if so as the base 
> "wchar" type should end up handling the base type correctly. Remove?
In LDC (the LLVM D compiler), application of type qualifier immutable or const 
to a type T defines a new type.
I am not a DWARF expert, but running a sample program through lldb seems to 
confirm this:

error: need to add support for DW_TAG_base_type 'char' encoded with DW_ATE = 
0x10, bit_size = 8
error: need to add support for DW_TAG_base_type 'const(char)' encoded with 
DW_ATE = 0x10, bit_size = 8
error: need to add support for DW_TAG_base_type 'immutable(char)' encoded with 
DW_ATE = 0x10, bit_size = 8

Whereas -- interestingly -- the reference compiler DMD encodes them differently 
(as char, const char, and char; respectively as the DWARF spec I guess has no 
qualifier for immutable). The LDC behavior is IMO more true to language spec.



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

https://reviews.llvm.org/D66447



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